[SOLVED] Weird shadow issue


  1. I create a space station with boxes with lighting material as walls and floors.
  2. I put a directional light in the space.
  3. Use either DirectionalLightShadowRenderer or DirectionalLightShadowFilter described in Light and Shadow :: jMonkeyEngine Docs
  4. Shadows look okay when the camera is outside of the station (pic.4).
  5. However, when I rotate camera inside the station. Walls and floors have a weird rendering (pic. 1,2,3).

Any idea on this issue? Thanks!

Have you tried increasing shadow map size?

Hard to tell from here but do your walls have thickness or are they flat planes (I assume they have thickness).

…if you have back shadows turns on then you probably want to turn that off. I don’t remember the specific option. Things facing away from the light will already be shaded.

Tried but same.

Yes, they have thickness. They are simple Boxes.

Indeed, you’re right. Issue is gone after I set this option:


Thank you very much!


@pspeed Found another issue, as long as I have the shadow enabled (by using either DirectionalLightShadowRenderer or DirectionalLightShadowFilter), I got a black screen when I press ALT+TAB to switch back to my IDE. It can be reproduced consistently in following steps:

  1. JME application is in full screen mode;
  2. Press ALT+TAB, I got a black screen. Nothing happens if I press ESC key.
  3. Press ALT+TAB again, I still have the black screen. Application can be exit by pressing ESC key.

The issue is gone if I comment out the shadow code. I’m using JME 3.6.1-stable.

Also maybe specify your OS, graphics card and LWJGL version. If you can, make a minimal code version of this case you can share here. Also make sure you are sporting the latest graphics drivers.

Hmm…when I tried to collect information. I found the black screen issue persist even without shadow enabled. As long as it’s in full screen mode, the issue is there. Here’s the code for full screen I wrote:

			GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
			int w = gd.getDisplayMode().getWidth();
			int h = gd.getDisplayMode().getHeight();

And here’s the environment info:

OS: Windows 10 64bit.

Pasted following logs from console. Please ignore a few Chinese as those are just WARNING/INFO.

Nov 19, 2023 1:40:43 PM com.jme3.system.JmeSystemDelegate lambda$new$1
警告: JmeDialogsFactory implementation not found.
Nov 19, 2023 1:40:43 PM com.jme3.system.JmeDesktopSystem initialize
信息: Running on jMonkeyEngine 3.6.1-stable

  • Branch: HEAD
  • Git Hash: 4de10c3
  • Build Date: 2023-06-23
    Nov 19, 2023 1:40:43 PM com.jme3.system.lwjgl.LwjglContext printContextInitInfo
    信息: LWJGL 2.9.5 context running on thread jME3 Main
  • Graphics Adapter: C:\windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_93e9d802758c173c\nvldumdx.dll,C:\windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_93e9d802758c173c\nvldumdx.dll,C:\windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_93e9d802758c173c\nvldumdx.dll,C:\windows\System32\DriverStore\FileRepository\nvhm.inf_amd64_93e9d802758c173c\nvldumdx.dll
  • Driver Version: null
  • Scaling Factor: 1
    Nov 19, 2023 1:40:43 PM com.jme3.renderer.opengl.GLRenderer loadCapabilitiesCommon
    信息: OpenGL Renderer Information
  • Vendor: NVIDIA Corporation
  • Renderer: NVIDIA GeForce RTX 2060/PCIe/SSE2
  • OpenGL Version: 3.2.0 NVIDIA 537.13
  • GLSL Version: 1.50 NVIDIA via Cg compiler
  • Profile: Core
    Nov 19, 2023 1:40:43 PM com.jme3.asset.AssetConfig loadText
    警告: Cannot find loader com.jme3.audio.plugins.OGGLoader
    Nov 19, 2023 1:40:44 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    信息: Audio Renderer Information
  • Device: OpenAL Soft
  • Vendor: OpenAL Community
  • Renderer: OpenAL Soft
  • Version: 1.1 ALSOFT 1.15.1
  • Supported channels: 64
  • AL extensions: AL_EXT_ALAW AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_MULAW AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET AL_EXT_source_distance_model AL_LOKI_quadriphonic AL_SOFT_buffer_samples AL_SOFT_buffer_sub_data AL_SOFTX_deferred_updates AL_SOFT_direct_channels AL_SOFT_loop_points AL_SOFT_source_latency
    Nov 19, 2023 1:40:44 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    警告: Pausing audio device not supported.
    Nov 19, 2023 1:40:44 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    信息: Audio effect extension version: 1.0
    Nov 19, 2023 1:40:44 PM com.jme3.audio.openal.ALAudioRenderer initOpenAL
    信息: Audio max auxiliary sends: 4