Page 1 of 1

PostProcessing Issue.

Posted: Wed Jul 09, 2014 2:16 pm
by The_Glitch
Well I've been messing with post processing namely a glow shader. I've been reading this document from NVidia http://http.developer.nvidia.com/GPUGem ... _ch21.html.
I'm alittle confused on how to separate the glow areas. And I seem to get strange artifacts. What I've been doing is in the first pass for the render to texture on my character I've taking the diffuse and multiply it with a texture leaving on the glow areas. Step 2 This texture is then pass to a glow shader and then to a screenquad. Only problem is If I take the diffuse and multiply with the glow texture on what glows will be rendered the rest of the diffuse texture will be black.


Image
Up close

Image
Camera moves further away.

Image
Not sure how to make it stick with the object.

Code: Select all

 
float viewWidth;
float viewHeight;
 
struct VS_INPUT 
{
   float4 Position : POSITION0;
   float2 Texcoord : TEXCOORD0;
   
   
};
 
struct VS_OUTPUT 
{
   float4 Position : POSITION0;
   float2 Texcoord : TEXCOORD0;
   
};
 
VS_OUTPUT vs_main( VS_INPUT Input )
{
   VS_OUTPUT Output;
   
   Output.Position         = float4(Input.Position.xy, 0,1) ;
   Output.Texcoord.x = 0.5 * (1 + Input.Position.x - viewWidth);
   Output.Texcoord.y = 0.5 * (1 - Input.Position.y - viewHeight);
  
 
   
   return( Output );
   
}
 
 
 
 
 
sampler Texture0;
 
float BlurScale;
float4 color;
float glow;
 
const float2 offsets[12] = {
   -0.326212, -0.405805,
   -0.840144, -0.073580,
   -0.695914,  0.457137,
   -0.203345,  0.620716,  
    0.962340, -0.194983,
    0.473434, -0.480026,
    0.519456,  0.767022,
    0.185461, -0.893124,
    0.507431,  0.064425,
    0.896420,  0.412458,
   -0.321940, -0.932615,
   -0.791559, -0.597705,
};
 
 
float4 ps_main(float2 Texcoord : TEXCOORD0) : COLOR0
{   
 
 float4 sum = tex2D(Texture0, Texcoord);
 
 
 for (int i = 0; i < 12; i++){
      sum += tex2D(Texture0, Texcoord + BlurScale * offsets[i]) /8;
   }
   
 
    return (sum * glow  ) + color * sum;
   
}
 
 
 
 
 
 
Simple Glow shader If this helps.

Re: PostProcessing Issue.

Posted: Thu Jul 10, 2014 2:31 am
by mongoose7
Blurscale seems to be too large.

Don't multiply the glow and diffuse, add them.

Re: PostProcessing Issue.

Posted: Thu Jul 10, 2014 2:12 pm
by The_Glitch
I think we must have confused each other on the diffuse part. The scene and the render texture are being added together. What I meant was In the first render of the scene the parts that get past to the render to texture for a character I was trying to make only certain parts of his diffuse texture to glow not all of him. So what I was doing was taking the diffuse and multiplying it with a texture which only then rendered those specific bits in the diffuse texture that would glow. But the only problem is the parts that were masked by the texture were all black. Take a look at these for example.


Image


Image


I would multiply the diffuse with the mask to represent certain glow areas.


I've took another look at the blur scale and made some tweaks. But I believe there might also be something wrong with the screenquad.

Re: PostProcessing Issue.

Posted: Thu Jul 10, 2014 10:00 pm
by The_Glitch
I've made some Improvements I just need a better way of separating glowing area's and non glow area's.

Re: PostProcessing Issue.

Posted: Fri Feb 06, 2015 12:22 am
by Asimov
HI The_Glitch,

I just love your normalmaps on your walls. Did you actually bake your maps, or just lay 2D maps on your walls?
Love the look of your lightmap shader also.

I hope I get that good at shaders one day.

PS. I get the feeling you like Halo :D
I played it to death on the xbox, but can't play the new one cos it won't work on me black xbox.

Re: PostProcessing Issue.

Posted: Fri Feb 06, 2015 1:49 pm
by The_Glitch
Yeah this is pretty old. Matter of fact I don't even think at the time I finished my radiosity normal mapping shader so the environment in the pictures was using some cheap workaround at the time.
Also I was trying to figure out how Irrlicht handles post processing as I had new how it worked in other apps and had the shaders made already. To be honest If I go back and revist this map with my new shader system It would look tons better LOL.

You will get to be as good and better If your persistent enough like I was. A lot of it you have to teach yourself though.

Halo ce on pc was the first Engine I ever worked with since 2007 so I know the ends and outs like the back of my hands hints hints the avatar lol.