Adding colors in GLSL problem

Started by
2 comments, last by NekoCode 9 years, 1 month ago

Hello everyone. I faced one problem - mixing two colors giving me wrong results. Let me explain:

1) I have Deferred lighting code and it gives good results, I called it "defLight" in GLSL.

2) I have Post-processing things in same code, I got Depth of Field here.

3) When doing the following thing: vec4 finalColor = defLight + postProcess; gives me wrong result, I can't see lighting at all, just diffuse light.

Is there another way to add colors to one variable so they won't mix?

Here are screenshots,

With lighting and no PP

Image%202015-02-28%20at%2010.38.20%20PM.

With Post processing and Lighting:

Image%202015-02-28%20at%2010.40.41%20PM.

Also, postprocessing after adding looks ugly ( look at blur in second pic ).

Thanks in advance!

Advertisement

Need to know more about how youre doing this.

- whats the color depth of the textures for your framebuffers

- are you making sure you are have linear color inputs across your shaders

- are you tonemapping

- how are you gamma correcting

if at all possible keep your camera angles fixed across screenshots (or close enough) makes comparing easier.

Need to know more about how youre doing this.

- whats the color depth of the textures for your framebuffers

- are you making sure you are have linear color inputs across your shaders

- are you tonemapping

- how are you gamma correcting

if at all possible keep your camera angles fixed across screenshots (or close enough) makes comparing easier.

It's not that important, it looks the same everywhere.

But I think I found a problem, but I don't know how to fix it.

i.e. I have "postprocessColor" variable in glsl and it has any effect inside which samples 10-20 times ( texture += texture+something ).

So when I add "postprocessColor" to anything else it "overlaps" just because it has a lot of samples in it.

I need any other alternative to "add" which doesn't add, but blends with no color lost.

EDIT: I found a good formula, it works good, but there are still not full blur as it must to be.


float fInterpValue = 0.5;
vec4 finalcol =  ( 1.0 - fInterpValue )* dlight_color + fInterpValue * ppcol;

Eh, solved by recalculating normals in post process sampling. Stoooopid, but results are great!

This topic is closed to new replies.

Advertisement