Understanding RenderPass

Yes, it's me again  :smiley:



As I'm sure you can all tell, I'm very new to the jME. I'm thoroughly enjoying learning all the ins and outs of the engine, before I start on any serious project. As I have gathered up sections of other peoples examples, I had to move from SimpleGame to SimplePassGame and place my rootNode into a RenderPass for rendering by the Rendermanager. I find myself using a mixture spatials rendered as part of the rootNode render, and others that are rendered with their own Passes (my terrain for instance). I have now reached a point where I need to tidy everything up. So, here's a few questions:


  1. My terrainPage is rendered using a RenderPass that uses a shader. However, I still have the terrainPage attached to the rootNode for reflecting in my water. As I'm rendering the rootNode through a RenderPass and then the terrain is rendered through it's own RenderPass, is it being rendered twice ?


  2. My water has a reflect node that says what spatials to reflect. This node currently contains the player model, the terrain and a couple of other models. If the player node has no special Pass, but the others do, can I just add the reflection node to the water, providing the PassManager has rendered the nodes first ?


  3. Did 2. make any sense ? :slight_smile:


  4. If a node is being rendered through a custom Pass, can the node still be set as a shadow occluder in a ShadowedRenderPass ?


  5. My Water class is simply a manager for WaterRenderPass. I add the water Quad spatial to the rootNode and also add the WaterRenderPass to the PassManager. The rootNode is rendered with a RenderPass, so does that mean my water's getting rendered twice ?


  6. Is it a likely scenario that in a SimplePassGame, you might not have anything attached to the rootNode ?



    I think that's it for now. All getting a bit confusing :slight_smile:



    Thanks





    Mak

passnode works just like renderpass but with the ability to put it anywhere in the scenegraph, so you could use passnode at the top level instead of renderpass to get the same functionality…we will probably remove renderpasses later in favour for something similar to passnode(but might be included directly into the scenegraph objects etc)

Hi mak


1. My terrainPage is rendered using a RenderPass that uses a shader. However, I still have the terrainPage attached to the rootNode for reflecting in my water. As I'm rendering the rootNode through a RenderPass and then the terrain is rendered through it's own RenderPass, is it being rendered twice ?

2. My water has a reflect node that says what spatials to reflect. This node currently contains the player model, the terrain and a couple of other models. If the player node has no special Pass, but the others do, can I just add the reflection node to the water, providing the PassManager has rendered the nodes first ?

The terrain is rendered 3 times, once through its own pass, through your rootNode pass, and through the water pass' render to texture.
If the shader is applied through a pass state, rather than through a spatial state, then those states will not be used when the terrain is rendered individually.

3. Did 2. make any sense ?

Yes, but it took a while to understand  :roll:

4. If a node is being rendered through a custom Pass, can the node still be set as a shadow occluder in a ShadowedRenderPass ?

Probably, yes. The shadow pass does not render the node, but it generates a shadow volume for it's geometry, and renders the shadow in its pass.

5. My Water class is simply a manager for WaterRenderPass. I add the water Quad spatial to the rootNode and also add the WaterRenderPass to the PassManager. The rootNode is rendered with a RenderPass, so does that mean my water's getting rendered twice ?

WaterRenderPass does not render the water quad, it generates the reflections and refractions through the reflected scene node. The quad is then rendered by the user in a separate pass.

6. Is it a likely scenario that in a SimplePassGame, you might not have anything attached to the rootNode ?

You do not have to use the provided rootNode in your SimplePassGame, because the rendering is done through the pass manager.

Thanks Momoko



Once again you have sifted through my waffling and helped me enourmously !



I am going to have to take a moment to digest all this, and may have some other questions. I hope you don't mind.



Oh, and …


Do you happen to use my hardware terrain splatting solution?


Possibly  :wink:



Mak

whats the advantage of putting everything into a rander pass?



right now im just using basegame + game states. everything is still rendered through root node of its game state.



should i put each game state into a seperate render pass?

Hi neakor



The only reason managing my own RenderPasses has become a requirement for me now is that I need to make two passes over my terrain. One uses a shader pass to render the terrain, and the second pass is Momoko's terrain splatting methods for generating the terrain detail (dirt tracks, etc) using alpha maps.



Up until this point, I was just attaching everything to the rootNode and putting the rootNode through a Pass.





Mak

You could also use PassNode for those things, so you don't have to break everything down to top level RenderPasses…Have a look at TestPassNode

Woah, this is wierd. I can't find PassNode in my jME source (or TestPassNode) and I downloaded the source again only 2 days ago.

they were added two weeks ago approx…

Hmm. I downloaded the src from the Download Nightly Build section on the website only 2 days ago. Is this nightly build currently being done, or am I better off getting the src from the CVS ?



Thanks



(Sorry for all the questions)





Mak

It might be screwed up, but I would say you are always better of getting stuff from CVS anyways :slight_smile:

Thanks Mr. C



I'm doing that right now.







Mak





Edit: Found it ! Thanks Mr. C. Looks like the nightly build might be a little screwed.

Hey, thanks Coder. PassNode looks to be exactly the bag-o-tricks that I'm after.



Mak

goody!  :smiley:

oh ok~thx for the info.



coz i heard some plp said that render pass is more efficient or something like that~ :smiley:

In a sense it is bound to be better. The render node has to be traversed each pass to detect things that need to be rendered at the present time (pass), while having a whole scene-graph under the pass obviates this issue.



I would say it really depends on the complexity of your scene-graph. If you have potentially thousands of nodes, then traversing it for drawing many passes might make a difference.