What is a epsilon? ( Lights )

Community Forums/Technical Discourse/What is a epsilon? ( Lights )

Yue(Posted May) [#1]
void xLightShadowEpsilons ( Light * light,
float epsilon1,
float epsilon2
)

Sets epsilon values of light source.

Every light sources has 2 epsilon values for shadows rendering. First value is a depth bias (it's needed to compensate inaccuracy of floating-point values), second value is to prevent shadowing of angularly triangles. Epsilons delete some noise from shadows, but can lead to incorrect rejection of a part of shadow. Default values are optimal, but you may need to adjust them for best results.

Parameters:
light Light source handle
epsilon1 First epsilon value (compensates inaccuracy of floating-point values)
epsilon2 Second epsilon value (prevents shadowing of angularly triangles), actually it is a cosine of maximum angle of shadowed triangle.


col(Posted May) [#2]
Epsilon is easily and best remembered as 'close enough'. It's used to test for 2 values to be equal but with an allowing bias - the bias is the Epsilon.
Due to the difficulty of comparing floating point numbers you use an epsilon value to accept that a value is close enough to another value for the 2 values to be considered equal even when they aren't exactly the same.

For eg, a floating point value may never actually reach 0.0, it may be 0.0000012. In this case if you consider anything from -0.0001 to 0.0001 to be a value 'close enough' to zero, then 0.0001 is the epsilon.

At the same time - comparing two values: 4.000112 and 4.000134 with an epsilon of 0.0001 will consider the two values to be equal.


RemiD(Posted May) [#3]
When i see the shadows in Hitman absolution and how fast it is on my low end computer, i say hurray to shaders...


Kryzon(Posted May) [#4]
From that vague description (cosine of maximum angle, in relation to what? -- but I know it wasn't you who wrote it, Yue), epsilon2 seems to be a bias to avoid terminator shading problems.
You probably increase the value of it to help avoid the problem seen on the object on the left:


(Picture taken from some other place unrelated to Xors3D.)