Sign in to follow this  
FireInDark

About MRT

Recommended Posts

Think about that ,in case MRT,we have two render target (All are textures ): texture A and texture B.
Now the first element has been rendered ,texture A save the image and texture B save other datas..

then wen need to render another element ,but here , I need the datas in texture B to juge if the right pixel should be wirte or not..and the same time ,I also need to write texture B in some case when rendering the second element;

Any way ?

if i just bind the texture B as the GL_TEXTURE1 or GL_TEXTURE2 or somthing..

Share this post


Link to post
Share on other sites
You render your scene in passes.
1. pass: render to A & B
2. pass: render to A only, but use B as source
3. pass ...

Then you need to assign your render materials to one or more render passes.

Share this post


Link to post
Share on other sites
[quote name='Ashaman73' timestamp='1344230381' post='4966559']
Then you need to assign your render materials to one or more render passes.
[/quote]

Seems it the right way .But wouldn't it be slowly ?

If the elments are in a "Tree" it'll take many times to change the target ..

Share this post


Link to post
Share on other sites
[quote name='FireInDark' timestamp='1344232641' post='4966568']
If the elments are in a "Tree" it'll take many times to change the target ..
[/quote]
Here's a practical approach:
1. define your passes and for each pass your targets.
2. When rendering (walking through your scenegraph, tree whatever), you cull and group all renderable objects by material, don't render them yet.
3. Walk through your (ordered) passes and render all model groups which have a material which is assigned to the current pass.
4. Special handling for terrain,particles,decals etc. which are assigned to certain passes.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this