If I want to use my own Ray Tracer in a program like 3DS Max to render geometry, how could I do this? Can someone explain to me what I need to do and where I can learn to use an SDK to make this happen? Is this worth it to render test scenes to compare and test my ray tracer?
- $\begingroup$ Have you checked the MaxSDK ? I imagine here may be a good start > docs.autodesk.com/3DSMAX/16/ENU/3ds-Max-SDK-Programmer-Guide/… $\endgroup$PaulHK– PaulHK2017-02-16 08:05:48 +00:00Commented Feb 16, 2017 at 8:05
- 3$\begingroup$ Alternatively you could use the open source AssImp library to import scenes and render them inside your own program, rather than getting your program to interoperate with Max, which I guess would involve more effort. $\endgroup$PaulHK– PaulHK2017-02-16 08:07:52 +00:00Commented Feb 16, 2017 at 8:07
- 1$\begingroup$ What would you like to compare your scenes with? With the output of the internal 3DS Max renderer? I was told by a Corona developer that the MaxSDK was painful to work with and also not well documented (at least in previous versions), so be prepared for that ;-) $\endgroup$ivokabel– ivokabel2017-02-16 19:15:53 +00:00Commented Feb 16, 2017 at 19:15
1 Answer
You can do this by writing a renderer plugin for 3ds Max. This gives you the same kind of access as the built-in renderers, including a settings dialog, a preview window, and an interface where you can write the final frame of a full render (and 3ds Max will write it to the output file). The renderer plugin gets full access to the scene graph when the user hits "Render" (or when the preview window is in use). Any complex geometry (such as subdivision surfaces) will already have been converted to a triangle mesh for you.
PaulHK already linked the official Programmers' Guide online. You'll also find it in the help files that are installed with 3ds Max, along with sample source code for a trivial renderer plugin. Because your plugin needs to link against the 3ds Max SDK, you'll need to compile it with the same version of Microsoft Visual Studio that was used to compile the particular version of 3ds Max you're targeting. (This means that if you want to target multiple versions of 3ds Max, you might need multiple builds.) Again, how to do this is described in the Programmers' Guide.
- $\begingroup$ What do you think would be faster and easier to implement? Using the MaxSDK or using Asslmp to import the scenes into my ray tracer? If I use the Asslmp method will it just import geometry will I have to define materials & textures myself? $\endgroup$Arjan Singh– Arjan Singh2017-02-17 07:38:37 +00:00Commented Feb 17, 2017 at 7:38
- 2$\begingroup$ AssImp imports materials and uvs. IIRC AssImp uses a key/value system for materials, so it can handle every material parameter type you can imagine. For me personally, I would prefer to import via AssImp, I hear MaxSDK can be frustrating. $\endgroup$PaulHK– PaulHK2017-02-17 09:59:17 +00:00Commented Feb 17, 2017 at 9:59
- 2$\begingroup$ Yeah, I've worked with the Max SDK before. It's badly designed and implemented, full of pitfalls and undocumented "features", and a lot of the sample code doesn't work. I'd recommend avoiding it if you can. That said, I don't know how good AssImp is, and I don't know if it will evaluate materials for you or if you'll have to reimplement all the materials yourself - and of course I wouldn't expect it to work with other Max shader or light plugins. $\endgroup$Dan Hulme– Dan Hulme2017-02-17 11:05:58 +00:00Commented Feb 17, 2017 at 11:05