Sign in to follow this  

Blurring a specific object in the scene

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

Hi everyone,

 

I have the following scene which contains a single emissive light object:

 

[attachment=24763:lightroom.png]

 

I think it would be cool to add a Gaussian blur to the light (and only the light) so that it appears to glow. I'm thinking that it would be good to render the light to an A8R8G8B8 texture (which has been cleared to (0, 0, 0, 0)), and then do two blur passes using my current Gaussian blur shader. Then I could use a sprite to render the final texture to the screen after I render all the objects (minus the light). This would ensure that the light appears as a blurred overlay while the rest of the scene is still visible due to the transparency of the overlay texture.

 

I tried this, and the light is invisible. I'm thinking I may have missed something simple. Is it possible to create a transparent render target to use like this? Do I need to do anything special when I draw my sprite? Perhaps you have tried doing something similar and know what I'm doing wrong :)

 

Thanks, I can provide more info if needed :)

Share this post


Link to post
Share on other sites

There's no reason your plan couldn't work, but there's any number of mistakes that could have occurred along the way to make it not work. Maybe check your blend modes when you're rendering the light?

 

Would it not be simpler to make the glow texture offline in photoshop/gimp, and slap that on a sprite instead though?

Share this post


Link to post
Share on other sites
Thanks for the reply. At the moment I'm not setting any blend modes during the rendering so that may well be my problem! Also I did think about using a sprite buy I guess that means I'd have to scale it manually based on the distance of the light to the camera?

Share this post


Link to post
Share on other sites

You could, but instead search for the term billboard and billboard transformation, which you use for your sprite. The perspective transform of your camera will take care of the size then - and also distort the sprite it correctly.

Share this post


Link to post
Share on other sites

There are also various ways to do a post-process effect to make parts of the scene blurry. The most common one is an HDR bloom effect where you extract bright bits of the scene and blur them before blending them back onto the scene again.

 

There's also other ways to decide which bits of the scene get blurred. For example using the alpha channel on the render target. http://http.developer.nvidia.com/GPUGems/gpugems_ch21.html

Share this post


Link to post
Share on other sites

You can have another same size texture as your backbuffer. Only draw light to it , blur it and render it on top of your final image additively.

Check the temporary texture before and after blur to see if it is working as expected .

Share this post


Link to post
Share on other sites

Thanks for the ideas :) It turns out that the issue was my clipping plane - it was set to the wrong position for the light rendering stage! I got the effect working but it doesn't look quite as I expected so I may well turn to one of the other options described - the billboard sounds quite tempting! Thanks again!

Share this post


Link to post
Share on other sites

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