Page 1 of 1

color changes not smooth

Posted: Fri Apr 28, 2006 4:01 pm
by hettar
Hello,

I hope this is not too stupid, but here it goes:

I often get things like this, like the color depth is very low:

Image

Is there a basic setting I missed, or are these things more complicated than that?

Posted: Fri Apr 28, 2006 7:10 pm
by Baal Cadar
hettar, please provide more informations. This image only tells us, that banding occurs for you, but not, when, where in what situations.

So what do we see on the picture? What is the relevant code snippet you used to create this, mainly material settings/shader code (if any) and a textual description of what you want to achieve.

Posted: Sat Apr 29, 2006 9:20 am
by bearSoft
i have seen this if the graphic card setting for openGl quality is 'low' (would -properly- be something similar for dx?)
-eg are u sure this is an IRR problem?
Try to look at the default setting for ur graphic card

Posted: Sun Apr 30, 2006 12:20 pm
by hettar
Thanks for the replies! It's at least nice to know it's called banding, that should make searching for an answer a lot easier.

I guess it's not really an IRR problem (I remember seeing the same behavior in an irrlicht example, but can't find it anymore), but I hoped someone would react with 'Oh yeah, you forgot to set the MAT_SMOOTH parameter' or something :P

The picture is a part of a terrainmesh, rendered with DX9 and a hlsl shader; when I leave out the atmosphere stuff, the shader is something like this:

Code: Select all

float4x4 matViewProjection;
float3 vSunPosition;

struct VS_INPUT 
{
   // (I currently use a vertex type with no tex coords or color)
   float4 Position: POSITION0;
   float3 Normal: NORMAL0;
};

struct VS_OUTPUT 
{
   float4 Position: POSITION0;
   float3 Normal: NORMAL0;
};

VS_OUTPUT vs_main(VS_INPUT Vert)
{
   VS_OUTPUT Out;

   Out.Normal = Vert.Normal;
   Out.Position = mul(Vert.Position, matViewProjection);
   
   return Out;
}


struct PS_INPUT 
{
   float3 Normal: NORMAL0;
};

float4 ps_main(PS_INPUT Pix): COLOR0
{   
   float4 color = {0.4, 0.7, 0.2, 1};
   float terrain_lit = dot(normalize(vSunPosition), normalize(Pix.Normal));
   color = color * (0.4 + 0.7 * terrain_lit);
   
   return color;
}
Any ideas?

Posted: Fri May 05, 2006 1:32 pm
by hettar
I'm still a bit in the dark about this..

if I simply set the normals as colors

Code: Select all

float4 ps_main(PS_INPUT Pix): COLOR0
{   
   float4 color = {1, 1, 1, 1};
   color = color * normalize(Pix.Normal);
   return color;
}
I get this:

Image

Where could all the green/pink bands come from?

Posted: Tue May 09, 2006 10:45 am
by hettar
I guess noone finds this interesting :)

I mostly got rid of the effect by disabling the stencil buffer, though the banding is still visible when I look very closely. But I guess that's normal, because I also see it when I simply add a TestSceneNode with directional lighting to the HelloWorld example (not so clear as in the above screen shots of course). Ah well.