[Closed] 3dsmax SDK renderer , material preview
I’m stuck at something in a renderer I’m working on.
The renderer itself works fine, we also made a couple of shaders in c++.
The problem I cannot seem to find any information about is the material preview.
When we open the material editor – the render function in our renderer is called, and it creates a ‘preview’ render of the scene,
just the same as if it was a regular ‘render’.
What we want is the same type of preview as for any other renderer (Iray\MentalRay etc).
So I figured I could hardcode a ‘preview’ scene, then use that for when the renderer is rendering the material preview, then take the resulting image and put it in the material slot preview window.
However I’m stuck at figuring out ‘what’ is calling the render function.
I’ve looked through the samples and ‘howto’s’ in the SDK , I find nothing that helps me with this.
Do anyone of you have any information about this?
RenderGlobalContext has a boolean field called inMtlEdit, which lets you know if you’re currently rendering a material sample.
Ah, thank you, that was exactly what I needed.
Not easy finding all these small things in the SDK.
I need to ask one more thing, the bool works, but how do you know which slot it’s currently previewing?
I also need to create the material of the slot currently being previewed in the renderer.
That’s the last missing piece.
Doesn’t make sense to me that you would need to know, I assume max would take care of this automatically.
If you want to take a look at an implementation of a finished render, you can try the NOX sources:
I see, I’ll look through there and post the code I end up with here when I’m done. thanks!