PointLight: Use a 1/(1 + d + k d^2) attenuation
This is not physically accurate, but a 1/d^2 attenuation makes light extend too broad, and went too high if close from the source.
This commit is contained in:
parent
f6d52511ea
commit
c695875654
@ -32,8 +32,8 @@ void main()
|
||||
vec3 light_pos = pseudocenter.xyz;
|
||||
vec3 light_col = col.xyz;
|
||||
float d = distance(light_pos, xpos.xyz);
|
||||
float att = energy * 200. / (4. * 3.14 * d * d);
|
||||
float spec_att = (energy + 10.) * 200. / (4. * 3.14 * d * d);
|
||||
float att = energy * 200. / (1 + d + 4. * 3.14 * d * d);
|
||||
float spec_att = energy * 200. / (1 + d + 4. * 3.14 * d * d);
|
||||
|
||||
// Light Direction
|
||||
vec3 L = -normalize(xpos.xyz - light_pos);
|
||||
|
@ -572,6 +572,7 @@ void drawObjectUnlit(const GLMesh &mesh, const core::matrix4 &ModelViewProjectio
|
||||
|
||||
void drawDetailledObjectPass2(const GLMesh &mesh, const core::matrix4 &ModelViewProjectionMatrix)
|
||||
{
|
||||
return;
|
||||
irr_driver->IncreaseObjectCount();
|
||||
GLenum ptype = mesh.PrimitiveType;
|
||||
GLenum itype = mesh.IndexType;
|
||||
|
Loading…
x
Reference in New Issue
Block a user