-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Directional Light has a top and bottom #61
Comments
As I know the Directional light is limited by screen size dependent values which are set or updated when calling the: rayHandler.setCombinedMatrix(...); And there are no other limitations for this light. Could you please share some code regarding the usage of box2dlights and the DirectionalLight? |
Yeah, I had a look through the DirectionalLight class before posting here and saw the way it should be getting the dimensions from the camera but that doesn't appear to be what's happening. The key box2dlights and DirectionalLight code sections are here: private void initiateLighting() {
if (Amygdala.lighting) {
rayHandler = new RayHandler(world);
rayHandler.setCombinedMatrix(camera);
rayHandler.setBlur(true);
rayHandler.setBlurNum(1);
rayHandler.setAmbientLight(DEFAULT_LIGHT_LEVEL);
sun = new DirectionalLight(rayHandler, Gdx.graphics.getWidth()/2, new Color(1f,1f,1f,SUN_INTENSITY), -90f);
sun.setActive(true);
sun.setStaticLight(false);
sun.setContactFilter(Entity.CATEGORY_LIGHT, (short) 0, Entity.MASK_LIGHT);
}
} And here in our screen's render method: if(rayHandler == null){
initiateLighting();
}
rayHandler.setCombinedMatrix(camera);
rayHandler.updateAndRender(); |
Oh... I've got it. The issue now is if we will move more correctly with camera position, the shadows from offscreen objects will blink if we move up-down. Need to think regarding something like fixed pseudo-position for DirectionalLight... BTW, is your world limited by Y axis? |
our player can theoretically move infinitely on the Y axis but the platforms are not so we could, for instance, after level generation, supply a max and min Y value to the rayhandler or directionallight outside of which there would not be anything to cast shadows or have shadows cast on it. One of the things I was trying to work out if I could do myself was pass a rectangle with the level bounds to the directionallight but I don't have a deep enough understanding of the raytracing for that. |
I have same issue. |
When using DirectionalLight in a game with panning camera and wide box2d world DirectionalLight is not vertically infinite. It ends at +50y and -50y
Other lights outside this range continue to act as normal.
The text was updated successfully, but these errors were encountered: