Shader System Recursion

Started by
3 comments, last by davidino79 20 years ago
I have readed Material/shader implementation thread many and many times,but I have a question: How can perform recursion? Yann says that certain render pass is recursive,this means that it call the MainRender function that perform the shader pass another one time (for example for reflective/refractive objects). But when I change the camera and perform the render to texture ,I should call the culling function another one time.So where is it the culling function in main render?Yann say that the function MainRender is called AFTER the culling process,when the render pipeline if filled ..so it seems there is no culling function,but if I call MainRender changin the camera,I should make the culling process. The same problem is present for shadow mapping shader and so on. Is there anyone that can help me? Thanks Davide
Advertisement
The way to go about this is to somehow pass a function pointer into the shader which will fill a different pipeline for rendering again. So effectively the purpose of the shader that invokes the recursion is to create a new pipeline - query the scenegraph for objects to be rendered - performing any culling with the new camera position and then call the main render function. Of course you need to keep a depth counter for the number of times this occurs to avoid infinite recursion. So the culling process is part of the traversal of the scenegraph.

James
quote:
The way to go about this is to somehow pass a function pointer into the shader which will fill a different pipeline for rendering again. So effectively the purpose of the shader that invokes the recursion is to create a new pipeline - query the scenegraph for objects to be rendered - performing any culling with the new camera position and then call the main render function.

Is this a good thing?that is, is it a good thing to break the rendering process and perform the culling process another one time (ad use,for example,the query to graphics card to perform the culling?)

I''m not sure whether you''ll be able to use the hardware occlusion queries since the camera will be in a different place - you may find that you don''t need to even do occlusion culling - frustum culling may be enough esp. if you use a custom LOD scheme to reduce the complexity of the geometry. Perhaps a software occlusion culler would be faster? I don''t know, I only currently use frustum culling - not had time to implement an occlusion culler yet, nor have I complicated enough scenes to test it!

James
It was only an example,the base question was if it is correct (or a it is a good think,ot whatever you want to say)to stall the rendering process to perform the culling.

Davide

This topic is closed to new replies.

Advertisement