Vizard Headlight in Shader
Dear Vizard Support,
I am trying to use your headlamp in some shader code for lighting an procedurally generated terrain. I am using on-the-fly objects to create the terrain. My shader is attempting to access the headlamp through gl_LightSource[0]. However, I am unsure as to what type of light the headlamp is. Is it a directional, positional or spot light? When I attempt to access the position information from gl_LightSource[0].position I get a value that does not appear to match my actual lamp direction. vec3 normal = normalize(gl_NormalMatrix * gl_Normal); vec3 lightPos = normalize(vec3(gl_LightSource[0].position)); dotted = max( dot(normal, lightPos), 0.0 ); I am really looking for a better understanding of the headlight in Vizard and how it would be properly integrated into a shader. |
The default headlight is a directional light. If you are accessing the light in a fragment shader, then the direction vector will be stored in gl_LightSource[0].position.xyz.
|
All times are GMT -7. The time now is 03:15 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC