Rendering plugin crashes on raytraced materials

Rendering plugin crashes on raytraced materials

Anonymous
Not applicable
642 Views
3 Replies
Message 1 of 4

Rendering plugin crashes on raytraced materials

Anonymous
Not applicable

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

0 Likes
643 Views
3 Replies
Replies (3)
Message 2 of 4

denis_grigor
Autodesk Support
Autodesk Support

Hi Attila,

 

The CJRenderer is an quite outdated example and I would like to draw your attention that in the latest 3ds Max SDK we have a new Rendering API, along with some related sample code like "maxsdk\samples\render\RenderingAPI" and "maxsdk\samples\render\RapidRTRenderer".

The documentation on the new Rendering API is not yet fully available, but its coming soon.

 

For a review on other 3ds MAX changes, I encourage you to see this post.

 

I hope you'll find it useful.


Denis GRIGOR
Developer Technical Services
Autodesk Developer Network



0 Likes
Message 3 of 4

larryminton
Autodesk
Autodesk

Attila,

 

Just a FWIW, I just tried this in a 2017 debug build, and didn't get a crash.  So you could be running into a problem that was fixed either in CJRenderer or the raytrace material after 2013.  

 


Larry Minton
Principal Engineer, M&E-Design Animation
0 Likes
Message 4 of 4

Anonymous
Not applicable
Dear All,

Thank you for your replies, when I get a chance to work with the new
SDK, I will try again. I could see the example was outdated from the
comments referring to ancient versions of the SDK. 🙂
Does it help you in any way if I press Kudos? If yes, I shall. 🙂
It is really hard to define a custom camera with rays that are generated
from non-linear, non-pinhole camera definition. That's why I went with
the whole rendering plugin idea. Any chance the new SDK could help me
with that? That way my camera might work with other renderers. Any
chance for a custom camera API along the lines of

//Could be CameraRaySource, CameraSampler whatever...
class CameraInterface
{

//bunch of other stuff
...
virtual Ray getRay(const Point2& pixelCoords ) = 0;
};

any time soon?
Just out of curiosity, how do you simulate lens distortions? (Probably
post processing or actual lens geometry... You guys have it easy on 2D
displays...)
I ran into a bunch of other troubles with being unable to do tone
mapping from the API and ray sampling errors that are not easy to solve
due to non-linearities in my camera. When I have some time, I will try
to find out what went wrong with it and post an example with code.
(Sorry, I have not been working on this for a while. It was more than a
year ago.)

But the plugin mostly works now for simple materials. Also ran into
trouble due to having a different OptiX version, which I solved by
moving my ray generator to a different process.

Best regards,
Attila


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
0 Likes