SpotLight

Hi there :stuck_out_tongue:

By far, I have not understood how the location’s Point3f and the direction’s vector3f works.
I want some spotlight lighting a tennis court.

I’ve tested the following: (basically is an spotlight located at one corner of the court pointing to the court’s center. The court center is located at (0,0,0). The corner is at (18,10,-39) )


lampSpot1 = new SpotLight(new Color3f(1f,1f,1f),new Point3f(18,10,-39),
                                     new Point3f(1,0,0),new Vector3f(0,0,0),
                                     90.0f * (float) Math.PI / 180.0f, 1.0f);

But the light doesn’t appear.
playing with the direction vector produces several effect,s sometimes the lights appear butn in some strange directions, etc.

So, I need some advice on how the spotlight works, maybe any tutorial or white paper i dunno :stuck_out_tongue:

Bwt, I searched many times here in the forum but I found nothing related to my stuff. Also, the Java3D tutorial doesn’t give me anything useful :o

Tnahks in advance

Did you read http://xith.org/tiki-view_faq.php?faqId=1#q16?

I found it very enlightling :slight_smile:

Johannes

It would be a good idea to make an article for the Xith getting started guide.

Thanks a lot :smiley:

Edit: Nope I can’t get this to work

hmm…
the direction vector shouldn’t have any negative components?

Is the SpotLight fully implemented on xith?

And what about this? :

Vector1.negate();
            Vector1.normalize();

I saw that on Xith3DSphereMotionLightingTest
‘Removing’ these lines causes to Directionalight the effect mentioned in the FAQ, and the SpotLight doesn’t appears anymore

I’m confused :stuck_out_tongue:

Hmm, the spotlight works fine for me.

Make sure you project the spotlight on surfaces that consist of enough triangles. Assuming that your court is a rectangle that is drawn by two triangles, you only see the spot light at the corners of the court because there are the vertices (and it does not appear in a round shape). OpenGL affects a surface light appearance by actually taking into account the appearance information of the vertices of the surface. So having a lot of vertices in the surface increases not only the shape (which is actually redundant in your case since the court is a plane), but also the ‘resolution’ of the light because OpenGL has more points in the surface to draw the light effect. Xith abstracts away the OpenGL layer, but it still depends on OpenGL to finally draw the stuff on the screen.

Are your normal vectors correct?

Lately, I 've had no time to focus on this, but I’ll be very grateful if you, Schabby, or anyone could check the code and tell me what I’m doing wrong.

http://dexor.webpal.info/jws/

there you can find the source and some necesary files to run the app.

thanks :slight_smile:

FAC: Spotlights WORK, I use one for a flashlight, rotate around etc.

Hawkwind lighting suggestions

#1
place several reflective spheres around your scene to determine where the light is visually, it may not be where you think

#2
Put your light in the very topmost branchgroup, the one you add to the local. Xith lighting in branchgroup position dependent not bounding/influencing sphere dependent

#3
Use a linear attenuation a vector, 1.0, 0, 0

the code looks resonable…could your normals be hosed such that the illumination is wrong. create a zip please of the code anb images I can look further