possible GetRenderMesh issue

Hi,

I’m experiencing some problems getting multiple animation samples from an object in a single frame. This seems to crash VRay ocasionally.

Please, see attached scene. It uses a ‘Scatter’ compound object from a sample teapot, with ‘Animation Offset’ set to 3. Rendering it produces errors in log (as ‘Mesh has not face array…’), the source teapot is not visible and sometimes crashes the render. Since the error is random, is needed to render the full animation a couple of times to see the problem. I’ve used Max 9-32, Max 2009-64 seems to be stable (i’m not sure why).

I think the problem would be that VRay gets the mesh using ‘GetRenderMesh’ at frameBegin, and stores the pointer to use it for next render stages… but if other plugin (as Scatter here), uses GetRenderMesh later, then the pointer is not longer valid and VRay crashes. Of course, this is only a theory but perhaps your dev team would confirm it.

Btw, setting the teapot to not renderable solves the error, probably because VRay doesn’t use GetRenderMesh on it.

Regards,
Carlos.
anim1.zip (22 KB)

You are correct; if an object is not animated, V-Ray will only store a pointer to the GetRenderMesh() result, rather than copying the entire mesh. If something else calls later on GetRenderMesh() for a different moment of time, this will invalidate the pointer that V-Ray has already remembered and will cause a crash.

To avoid the crash, you must make sure that you call GetRenderMesh() on the particular object before V-Ray has had a chance to do that. One way to do that is to use the NOTIFY_RENDER_PREEVAL notification. There may be other ways, but I don’t know exactly what you are trying to do.

Best regards,
Vlado

Thanks Vlado, i’ve solved it using NOTIFY_RENDER_PREEVAL :slight_smile:

Regards,
Carlos.