(Resolved) Lighting inside sphere or dome doesn’t work?

I have two domes back to back, forming a sphere. I want to have a light (and camera) inside this sphere, but lighting doesn’t seem to be working on the back of the polygons. I changed the face-culling so that the backs of polygons are shown.

If I move the camera and the light outside, whether I have an actual sphere or a pair of domes, it doesn’t matter, from the outside the lighting works fine and appears just as expected. If I move the camera inside, I can see the domes/sphere as long as I use Unshaded material so that it is just a solid color, but as soon as I use Lighting and have the camera and light inside, the only part of the domes/sphere that is visible is just the specular color. The diffuse color does not display.

Is there some kind of lighting equivalent to the face culling?

Code is straightforward. ex: new geometry, new material (Lighting), shininess 32, UseMaterialColors true, ambient black, diffuse blue, specular green. PointLight with white color. I changed the face culling with Material.getAdditionalRenderState().setFaceCullMode(), which I set to FaceCullMode.Front when testing inside the sphere, as that will be the final result, and FaceCullMode.Off when looking from outside. With that, I do not see any blue on the inside surface; where the blue should be is only black. And I do see a green shiny spot on one portion of the inside surface and a green streak on the inside surface that is closest to the light.

Again, this is only for the inside (back) surface. If I move the light and camera outside the object, the outside (front) surface looks as you would expect it to under these conditions.

Any ideas? I was surprised when I could not find anything about this, and nothing even remotely close if I ignore jME2.

Well a surface is only lit from one side, one light source cannot be on both sides really :wink: Try using an ambient light or two directional ones.

I only need 1 side to be lit. I was only moving the camera and the light source outside the sphere just to test and make sure that everything was otherwise working fine, which it does from outside; that was just diagnostics to rule out me screwing up the lighting.



I want only the inside to be lit. Well, I only care about the inside really; what happens to the outside does not matter. As I mentioned above, in the end I will have FaceCullMode.Front, so you won’t even be able to see the front face of the sphere’s polygons anyway. The only thing that matters is just the inside of the sphere. The camera and the light source are both inside, supposed to be lighting the inside face, and that’s the only side which I care about.

Why dont you simply flip the normals generally when this model is more like a room anyway?

there is a dome constructor that takes a boolean paramater called outsideView, set it to false to see the faces from the inside.



taken from javadoc:



Dome



public Dome(Vector3f center, int planes, int radialSamples, float radius, boolean outsideView)



Constructs a dome. All geometry data buffers are updated automatically. Both planes and radialSamples increase the quality of the generated dome.



Parameters:

center - Center of the dome.

planes - The number of planes along the Z-axis.

radialSamples - The number of samples along the radial.

radius - The radius of the dome.

outsideView - If true, the triangles will be connected for a view outside of the dome.

@Decoy: Thanks, that worked great. I generally don’t even think to look at the method/constructor text descriptions in the Javadoc for jME anymore since 96% of the time there aren’t any, as almost everything just gives the method signature and nothing more. Anyway, thanks very much.



@Normen: That sounds like it would have been the right thing to do. I guess I had a derp moment. I would imagine that’s probably even what the outsideView parameter does that Decoy mentioned, either that or flip the polygons around so that the inside is the front facing side.