GDI+ simulating light, color values
hi,
i'm working on a vrml viewer with gdi+.
now i have the problem with calculating the
different lightvalues for my object.
when i paint all the polygons with all the same
color you can't see anything of 3d. it all looks like
a 2d shape filled with one color. hope u know what i mean.
now i'm calculating the normals, get the x value and the
arcus cosine of it. then i multiply it with a fixed value
to get a result beween 0 and 255.
my code looks like this:
int blue_value = (int)(Math.Acos(face.normal.x) * 81.16;
then i'm just taking the original red and green values and
the calculated blue value for my brush color.
this works fine with only a few clear colors like blue with rgb(0,0,bluevalue),
but it starts to look totally bad with more different colors, especially
with not clear red, green or blue values.
then the calculated color turns from e.g. blue to green etc.
hope u know what i mean.
has anyone a good idea to calculate the different values for a color,
without gettin these results?
To change the intensity of a color, multiply all three components by the same value. That will prevent the problem you are describing.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement