Browse Source

Update spatial_shader.rst

The reference page suggests a very unfortunate lighting function that modulades the color values in ALBEDO again. This does not seem representative of the shading model.

Also, it omitted LIGHT_COLOR; repalcing the ALBEDO term with LIGHT_COLOR gives a much more expected diffuse lighting example.
Thygrrr 1 năm trước cách đây
mục cha
commit
bd7eb30f29
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      tutorials/shaders/shader_reference/spatial_shader.rst

+ 1 - 1
tutorials/shaders/shader_reference/spatial_shader.rst

@@ -401,7 +401,7 @@ Below is an example of a custom light function using a Lambertian lighting model
 .. code-block:: glsl
 
     void light() {
-        DIFFUSE_LIGHT += clamp(dot(NORMAL, LIGHT), 0.0, 1.0) * ATTENUATION * ALBEDO;
+        DIFFUSE_LIGHT += clamp(dot(NORMAL, LIGHT), 0.0, 1.0) * ATTENUATION * LIGHT_COLOR;
     }
 
 If you want the lights to add together, add the light contribution to ``DIFFUSE_LIGHT`` using ``+=``, rather than overwriting it.