Okay, so now I’m starting to get comfortable with Xith3D, and I want to explore some of the more advanced functionality. Therefore, I decided to start playing around with lighting and shadows, and it turns out things don’t work as I suspected them to.
First of all, the point lights are broken. With that, I mean that they seem to use the local coordinates of the light to calculate the lighting… This has already been mentioned in another thread, http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=xith3d;action=display;num=1082736276;start=2#2 , but I thought I could overcome it by manually transforming the light’s position doing something like:
Point3f location = new Point3f(0.0f,0.0f,0.0f);
myWorldTransform.get(location);
plight.setLocation(location);
However, it seems the local coordinates of the geometry is used as well. That means if you, like me, like to have your objects centered around 0,0,0 and then move them with transformgroups, you will get strange results when using a point light. This may of course be wrong, but at least it seemed to me like it was working this way.
Any plans of fixing this?
Second, I can’t seem to figure out how to get the shadows working properly. I have made sure all my geometry is sealed (at least as far as I can tell), and then I choose a node and call setIsOccluder(true). This does create some sort of shadows effect, but not anything like I had in mind. Am I missing a step here?
Third, the directional light seems a bit strange as well. I have several cylinder shapes that I have rotated, translated and non-uniformly scaled. Their material has no specular or ambient component, only a diffuse one (red). When applying a directional light to the scene, the cylinders that are tallest have a darker color on the face closest to the observer. If my understanding of lighting is correct, the diffuse color should only depend on the incoming angle of the light, and since this is a directional light, that angle should be the same regardless of the size of the cylinders. See the attached screenshot:
http://diplomen.dyndns.org/light.png
Could there be a bug in the directional light code as well?
Any help to clear these things up would be highly appreciated.
Best regards,
Terje