Sign in to follow this  

Question about shaders

This topic is 4663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, i'm trying to code a shader program written in hlsl, my problem is to understand how to get a result from a pass and use it with another pass, my solution is, set the render target to another texture surface execute the pass and use that surface with the next pass as the tex sampler, so that each pass need to use a new sampler created from the old one, is that right? sorry about my english!!! thanx in advance!!! [Edited by - giuseppeCT on March 8, 2005 12:34:27 PM]

Share this post


Link to post
Share on other sites
Many multiple pass effects are done this way. Because the output from the pixel shader is a raster there are only so many things you can do with it. Sometimes a number of passes are used to render different models or the same models in a different way and a final pass is used to merge the results of the preceeding passes.

Share this post


Link to post
Share on other sites
Your idea is fine depending on what you are trying to do. Usually using effects means combining them in many ways. Not all your intended effect is contained in a single call.

I.E. For a glow effect you have to:
a. Render the glowing objects in a black surface.
b. Blur the glow
c. Render over your scene.

So for (a) you create a effect with two passes that renders to a target texture. The first pass renders the scene just to fill the zbuffer, without the glowing objects. The second pass renders the glowing objects in color. That fills your texture.

For (b) you take the texture output from a and use a second FX. The effect blurs the texture into a second target texture.

for (c) you take tht blurred texture and draws a quad covering the screen using that texture.

As you see... 3 effects were used. Targets were different. Objects rendered were diferent. Mix effects in order to get your visuals.

Luck!
Guimo

Share this post


Link to post
Share on other sites

This topic is 4663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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