Hi Paul,

I am not that familar with customizing RenderStage, but it seems it would be 
the way to go. However, I am not sure if using own RenderStages is that easy in 
osg. 

I solved my problem in a different way. So, this is how I do with osgPPU in a 
new module called UnitBypassRepeat:

- use the new feature of TRAVERSAL_ORDER (so no sorting) for the renderbin used 
by the rendering entities

- Unit's are derived from group and their traverse() method is rewritten in the 
way, such that when CullVisitor is going over the units graph in DFS manner, it 
only goes to its children whe all parents were already visited. Hence one can 
think on this like a combination of DFS and BFS, I don't know the exact name 
for this. However, this step is related to osgPPU, so you don't need it

- then as soon as I reach a group node, which's subgraph should be repeated, I 
retraverse the subgraph as often as there are iterations

- then I have specified some kind of extra pre-draw callback for this special 
repeatable group node (by placing empty drawable under that group), which is 
active only on iteration >= 2. In this callback I reset textures to the shaders 
accordingly to the output of the very last node in the repeatable subgraph. 
This yields to a connection of shaders in the beginning of a loop with the 
output of the last element.

Thats it. So the main thing is actually to use this new TRAVERSAL_ORDER feature 
and to reset inputs correctly after first iteration.
This gives me now a possibility to have computational loops in osgPPU and hence 
simplifies implementation of algorithms requirng multiple iterations. Since 
osgPPUs applies FBOs manually, I can always be sure, that a correct FBO is 
applied before a unit is rendered.


Cheers,
art



 

Paul Martz wrote:
> Hi Art -- I'm wondering if there's a slick way to tap into RenderStage 
> to do what we want here. Assuming you have a Camera with a scene graph 
> attached, and want to render it multiple times, then ideally the draw 
> iteration could just happen atomically in some kind of custom 
> RenderStage associated with the Camera. As the custom RenderStage does 
> the draw iterations, it would need to iterate over a list of FBOs that 
> it is rendering to, and likewise it would need to switch textures used 
> as input for each iteration.
> 
> It seems like doing this in a single Camera/RenderStage would be 
> optimal, as the modelview and projection matrices are typically not 
> changing in this kind of scenario.
> 
> For my depth peeling project, ideally the number if iterations would be 
> variable. I'd use occlusion query and stop iterating when no pixels are 
> drawn. There's no way to do this with a scene graph multi-parented to 
> several Cameras. No way to configure the Camera parents in advance.
> 
> Any thoughts on how to do this in the RenderStage? I'm fairly certain 
> current code doesn't support this, so I'm thinking of modifying 
> RenderStage or making a custom RenderStage, but I haven't looked into 
> how to specify my own RenderStage at the Camera level yet.
> 
> Paul Martz
> Skew Matrix Software LLC
> _http://www.skew-matrix.com_ <http://www.skew-matrix.com/>
> +1 303 859 9466
> 
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=18528#18528





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to