bevyengine / bevyengine/bevy

More than one Material2D doing instanced rendering cant seem to exist at once

Open
#22,805 3 comments 0 reactions 0 assignees View on GitHub
A-Rendering C-Bug S-Needs-Testing
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

Now i dont know if this is a bug or im just using them wrong, but ive used a material2d to instance draw entities, so ive done the shenanigans of created a handle to the material and mesh and passing it to every entity, then having a storage buffer on the shader to instance from with instance_id and writing new data to the buffer per frame. And it works, it renders a lot of entities, nice! But now i wanted to create new one because i wanted to try and make some cooler special effects, which would have required more vertexes in the mesh so i couldnt do it in the same one without having every other entity being 81 vertexes instead of 4, so i did the exact same thing again, handles to new material and mesh, pass it to the entities, index on gpu and update the buffer per frame, I run it and nothing crashes, but nothing renders either, i got crazy looking at the code knowing i definitely messed up something but it seems exactly the same as the first material, every seems to run properly, i tried with print statements. Then i got an idea, i tried to force the first renderer to not drawn anything, set up the material and mesh yeah but dotn actually pass the handles to any entity, so nothing gets instanced and drawn, and guess what? The entities in the second renderer were being rendered! So now i dont get why the first material that gets to render instances takes over and drowns the rest, help!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.