Jump to content
  • Advertisement
Sign in to follow this  
pikebu

GDI+ simulating light, color values

This topic is 4997 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
To change the intensity of a color, multiply all three components by the same value. That will prevent the problem you are describing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!