Calling the Filament Renderer in plugin code? [SOLVED]

bigD3dbigD3d Posts: 75

Hello everyone,

I'm hoping someone has started playing with the Filament renderer from a plugin, or just know the ins and outs of the rendering classes and might spot the obvious for me...

I have a plugin which starts a render with this code:

    DzRenderer* myRenderer = myRenderMgr->getActiveRenderer();
    DzProgress renderProgressPopup("Rendering with " + myRenderer->getName() + " Renderer...");
    bool success = myRenderer->render(myHandler, myCamera, dzApp->getRenderMgr()->getRenderOptions());

 

The attached picture shows my Rendering Tab, where the Engine selected is '3Delight'. When my plugin runs it correctly says myRenderer's name is 3Delight and the image my plugin outputs in a 3Delight image.

But when I select the Engine as 'Viewport' in order to get it to render with Filament, it gives the name back as 'NVidia Iray' and renders in Iray.

Is the Engine choice in this drop down not what you are selecting with 'getActiveRenderer()'? Or, if yes, is there something else I need to set in order to get Filament to be selected? Also, all my Main Window viewports have 'Filament (PBR)' selected as the user draw style.

thanks in advance for any insight/guidance/help!

Engine Selection.jpg
1046 x 178 - 37K
Post edited by bigD3d on

Comments

  • bigD3dbigD3d Posts: 75
    edited January 2021

    Thanks to Richard Haseltine who answered over in the Daz Scripting forum where I also posted hoping to get info that can translate into plugin code. If you are reading this you can find the scripted sample for what options to select for the renderer and render options here:

    http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/rendering/render_drawstyle/start

    Here's the basics of my code which worked for me. My Daz Script code handles some items before calling my plugin, like setting the layout and user drawing style to 'Filament (PBR)'. If you are doing everything in plugin you may need to set the layout and user draw styles here also.

    // get render mgr and options
    DzRenderMgr* oRenderMgr = dzApp->getRenderMgr();
    DzRenderOptions* oRenderOptions = oRenderMgr->getRenderOptions();
    
    // set required render options
    oRenderOptions->setRenderImgToId(oRenderOptions->DirectToFile);
    oRenderOptions->setRenderType(oRenderOptions->ScreenShot);
    
    
    // tempFilename is QString of my temp directory + filename
    oRenderOptions->setRenderImgFilename(tempFilename); 
    
    // tempImage is a QImage. Used to set the desired render dimensions, otherwise if skipped setting it manually it will use the render options height/width
    oRenderOptions->setImageSize(tempImage.size()); 
    
    // select the viewport and make it active (note:viewportMgr has been passed into my class from DazScript, you would need to create your own)
    DzViewport* oViewport = viewportMgr->getViewport(0); // depends on the layout and which viewport you are trying to render, get the index of the one you want
    
    // set which viewport is active (it will only render the active viewport)
    viewportMgr->setActiveViewport(oViewport);
    
    // render the active viewport
    bool success = myRenderMgr->doRender(myRenderOptions);
    Post edited by bigD3d on
Sign In or Register to comment.