Jump to content
  • Advertisement
Sign in to follow this  
Tipotas688

HLSL effect sequence

This topic is 3160 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 am new in HLSL and I m trying to sort things out. I m texturizing a triangle strip in my PixelShader to create a picture using:
float4 PixelShader(VertexOut input) : COLOR0
float4 color;
color = tex2D( ColoredTextureSampler, input.textureCoordinates.xy)*2;
return color;
The *2 makes the picture brighter. My problem is that after that I want to blur the image using a 3x3 kernel so I created another method doing:
float4 Blur(VertexOut input) : COLOR0
float4 k11 = tex2D( ColoredTextureSampler, input.textureCoordinates.xy + float2(-1,-1));
etc...
return addedStuff/9; :P
but I don't get the picture any brighter only blurred, I suppose that the input uses the normal texture that is not brightened... So how do I get it both brightened and blurred?

Share this post


Link to post
Share on other sites
Advertisement
It should be as simple as changing

return addedStuff/9;

to

return (addedStuff/9) * 2;

where 2 is the factor of brightness you want to multiply by (in this case double).

Share this post


Link to post
Share on other sites
addedStuff is a float4 representing a color, isn't it? You can do whatever you want with it, including turning it grayscale.

addedStuff.rgb = (addedStuff.r + addedStuff.g + addedStuff.b) / 3.0f;

Share this post


Link to post
Share on other sites
yeah but lets say I add an effect afterwards that blurs the picture lets say using:

tex2D( ColoredTextureSampler, input.textureCoordinates.xy);

only the latter effect remains, meaning it will only be blurred not grayscale and order is important.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!