Hi Aitor
In your code lightPosition = (x=0, y=40, z=0, w=0.3), so you use a
directional light (w != 1.0).
so you need in your shader a directional light computation. (see Orange
book or here http://www.lighthouse3d.com/opengl/glsl/index.php?ogldir1 for
more explanation)
Or you want a point
ledocc wrote:
Or you want a point light and you can keep your shader but lightPosition.w
must be equal to 1.0.
HTH
David Callu
OK, has been a pretty big mistake, sorry. Setting w to 1 everything is ok!
Thanks
--
Read this topic online here:
ledocc wrote:
Is you normal of your model well defined and normalized ?
Whitout shaders model looks perfect, and you can see the changes moving the
light of the site.
ledocc wrote:
I suppose you used an osg::Light to define your light.
Have you put it in a osg::LightSource ?
Code:
int
the viewer by default is attaching a light. Setup your viewer with NO_LIGHT
(or something like that, look in the code), and then create and control your
own light
-Nick
On Mon, Oct 4, 2010 at 11:19 AM, Aitor Ardanza aitoralt...@terra.es wrote:
ledocc wrote:
bug fix:
- ViewDirection =
ledocc wrote:
bug fix:
- ViewDirection = normalize(eyePosition - fvObjectPosition.xyz);
+ ViewDirection = normalize( - fvObjectPosition.xyz);
I already had tried before, but does not solve the problem.
If you disable the shader, with the standard osg lighting, gives me no
problems, the
Hi Aitor,
Is you normal of your model well defined and normalized ?
I suppose you used an osg::Light to define your light.
Have you put it in a osg::LightSource ?
Could you provide an example to reproduce your issue
This will become hard to solved it without more information.
David Callu
Trajce (Nick) Nikolov wrote:
the viewer by default is attaching a light. Setup your viewer with NO_LIGHT
(or something like that, look in the code), and then create and control your
own light-Nick
Neither solves ...
Could I use the standard osg lighting if I use a vertex program to change
maybe better to put something in while we can compile and test and see if
can help - including the model
-Nick
On Mon, Oct 4, 2010 at 5:37 PM, Aitor Ardanza aitoralt...@terra.es wrote:
ledocc wrote:
Is you normal of your model well defined and normalized ?
Whitout shaders model looks
Thanks for the correction, but the result is the same ...
Aitor
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32254#32254
___
osg-users mailing list
osg-users@lists.openscenegraph.org
Hi Aitor
try this:
Your code do the job in eye coordinate so eyePosition = vec3(0,0,0)
and you don't need eyePosition uniform;
bug fix:
- ViewDirection = normalize(eyePosition - fvObjectPosition.xyz);
+ ViewDirection = normalize( - fvObjectPosition.xyz);
HTH
David Callu
2010/10/1 Aitor
Hi,
I'm doing tests with shader for the lighting and the following problem happens
to me ...
With the camera close enough, all goes well, but if they turn away, do not seem
to take into account the position of the light.
Two images: the first up close, and the other from a distance and back
Hi Aitor,
I'm definitely not a shader guy but how does your eyePosition variable ever get
set??
Cheers,
Greg
--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=32228#32228
___
osg-users mailing list
Hi,
I get it by :
Code:
osg::Vec3f eye;
osg::Vec3f center;
osg::Vec3f up;
getCamera()-getViewMatrixAsLookAt(eye, center, up);
if(!aniModel-getAvatar()-getOrCreateStateSet()-getUniform(eyePosition)-setElement(0,osg::Vec3(eye._v[0],eye._v[1],eye._v[2])))
if(!aniModel-getAvatar()-getOrCreateStateSet()-getUniform(eyePosition)-setElement(0,osg::Vec3(eye._v[0],eye._v[1],eye._v[2])))
why not :
if(!aniModel-getAvatar()-getOrCreateStateSet()-getUniform(eyePosition)-set(eye))
?
-Fred
___
14 matches
Mail list logo