Thanks Dan for all your help!
Now I have found out what is wrong. My objects are boxes created in 3D
Studio Max. I have imported them into Java as VRML-objects. The sides of
these boxes had too few polygons for the spotlight to enlighten them at a
short distance.
Apparently all corners of a polygon must be in the spreadangle of the
light, otherwise they will not be enlightened. After increasing the numbers
of length-, width- and height-segments in 3D Studio Max, the light shines
correctly.
/Sofia
At 12:19 2000-05-23 +0300, you wrote:
>The clipping has nothing to do with with the constructor, it's rather
taking part
>of the initial setup of your scene. If you get too close from your object,
your
>faces can get trimmed by the clipping plane and you might find yourself
"inside"
>your object, interior wich is not illuminated. Might be just one of the
causes....
>Hope it helps you.
>
>Dan Todor
>
>Sofia Sundstr�m wrote:
>
>> No, I have not tried to play with the clipping. I don't really know how to.
>>
>> This is the constructor that I am using, which parameter affects the
clipping?
>>
>> public SpotLight(Color3f color,
>> Point3f position,
>> Point3f attenuation,
>> Vector3f direction,
>> float spreadAngle,
>> float concentration)
>> Constructs and initializes a SpotLight node using the specified parameters.
>> Parameters:
>> color - the color of the light source
>> position - the position of the light in three-space
>> attenuation - (constant, linear, quadratic)
>> direction - the direction of the light
>> spreadAngle - the spread angle of the light
>> concentration - the concentration of the light
>>
>> /Sofia
>>
>> At 09:15 2000-05-23 +0300, you wrote:
>> >Have you tried to play wth the clipping distance ?
>> >
>> >Sofia Sundstr�m wrote:
>> >
>> >> I am trying to create a spotlight, that is supposed to cast light like a
>> >> torch. It is placed in the camera. My problem is that when I get
close to
>> >> an object, the spotlight goes out and the object turns black. I want the
>> >> object to get brighter as the camera (and spotlight) approaches it
(as it
>> >> would if there was a torch).
>> >>
>> >> If someone knows how to solve my problem, please reply ASAP!
>> >>
>> >> Thanks,
>> >> Sofia
>> >>
>> >> This is a part of the code that i am using (some of it from the demo
>> >> SphereMotion):
>> >>
>> >> Vector3d lPos1 = new Vector3d(0.0, 0.0, -0.5);
>> >> Vector3f lDirect1 = new Vector3f(lPos1);
>> >> Point3f lPoint = new Point3f(0.0f, 0.0f, 0.0f);
>> >> Point3f atten = new Point3f(0.5f, 0.0f, 0.0f);
>> >>
>> >> BoundingSphere lightbounds =
>> >> new BoundingSphere(new Point3d(0.0,0.0,0.0),
>> 100.0);
>> >>
>> >> Light lgt1 = new SpotLight(lColor1, lPoint, atten,
>> lDirect1,
>> >> 0.1f,1.0f);
>> >> lgt1.setInfluencingBounds(lightbounds);
>> >>
>> >> TransformGroup l1RotTrans = new TransformGroup();
>> >>
>> l1RotTrans.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
>> >>
>> >> Transform3D t = new Transform3D();
>> >> TransformGroup l1Trans = new TransformGroup(t);
>> >> l1Trans.addChild(lgt1);
>> >> l1RotTrans.addChild(l1Trans);
>> >> Transform3D t = new Transform3D();
>> >> TransformGroup l1Trans = new TransformGroup(t);
>> >> l1Trans.addChild(lgt1);
>> >> l1RotTrans.addChild(l1Trans);
>> >>
>> >> PlatformGeometry pg = new PlatformGeometry();
>> >> ViewingPlatform vptest = u.getViewingPlatform();
>> >> Sphere pg_s = new Sphere(0.01f, app);
>> >> Shape3D pg_ss = pg_s.getShape();
>> >> pg_ss.setCapability(Shape3D.ALLOW_APPEARANCE_READ);
>> >> pg_ss.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
>> >> pg_s.setCollidable(true);
>> >> Appearance pg_app = pg_ss.getAppearance();
>> >>
>> pg_app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_READ);
>> >>
>> pg_app.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE);
>> >> TransformGroup pgTG = new TransformGroup();
>> >> Transform3D pgTrans= new Transform3D();
>> >> pgTrans.setTranslation(new Vector3d(0.0,0.0,-1.0));
>> >> pgTG.setTransform(pgTrans);
>> >> pgTG.addChild(pg_s);
>> >> TransformGroup testtest = new TransformGroup();
>> >> pg.addChild(testtest);
>> >> testtest.addChild(l1RotTrans);
>> >> vptest.setPlatformGeometry(pg);
>> >>
>> >>
===========================================================================
>> >> To unsubscribe, send email to [EMAIL PROTECTED] and include in
the body
>> >> of the message "signoff JAVA3D-INTEREST". For general help, send
email to
>> >> [EMAIL PROTECTED] and include in the body of the message "help".
>> >
>> >
>> >
>
>
>
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".