HLSL effect sequence

Started by
3 comments, last by Tipotas688 14 years, 1 month ago
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?
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).
Yeah but for stuff that manipulate color, lets say grayscale it doesnt work...
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;
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.

This topic is closed to new replies.

Advertisement