Skip to content
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

Using the same .tscn with the same .mesh multiple times in the instancer combines them into only one foliage object. #617

Open
nan0m opened this issue Feb 7, 2025 · 4 comments · May be fixed by #604
Assignees
Labels
bug Something isn't working
Milestone

Comments

@nan0m
Copy link

nan0m commented Feb 7, 2025

Terrain3D version

0.9.3a

System information

Godot v4.3.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3070 Laptop GPU (NVIDIA; 32.0.15.6636) - 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz (16 Threads)

Is the issue reproducable in the demo?

Not applicable

Issue description

My use case:
I have three differently colored types of bushes all using the same mesh.
Therefore, I load the .tscn that contains the mesh 3x into the foliage instancer each time with a differently colored material.

However, in the end, all three of these foliage slots show the same object with the same material. Painting in the world also paints only one of the three variations.

Workaround:
duplicate the bush .tscn and give each foliage slot a different .tscn to refer to, even when they use the same mesh.

Logs

No response

@TokisanGames
Copy link
Owner

Godot MMIs do not have material overrides. They have a mesh reference, which has a material.

When you apply a mesh scene, we extract a reference to the mesh from the first MeshInstance3D within the scene. We take the material on the mesh, or the material override in the scene, or our material override, apply it to the mesh and insert it into the MMI.

We don't duplicate the mesh resource. So if you insert the same mesh resource the MMIs are going to be linked to the same mesh resource and the material overwritten on subsequent instances. We could look at duplicating the mesh.

@nan0m
Copy link
Author

nan0m commented Feb 7, 2025

I wouldn't make it a high priority. Since the workaround is so simple.
Are there plans to move from .tscns to just assigning mesh resources directly, however?

Anw. Also wanted to say that this actually works really well and I am quite happy about it!

@TokisanGames
Copy link
Owner

Are there plans to move from .tscns to just assigning mesh resources directly, however?

We take in packed scenes, not just tscn. No plans to change that.

@TokisanGames TokisanGames linked a pull request Feb 10, 2025 that will close this issue
13 tasks
TokisanGames added a commit to laurentsenta/Terrain3D that referenced this issue Feb 10, 2025
…ll material if using generated; Duplicate mesh to fix TokisanGames#617
@TokisanGames
Copy link
Owner

This will be fixed by #604, duplicating the provided mesh so different materials can be used in the material override slot.

@TokisanGames TokisanGames added this to the 1.0 milestone Feb 10, 2025
@TokisanGames TokisanGames moved this to In Progress in Terrain3D Roadmap Feb 10, 2025
@TokisanGames TokisanGames added the bug Something isn't working label Feb 10, 2025
@TokisanGames TokisanGames self-assigned this Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants