color changes not smooth

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
hettar
Posts: 4
Joined: Tue Apr 11, 2006 11:22 am

color changes not smooth

Post 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?
Baal Cadar
Posts: 377
Joined: Fri Oct 28, 2005 10:28 am
Contact:

Post 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.
bearSoft
Posts: 165
Joined: Fri Apr 01, 2005 9:55 pm
Location: Denmark

Post 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
Regards.
Tech: win98se| 320mb ram| abitbe6| 433mhzceleron| atiRadeon7000.64mb| soundblaster125| dx9.0b | devCPP | IRR 0.12.0 |
hettar
Posts: 4
Joined: Tue Apr 11, 2006 11:22 am

Post 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?
hettar
Posts: 4
Joined: Tue Apr 11, 2006 11:22 am

Post 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?
hettar
Posts: 4
Joined: Tue Apr 11, 2006 11:22 am

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