godotengine / godot

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

BakedLightmap ignores ShaderMaterial #50340

Open theatlaso opened 3 years ago

theatlaso commented 3 years ago

Godot version

3.3.2.stable

System information

Windows 10, GeForce GTX 950, Intel Core i3-6100, GLES3

Issue description

BakedLightmap ignores ShaderMaterial and seemingly uses the default material instead

Two materials with red albedo (no red light is being reflected from ShaderMaterial): image

Two emissive materials compared: image

Converting a SpatialMaterial to ShaderMaterial will still not work.

Steps to reproduce

Create a mesh in an external program like blender, as the built in MeshInstance shapes cannot used for baking.

Create a ShaderMaterial or convert a SpatialMaterial with some color as the albedo/emission, put it on that mesh and bake lighting (in such a way as to see the reflected/emitted light on a nearby surface).

Minimal reproduction project

blism.zip

Zireael07 commented 2 years ago

Also seems to apply to Voxel GI based on my experiments in alpha 1.

I have neons everywhere and they're set to emissive white - the only thing that lights up in Voxel GI is the lanterns, and the difference is lanterns are a Standard/Spatial material and neons are a ShaderMaterial

Calinou commented 2 years ago

Also seems to apply to Voxel GI based on my experiments in alpha 1.

VoxelGI should definitely be able to take custom shaders into account, at least on meshes with the bake mode set to Dynamic. See this video for an example.

Either way, this is unrelated, so you should create a new issue with a minimal reproduction project attached.

Zireael07 commented 2 years ago

No 'minimal repro' yet, as I've realized thanks to Vulkan capabilities (no limit on lights) I can just put small lights on my neons to roughly the same effect with much better usability ;)

Calinou commented 1 year ago

This is resolved in 4.0's GPU-based lightmapper as per the description in https://github.com/godotengine/godot/issues/64124. However, the lightmapper in 3.x is CPU-based, which means it can't interpret shaders (which are meant to run on the GPU). As a result, this cannot be fixed there. Instead, we should document the limitation in the 3.x documentation.