English 中文(简体)
Java 3d: Unable to get Shape3D to be affected by lights
原标题:

I am attempting to get a custom Shape3D to be affected by a DirectedLight in java 3D, but nothing I do seems to work.

The Shape has a geometry that is an IndexedQuadArray, with the NORMAL flag set and applied, ensuring the normal vectors are applied to the correct vertices - using indexed vectors

I have given the Appearance a Material (both with specified colors and shininess, and without)
I have also put the light on the same BranchGroup as the Shape, but it still does not work.

In fact, when I add in the normals to the shape, the object appears to disappear - without them, it s flat shaded, so that all faces are the same shade.

I can only think that I am forgetting to include something ridiculously simple, or have done something wrong.

To test the lights were actually, I put in a Sphere beside the Shape, and the sphere was affected and lit correctly, but the shape still wasn t. Both were on the same BranchGroup

[Small oddity too - if I translate the sphere, it vanishes if I move it greater than 31 in any direction... [my view is set about 700 back as I m dealing with objects of sizes up to 600 in width]


Edit: found this in the official tutorials that is probably related

A visual object properly specified for shading (i.e., one with a Material object) in a live scene graph but outside the influencing bounds of all light source objects renders black.

最佳回答

The light s setInfluencingBounds() was not set correctly, so that the shapes in the scene were not being included in the bounds.

This was corrected by setting a BoundingBox to encompass the entire area, and assigning that into the influencing bounds

问题回答

暂无回答




相关问题
openGL rotating with Lighting problem

I want to draw car in my world. but i have problem with lighting when my car rotate ,it seems light position change when car is rotating; but when i draw simple cube with glut function it work ...

Lighting with Direct3D9, everything is black

I am creating a simple application to get familiar with SlimDX library. I found some code written in MDX and I m trying to convert it to run on SlimDX. I am having some problems with the light because ...

Java 3d: Unable to get Shape3D to be affected by lights

I am attempting to get a custom Shape3D to be affected by a DirectedLight in java 3D, but nothing I do seems to work. The Shape has a geometry that is an IndexedQuadArray, with the NORMAL flag set ...

Are there any algorithms for removing lighting from a video?

Are there any algorithms for removing lighting from video? I have a video in which some objects are too strongly lit. How might I remove lighting from that objects without corrupting the entire video?

Working with Lights

Trying to get a grasp on lights and working through the OpenGL Superbible book. Below is what I am currently using for my lighting. It s placed in the SetupRC function. The lighting is mostly working ...

How can I make a ball of light in openGL?

I m trying to make a orb of light (Like a sun) but I can t seem to make it visible at all. I ll give you some snipets of code I have. It s in Java LWJGL, so it might look a little different. private ...

开放式轻型问题

我装上了物体,在我提取物体时,我把颜色划入绿线。

热门标签