Sign in to follow this  

Overlaying images in deferred rendering

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

Hy there,
i'm working on a small techdemo and i implemented the deferred renderer by cansin. Everything is working well so far. So i decided to modify it. I added a skysphere which is rendering onto a separate RenderTarget.

The final compositing shader overlays every drawn element on to the SkyMap.

[CODE]
float4 Color = tex2D(Diffuse, input.UV); //gets DiffuseMap
float alpha = 1; //calculate alpha
if (Color.a < 1)
alpha = 0;
float4 Lighting = tex2D(LightMap, input.UV); //gets LightMap
float4 Sky = tex2D(SkyMap, input.UV); //gets SkyMap
//float4 output = float4(Color.xyz * Lighting.xyz + Lighting.w, 1);
float4 output = float4(Color.xyz * Lighting.xyz + Lighting.w, 1) * (1 - alpha) + tex2D(SkyMap, input.UV) * alpha;
output = float4(Color.xyz, 1) * (1-alpha) + tex2D(SkyMap, input.UV) * alpha;
return output;
[/CODE]

As you can see i dont allow smooth alphavalues. They just can be 0 or 1. This kind of masking produces some outlines around every drawn object. I dont want that. You can see this behaviour on the attached screenshot. I know from blender, that this could be a problem with premultiplied values. But i dont know how i can do that in HLSL. So please give me some advices. Thats disturbing me..
[img]https://lh5.googleusercontent.com/-woTFGhNPMEI/UBVqV6fd8II/AAAAAAAABAA/hlbWLbhugGs/s1477/3.png[/img]

Share this post


Link to post
Share on other sites

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