-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't bake lightmaps on a MultiMeshInstance at all #48909
Comments
Here's a workaround if all you want to do is have the multimesh in the baked lightmap but not contain a lightmap of its own Create a Spatial in your scene with the following script: tool
extends Spatial
export(bool) var running = false setget set_running
func get_all_multimeshes(node, list=[]):
if node is MultiMeshInstance:
list.append(node)
for child in node.get_children():
get_all_multimeshes(child, list)
return list
func set_running(value):
running = value
if running:
var multi_meshes = get_all_multimeshes(get_tree().get_root())
for multi_mesh in multi_meshes:
for i in range(multi_mesh.multimesh.instance_count):
var global_xform = multi_mesh.global_transform*multi_mesh.multimesh.get_instance_transform(i)
var mesh = MeshInstance.new()
mesh.mesh = multi_mesh.multimesh.mesh
mesh.global_transform = global_xform
add_child(mesh)
mesh.set_owner(self)
mesh.use_in_baked_light = true
mesh.generate_lightmap = false
running = false In the editor, click the "running" checkbox and set it equal to "true". This will essentially create a copy of every multimesh in your scene and convert it to a regular mesh that will take part in lighting calculations. Then you can bake lightmaps as usual The meshes are a temporary copy that will disappear after you reload your scene. |
@TheUltimateAbsol Baking of It would be nice to support baking for |
Oh, bad news to read that. Have you a dedicated roadmap with features planned anywhere ? |
Is it possible to export the meshes as a gltf and import the gltf and then unwrap uv and use that for baking? I have done that with basic godot generated meshes and it worked since godot generated meshes don't have a UV 2. I mean my solution is not gonna be great but it will do for the urgent need |
Godot version: 3.3.0
OS/device including version:
Tested on both GLES2 and GLES3, Windows 10, Intel integrated graphics
Issue description:
I can't bake a lightmap into a MultiMeshInstance. Nor can I use a MultiMeshInstance in a lightmap.
Given that I can bake a GridMap, I was under the impression I could bake a MultiMeshInstance as well.
Steps to reproduce:
Minimal reproduction project:
This issue is actually already covered in #45313, although the poster doesn't seem to aware at all (likely because the SSAO in the sample project made it look like the MultiMeshInstance casted a shadow)
Here's a simpler project: bakedlighmap_test.zip
This is an image of the scene after I bake the indirect light and then turn the directional light off.
The lefthand side is a bunch of individual meshes (indirect light off the spheres is saved, as desired)
The middle is a multimesh (nothing is saved)
The left is a single sphere (for reference)
The text was updated successfully, but these errors were encountered: