Custom renderer, viewport render crashes



  • Hi!
    I am writing a custom renderer, implemented as a videopost plugin. In the execute() function of the videpost, during VIDEOPOSTCALL::INNER, I traverse the document obtained from vps->doc to extract the scene information (geometry, shaders, lights, etc. ) that gets sent to the API of the renderer.

    All works fine when I render to the picture viewer, but when I try to do viewport rendering I get crashes.

    During the traversal, I do in some cases perform some operations on the parsed document, such as AnimateDocument(), ExecutePasses() etc. I am thinking that one of these might be the culprit. So, here is my somewhat vague question: Are there any operations that are forbidden to perform on vps->doc during viewport rendering? (But are allowed during picture viewer rendering)

    Thanks!
    /Filip



  • Hi Filip, thanks for reaching out us.

    With regard to your issue, I'm a bit confused by the need you have to call BaseDocument::AnimateObject() or BaseDocument::ExecutePasses() when the VIDEOPOSTCALL in VideoPostData::Execute() is VIDEOPOSTCALL::INNER. Actually when you're in this step, you can already access and query the VolumeData to retrieve all the relevant information about the scene elements (like RayObject, RayLight and so on).

    If for optimization reasons you need to execute these calls nevertheless, I warmly recommend cloning the whole document on a temp doc, perform your actions there, use this temp doc to feed your renderer with the needed data and, in the end, dispose the temp doc. Consider that this approach is sub-optimal since you're going to double the resources used to store the current document.

    Best, R



  • "I warmly recommend cloning the whole document on a temp doc"
    Thanks, I'll try working on a clone. I had the impression that the document passed to the videopost was already a clone of the original document, but perhaps this is not the case for viewport rendering?

    "With regard to your issue, I'm a bit confused by the need you have to call BaseDocument::AnimateObject() or BaseDocument::ExecutePasses() when the VIDEOPOSTCALL in VideoPostData::Execute() is VIDEOPOSTCALL::INNER. Actually when you're in this step, you can already access and query the VolumeData to retrieve all the relevant information about the scene elements (like RayObject, RayLight and so on)."

    -We have some good reasons for working with the basedocument directly, rather than the data provided from the VolumeData.

    "Consider that this approach is sub-optimal since you're going to double the resources used to store the current document."
    -OK. This should be fine for our purposes. Our plugin actually provides custom rendering commands, that are the preferred way of rendering with the plugin. The videopost functionality is added as more of a convenience in our case, to make the plugin work nicely with things like viewport rendering, material preview etc.

    /Filip