[Closed] Rendering the material preview
Hi,
I’m integrating a renderer into 3ds Max. I currently have a renderer plugin and a material plugin, both written in C++.
When my renderer plugin is invoked to render a material preview for the compact material editor, the scene node passed to my plugin appears to be empty, i.e. NumberOfChildren() returns 0 when called on the INode passed to my plugin’s Open() method.
Is there a way to retrieve the geometry for the material preview scene, or the geometry of the sample object? Or should I assume that when the scene is empty, it should be considered to be made of a single sphere? In which case, what are the parameters (position, radius, texture coordinates…) of this sphere?
The node you are being passed IS the sample geometry, not the scene root.
From the docs on Renderer::Open :
in scene – The root node of the scene to render. Note: If you are rendering in the Materials Editor, you’ll instead get a pointer to the INode that is in the sample slot – not the root node of the scene.
Oh, brilliant, that works like a charm. Thanks a lot!
What about the gray background in material previews? Is that something I need to reproduce manually, or is it some kind of standard background color (that I don’t support yet)?
It would not make sense that you would need to reproduce it because the user can also select a checkered background color in the preview slot. This has to be something max gives you.