WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1  
Old 06-26-2012, 10:52 AM
shivanangel shivanangel is offline
Member
 
Join Date: Feb 2006
Location: New Jersey
Posts: 182
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.
Reply With Quote
  #2  
Old 06-27-2012, 01:19 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Realistic Light and Shadows Using Vizard and 3DS Max jde Vizard 4 07-13-2012 10:58 AM
Vizard 4 Beta Testing farshizzo Announcements 0 02-01-2011 10:46 AM
Vizard 4 Beta Testing farshizzo Vizard 0 02-01-2011 10:46 AM
Multiple Textures for Diffuse and Specularity Shader Issue shivanangel Vizard 1 05-11-2009 10:44 AM
Vizard tech tip: Using the Python Imaging Library (PIL) Jeff Vizard 0 03-23-2009 11:13 AM


All times are GMT -7. The time now is 06:47 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC