PostProcessing Issue.

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

PostProcessing Issue.

Post 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.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: PostProcessing Issue.

Post by mongoose7 »

Blurscale seems to be too large.

Don't multiply the glow and diffuse, add them.
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: PostProcessing Issue.

Post 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.
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: PostProcessing Issue.

Post by The_Glitch »

I've made some Improvements I just need a better way of separating glowing area's and non glow area's.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: PostProcessing Issue.

Post 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.
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: PostProcessing Issue.

Post 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.
Post Reply