Adjust magic number to prevent z-fighting.
This commit is contained in:
@@ -126,7 +126,7 @@ struct Shader : public IShader {
|
|||||||
int index_x = b3Max(0, b3Min(m_width-1, int(p[0])));
|
int index_x = b3Max(0, b3Min(m_width-1, int(p[0])));
|
||||||
int index_y = b3Max(0, b3Min(m_height-1, int(p[1])));
|
int index_y = b3Max(0, b3Min(m_height-1, int(p[1])));
|
||||||
int idx = index_x + index_y*m_width; // index in the shadowbuffer array
|
int idx = index_x + index_y*m_width; // index in the shadowbuffer array
|
||||||
float shadow = 0.8+0.2*(m_shadowBuffer->at(idx)<-depth+0.2); // magic coeff to avoid z-fighting
|
float shadow = 0.8+0.2*(m_shadowBuffer->at(idx)<-depth+0.05); // magic coeff to avoid z-fighting
|
||||||
|
|
||||||
Vec3f bn = (varying_nrm*bar).normalize();
|
Vec3f bn = (varying_nrm*bar).normalize();
|
||||||
Vec2f uv = varying_uv*bar;
|
Vec2f uv = varying_uv*bar;
|
||||||
|
|||||||
Reference in New Issue
Block a user