From 9c5c34e82d6264250657dcbf166fbcd929027d27 Mon Sep 17 00:00:00 2001 From: Thorsten Renk Date: Wed, 13 Aug 2014 10:52:59 +0300 Subject: [PATCH] Directional dependence of intensity for lights, work in progress --- Shaders/surface-light-lightfield.vert | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Shaders/surface-light-lightfield.vert b/Shaders/surface-light-lightfield.vert index 6d90cb8f0..6940b7280 100644 --- a/Shaders/surface-light-lightfield.vert +++ b/Shaders/surface-light-lightfield.vert @@ -20,7 +20,12 @@ void main() relPos = gl_Vertex.xyz - ep.xyz; rawPos = gl_Vertex.xy; float dist = length(relPos); - float lightScale = size * size * size * size * size/ 500.0; - pixelSize = min(size * size/25.0,lightScale/dist); + float angular_fade = 0.0; + if (length(gl_Normal)> 0.0) + { + angular_fade = 2.0 * max(0.0,-dot(normalize(gl_Normal), normalize(relPos))); + } + float lightScale = size * size * size * size * size/ 500.0 *angular_fade; + pixelSize = min(size * size/25.0,lightScale/dist) ; gl_PointSize = 2.0 * pixelSize; }