Sign in to follow this  

How to implement a heat haze effect with HLSL

This topic is 2079 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

if you look throw the air on top of fire, the scene behind will be blurred and distorted. I have implemented thd effect by this way: 1.render the scene to a render target 2.offset the pixels with time_0 and a noise image but this is a whole screen effect,is there a effect can be used as material? on the side, I think using render target is slow, isn't it?

Share this post


Link to post
Share on other sites
I don't really see how you could implement it so you wouldn't have to use a post-processing pass, since you need to know what's behind the area of distortion.

If you don't want to use a full-screen pass, you could instead keep the effect restricted an area of the screen covered by some geometry that you render. This can be done in two ways:

-Render the volume, and in the pixel shader calculate the texture coordinate used to access the full-screen texture based on the current clip-space position:


float2 texPos = 0.5f * IN.position2D.xy / IN.position2D.w + float2(0.5f, 0.5f);
float2 offset = 0.5f / screenDimensions;
texPos -= offset;
texPos.y = 1.0f - texPos.y;


-Render the volume with stenciling enabled, then render a full-screen pass using the stencil buffer as a mask

Then what you can do, to keep the effect from having the harsh polygonal edges of your bounding volume, is to use some sort of attenuation function based on the primitive shape you're attempting to render. So for example if you're rendering a sphere or cone, you could use the same attenuation equations used for a spotlight and pointlight.

Share this post


Link to post
Share on other sites
I think you could do that:
1. render the scene to a render target
2. render the "distortion scene" to another texture (render the heat volumes)
3. post process using the 2nd buffer to see where to distort

You could optimize that by using the alpha channel or the stencil buffer to store distorted areas.

Share this post


Link to post
Share on other sites

This topic is 2079 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