godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.77k stars 21.13k forks source link

GPUParticles2D(and CPU) particles not reacting to light source. Shadows turn with the particles. #87957

Open mightymochi opened 9 months ago

mightymochi commented 9 months ago

Tested versions

Tested and reproducible in 4.2 Stable and 4.1.2 Stable.

System information

Godot v4.2.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.3742) - 12th Gen Intel(R) Core(TM) i7-12700K (20 Threads)

Issue description

Particles with normal maps are not reacting to light as expected. The shadows are rotating with the particle rather than being relative to the light source.

godot4particles

Expected result coming from Godot 3.5.3: godot3particles

Steps to reproduce

  1. Create 2D scene.
  2. Add any Light2D light source.
  3. Add GPU or CPU particle2D.
  4. Particle2D - Add Particle material and adjust settings so that the particles will change their rotation as they move.
  5. Particle2D - Add CanvasTexture with Diffuse and Normal image textures.
  6. Add CanvasModulate and darken the scene.

Minimal reproduction project (MRP)

particleExample.zip

GigglingGalaxy commented 6 months ago

Same exact thing on Mac OS Sonoma14.1 (23B74), M1 14 in MacBook Pro. Godot 4.2 (most recent stable) In my case, I animated a Spotlight and it went up and down in front of particles and shadows occurred as shown in @mightymochi image.1 above. Same steps as above. I was using Forward+, did not attempt in Mobile or Compatibility mode.

Tried with spot, directional, omni lights animated (up/down on y axis), same result. ...Tried different settings on all 3 light objects, same result Tried with CPU particles with and without material parameters: Alpha blend/hash/scissor and all alpha on/off and compression types: same result. Tried different particle mat just to see, but same result. Tried with 3 different types of global lighting (sky, background, canvas), same result. Tried disabling global lighting on particles and particle mat, same result (although this is what I'd assume is expected behavior)

*It's like each particle has an internal light source ? Even though I didn't have any extras like glow or fog set up, and their mesh/mat had a standard shader. It's like the particles' intrinsic ambient light is casting shadows on itself?

Could this simply be that the mesh used for particles has shadows enabled? I checked mine (reimported to be sure) and my mesh used for particles does not have shadows enabled. That would be my first thought in mighty's case, but then it's not other particle's shadows causing shadows (which would be expected if shadow was enabled on mesh). It's like the individual particle itself has its own little spotlight?

I'm not an expert but general production lighting techniques tell me they shouldn't have individual lights... idk if particles are a multi mesh in essence? Reading latest on particle systems from Godot's VFX guru I seem to remember they were. If so, is this why they are each appearing to have a light attached individually? Is that something that can be disabled in editor so only external lights have effect, not internal mesh lights? Of course I'm not sure if meshes have lights built in, so the rest is above my head.

mightymochi commented 4 months ago

What needs to happen to promote this issue to "Bug" level?

Calinou commented 4 months ago

Same exact thing on Mac OS Sonoma14.1 (23B74), M1 14 in MacBook Pro. Godot 4.2 (most recent stable)

The issue reported above seems to be in 3D judging from the description, while this issue is specifically about 2D. The 2D and 3D lighting code have nothing in common.