Skip to main content
gamedev.net
🔒 Locked

Simple sum

Started by ProgramMax Oct 28, 2005 at 7:37 AM 0 replies 800+ views
Original Post
ProgramMax
ProgramMax
I have a simple problem to which I can't seem to find a simple solution. An object's interaction with light is broken up between its absorbtion, reflection, and refraction. These values must make up the 100% of light that it interacts with. So an object can't have 70% absorbtion and 60% reflection. That would be 130%. My problem is trying to find a simple way to store these values and check for accuracy. If I use absolute values then every time I change a value I must check the other two values to make sure the sum is still 100%. This seems like a poor soltuion. If I use reletive values then the math gets weird. The differences between 30% + 1 and 70% + 1 are not the same. Also adding to one attribute would mean subtracting from another (or both others). Thank you in advance for you comments.
Jaywalk
Jaywalk
One option is to ignore the problem. If someone really wants to create a material which can reflect more light than there actually is, he might have perfectly good reason for it :) .

Or you could normalise your results. Add all your values together. If they're perfect, you should end up with a total of 1.0 (100%), otherwise you won't. Either way, divide each value by your total.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.