jMonkeyEngine / jMonkeyEngine/jmonkeyengine

garbled PointLight shadows on mac

Open
#1,783 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Contribution welcome
Dominant language
Java
Stars
4.3k
Forks
1.2k
Avg merge
4d 7h
Merged PRs (30d)
14

Description

As discussed the the Discourse hub/forum: https://hub.jmonkeyengine.org/t/point-light-shadows-with-setradius/45402

The PointLightShadowRenderer paints the quad with a shadow on the Mac, but not on Linux. The only caster in the test scene is the quad that's receiving the shadows.

Here's the test app again:

import com.jme3.app.SimpleApplication;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.material.Materials;
import com.jme3.math.ColorRGBA;
import com.jme3.math.FastMath;
import com.jme3.math.Vector3f;
import com.jme3.renderer.queue.RenderQueue.ShadowMode;
import com.jme3.scene.Geometry;
import com.jme3.scene.shape.Quad;
import com.jme3.shadow.PointLightShadowRenderer;

public class MazeGame extends SimpleApplication {

    public static void main(String[] arguments) {
        MazeGame application = new MazeGame();
        application.setShowSettings(false);
        application.start();
    }

    @Override
    public void simpleInitApp() {
        cam.setLocation(new Vector3f(-35f, 5f, 30f));
        cam.lookAtDirection(Vector3f.UNIT_X, Vector3f.UNIT_Y);
        flyCam.setEnabled(false);

        viewPort.setBackgroundColor(new ColorRGBA(0f, 0f, 1f, 0f));
        rootNode.setShadowMode(ShadowMode.CastAndReceive);

        PointLight torch = new PointLight();
        rootNode.addLight(torch);
        torch.setColor(new ColorRGBA(1f, 1f, 1f, 1f));
        torch.setPosition(new Vector3f(3f, 4.65f, 33f));
        torch.setRadius(1000f);

        Material material = new Material(assetManager, Materials.LIGHTING);
        material.setBoolean("UseMaterialColors", true);
        material.setColor("Diffuse", new ColorRGBA(1f, 1f, 1f, 1f));
        material.setColor("Specular", new ColorRGBA(1f, 1f, 1f, 1f));
        material.setFloat("Shininess", 1f);

        Quad mesh = new Quad(10f, 10f);
        Geometry geometry = new Geometry("", mesh);
        rootNode.attachChild(geometry);
        geometry.move(-5f, 10f, 25f);
        geometry.rotate(FastMath.HALF_PI, 0f, 0f);
        geometry.setMaterial(material);

        PointLightShadowRenderer plsr
                = new PointLightShadowRenderer(assetManager, 256);
        plsr.setLight(torch);
        plsr.setShadowIntensity(1f);
        viewPort.addProcessor(plsr);
    }
}

Contributor guide

Open the contributing guide

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 by running the provided MazeGame reproduction with PointLightShadowRenderer on macOS and Linux, then inspect the renderer's shadow output for the quad. Compare the two platform results and identify why the shadow is garbled on macOS; done means the test scene renders consistent point-light shadows on both systems.

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
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.