Request: manage which passes are drawn by smgr->drawall

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by 3DModelerMan »

Link to the patch that I implemented: https://sourceforge.net/tracker/?func=d ... tid=540678
I tested it by adding this to the SpecialFX demo drawAll function:

Code: Select all

 
smgr->drawAll((u32)scene::ESNRP_TRANSPARENT | (u32)scene::ESNRP_SHADOW);
 
Any suggestions for improvements?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Re: Request: manage which passes are drawn by smgr->drawall

Post by greenya »

3DModelerMan wrote:Any suggestions for improvements?
I'm just curious, why do you have "drawAll(u32 flags)" instead of "drawAll(E_SCENE_NODE_RENDER_PASS flags)"?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Request: manage which passes are drawn by smgr->drawall

Post by hybrid »

Because the or'ed combination of all enabled flags is not an enum anymore. I didn't review the patch so far, but I'm also not sure if I want to change the drawAll signature. I see that it's much simpler this way, but I have to check the other methods around there to see if it fits, or if we just use the mode settings.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by mongoose7 »

Probably not appropriate here, but I think the drawAll routine should be reworked. Someone has poked around in it to enable "light manager" capabilities, but you can't do forward rendering with it. With everyone talking about shaders, this seems to be a major problem. Now I know many people do forward and deferred rendering in Irrlicht, but, really, that's not what is going on is it? Everyone is coding around the rendering loop.

I say that the one thing that should be supported is forward rendering. And it's not.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Re: Request: manage which passes are drawn by smgr->drawall

Post by hybrid »

Well, I guess that the above topic is basically solved, so just propose your ideas here. What is wrong or should be enhanced?. Just mind that the light manager is just wrongly named, it's a pre-render callback not necessarily tied to lights
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by mongoose7 »

Errm. Thinking about it, it may be best to have drawAll just render the scene.

What I would like to do is

Code: Select all

for (light)
{
    setRenderTargetDepth();
    smgr->drawAll();
    setRenderTarget();
    smgr->drawAll();
}
setRenderTarget();
quad->render();
smgr->endScene()
;

so it might be better not to change smgr->drawAll() in fact. Sorry for the interruption. :oops:
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by 3DModelerMan »

You can call drawAll without parameters and it works just like before (i made sure to try). So it shouldn't be a problem to change the function signature.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by hendu »

@3DModelerMan

Ack from me. I would have used enable instead of disable, and there's some unnecessary work still done for each skipped pass (placing the ifs before each section would remove that work), but it looks good as is.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by 3DModelerMan »

The ifs before each section? I don't understand what you mean. I tried placing them at the top, but they had to be called after OnRegisterSceneNode for it to work. I'll look at my code again and see what you mean.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by hendu »

I mean like this:

Code: Select all

diff --git a/source/Irrlicht/CSceneManager.cpp b/source/Irrlicht/CSceneManager.cpp
index f9af4e8..184b2f3 100644
--- a/source/Irrlicht/CSceneManager.cpp
+++ b/source/Irrlicht/CSceneManager.cpp
@@ -1353,6 +1353,7 @@ void CSceneManager::drawAll()
                LightManager->OnPreRender(LightList);
 
        //render camera scenes
+       if (flags & ESNRP_CAMERA)
        {
                CurrentRendertime = ESNRP_CAMERA;
                Driver->getOverrideMaterial().Enabled = ((Driver->getOverrideMaterial().EnablePasses & CurrentRendertime) != 0);
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by 3DModelerMan »

Doesn't that still call draw on all the scene nodes that don't need to be drawn?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by hendu »

It was a quick copy-paste to show the location; yes, it would not work if the argument is to disable.

For disable instead of enable it would need to be inverted:

Code: Select all

if (!(flags & ESNRP_CAMERA))
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by 3DModelerMan »

I meant that the nodes still get OnRegisterSceneNode called, and end up registering for no reason. You think that it should take which render states to enable? I guess that would be more intuitive. I'll change it if I get a chance later today.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by mongoose7 »

You'll have to be careful with OnAnimate as well.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Request: manage which passes are drawn by smgr->drawall

Post by hendu »

For enable:

At least for me, I'm much more likely to only draw one or two passes, and it's much nicer to write
draw(camera)
draw(solid)

instead of

draw(everything|but|camera)
draw(everything|but|solid)


On OnRegister, OnAnimate:
That also happens with your patch? Also, it's not something we can prevent, as we can't tell in advance whether a mesh is solid etc.

Though I see with this approach the set_used(0) calls will have to be moved to the end, outside of the blocks.
Post Reply