light direction

Jun 16, 2008 at 2:19pm

light direction

I was looking through the forum and example patches on the subject of lighting.
What I couldn’t find though was how to change the direction of the light? It always seems to point at the center of the scene, but what if I’d like to make a grid of lights and point them straight down?

#38433
Jun 16, 2008 at 5:29pm

silly me. it’s of course coming from the light position and shining
in every direction. So then the question would be, can I make a
spotlight?

On 16 Jun 2008, at 16:19, Brecht wrote:

>
> I was looking through the forum and example patches on the subject
> of lighting.
> What I couldn’t find though was how to change the direction of the
> light? It always seems to point at the center of the scene, but
> what if I’d like to make a grid of lights and point them straight
> down?

#134089
Jun 16, 2008 at 5:59pm

Id suggest using a shader for that. You can get the light position from within the shader, or override it and supply a vec 3 yourself.

If you want a spotlight, you should be able to run :

http://www.lighthouse3d.com/opengl/glsl/index.php?spotlight

:)

#134090
Jun 16, 2008 at 6:10pm

You’ve found light_position settings in jit.gl.render then, which sets the
light position all objects in your scene. If the last value of the setting
(w) is non zero then the light source is poitional and shines in all
directions with its location set by the x,y and z coordinates. If the w
value is zero, them the light is directional with xyz informing the
direction.
If you want to have more than one light source you need to use the
glcommands of jit.gl.sketch which gives access to the gllight settings. you
can have multiple lights and the commands that specify material colouring,
light position light model etc can be different for each light, with the
light numbers incrementing through gllight0, gllight1 etc. light positions
are affected by transforms you make to the modelview matrix.

You have much more control over lighting using sketch, and yes you can also
have spotlights.

A simple example patch is below, but you should check the red book for more
about lights.

pelado

– Pasted Max Patch, click to expand. –

On Mon, Jun 16, 2008 at 4:19 PM, Brecht wrote:

>
> I was looking through the forum and example patches on the subject of
> lighting.
> What I couldn’t find though was how to change the direction of the light?
> It always seems to point at the center of the scene, but what if I’d like to
> make a grid of lights and point them straight down?
>

http://www.pelado.co.uk

#134091
Jun 16, 2008 at 6:18pm

commands that specify material colouring, light position light model etc can
be different for each light, with the light numbers incrementing through
gllight0, gllight1 etc.

Actually, a quick correction to the above. There’s only one light model,
you don’t set different ones for each light.

pelado

#134092
Jun 24, 2008 at 10:53pm

Hi Pelado,

Would it be possible to get this patcher for the 4.6/1.6.3 version ?
Thank you.

Kyred.

#134093

You must be logged in to reply to this topic.