Rendering plugin crashes on raytraced materials

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear All,
I am developing a custom render plugin based on the CJRenderer project from the 3DS Max SDK 2013. I have fixed most of the errors in the sample (e.g. two sided rendering, etc.) however a problem remains with raytraced materials.
In raytrace.cpp CJRenderer::CastRay() function when calling Shade on raytraced materials, like this
BOOL CJRenderer::CastRay(CJRenderParams& rp, Ray* ray, SContext* sc, int depth, Color& col, GBufInfo* gbInfo) { ... hitInfo.instance->mtl->Shade(*sc); ... }
I get an access violation reading from location. Someone is calling a function of an instance that is a zero pointer inside.
First-chance exception at 0x322fb525 in 3dsmax.exe: 0xC0000005: Access violation reading location 0x00000000
Without this, I cannot evaluate refraction, as sc->out.ior looks unitialized.
Standard material transparency also does not work, as it is not evaluated correctly by the renderer.
To test this, create any object (e.g. a sphere), add a raytraced material setup the B buffer renderer as production renderer and hit render.
Any ideas what I am missing on this?
Best regards,
Attila