Sign in to follow this  

SOLVED Clear Color leaking into render target texture

Recommended Posts

So I'm trying to generate dynamic cloud layers using perlin noise. I can generate the cloud texture fine, but when I try to try to create a cloud layer, the clear color for the render target I'm using is leaking into my texture wherever the alpha channel is not 1. Here's the shader:
float2 TexCoordShift = float2(LayerIndex * Shift, 0);
float4 textureColor = tex2D(sTextureClouds, input.TexCoord);
float4 outputColor;
if (LayerIndex == 0) // first layer is unicolor
    outputColor = float4(CloudColor, textureColor.r); 
else // layer are derived from previous layer
   // Not important until problem is fixed

return outputColor;

I'm only concerned when LayerIndex = 0 for now. textureColor.r is the grayscale value from the generated cloud map, so it represents the cloud's alpha value. The problem is that if textureColor.r != 1, I get the render target's clear color in the output texture which I map on a cloud layer. Alpha blending is disabled, separate alpha channel blending is disabled. I tried storing textureColor.r in another channel of the output texture and that fixed the problem, but it caused problems later so I have to store it in outputColor.a. Any ideas on how to get store a non-1 alpha value without the clear color replacing it? [Edited by - diginerd on March 3, 2010 5:58:01 PM]

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