# Lighting on Terrain

Hey guys n gals.

I’m having a lot of fun writing a game, but there’s two things that I can’t figure out - and not for lack of fiddling.

Firstly, the easy one - probably a yes or no. I’m using point lights as brake lights in my vehicle, but the glow seems to go through the body of the car (including underneath). Is there any way to stop it? I’ve tried moving it around and what not, but it doesn’t seem to have any effect. I read that PointLight does not cast shadows - which is fine enough - but does that include the light emitted not being stopped by other meshes?

Secondly, I am using SpotLights for the headlights, but depending on the rotation of the vehicle, it appears to emit the light differently. I assumed it would be the “rotation” but i’ve attached it to the vehicle node using a LightControl - which as far as I am aware solves that problem.

good rotation: http://i.imgur.com/lvoyoUD.jpg

[java]
float lightDip = FastMath.PI / 2; //1.27f;
float lightRotation = 4.6f;
float lightIntensity = 1.75f;
float foreDistance = 1.2f;

Vector3f position = new Vector3f(1.0f, 1.1f, 3.3f);

SpotLight hlrSpotLight = new SpotLight();
hlrSpotLight.setSpotRange(100f); // distance
hlrSpotLight.setColor(ColorRGBA.White.mult(lightIntensity));

LightControl hlrLightControl = new LightControl(hlrSpotLight);

Node hlrNode = new Node(“HeadLamp Right Node”);
hlrNode.setLocalTranslation(-1.0f, 1.1f, 3.3f);
hlrNode.rotate(0f, lightRotation, lightDip);

vehicleNode.attachChild(hlrNode);
[/java]

@jayfella said: Hey guys n gals.

I’m having a lot of fun writing a game, but there’s two things that I can’t figure out - and not for lack of fiddling.

Firstly, the easy one - probably a yes or no. I’m using point lights as brake lights in my vehicle, but the glow seems to go through the body of the car (including underneath). Is there any way to stop it? I’ve tried moving it around and what not, but it doesn’t seem to have any effect. I read that PointLight does not cast shadows - which is fine enough - but does that include the light emitted not being stopped by other meshes?

Well, if light gets stopped by other obects it would cast shadows, wouldn’t it?

As for number two: when seeing your code i was actually surprised that it even lit’s the terrain, i always assume that light would not lit parent elements in the scenegraph.
How you you generate the terrain? Could be an issue with normals/tangents. Just a shot in the dark

1 Like
@jayfella said: Firstly, the easy one - probably a yes or no. I'm using point lights as brake lights in my vehicle, but the glow seems to go through the body of the car (including underneath). Is there any way to stop it?

Bodies blocking light, that is sort of the definition of shadows, so I kind of suspect that the answer is no