libgdx / libgdx/box2dlights

Rendering 3D Objects while using box2Dlights causes glitches

Open
#113 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
265
Forks
81
PR merge metrics
No merged PRs in 30d

Description

Hi and thanks for this cool piece of software 👍
Now my Problem: Everything works fine, but when I start rendering 3D objects in my world, graphic glitches start approaching on them. In the example picture, you can see the effect on an green cube without any texture.

  • With box2Dlight:
    with box2Dlights

  • Without box2Dlight:
    without box2Dlights

In my render-loop, the source looks something like this:

init() {
        this.rayHandler = rayHandler;
        rayHandler.setCulling(true);
        rayHandler.setAmbientLight(0.1f, 0.1f, 0.1f, 0.5f);
        rayHandler.setAmbientLight(0.8f, 0.8f, 0.8f, 0.5f);
        rayHandler.setBlurNum(3);

        environment = new Environment();
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 0.4f, 0.4f, 0.4f, 1f));
        environment.add(new DirectionalLight().set(0.8f, 0.8f, 0.8f, -1f, -0.8f, -0.2f));
}
render(float deltatime){
       //...
       // (render 2D/Sprites)
       // (render 3D objects)
       //...

       rayHandler.setCombinedMatrix(cam);
       rayHandler.updateAndRender();
}

How can I avoid these effects?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied init and render loop, reproducing the green cube glitches with box2dlights enabled and disabled. Compare the 2D, 3D, and rayHandler rendering order and state, then verify that the cube renders without artifacts while the lighting remains active.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-graphics, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.