Replies: 1 comment 2 replies
-
I know what you mean, but doesn't look like z-fighting to me, more like a random render order. Do you have a depth buffer and |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm trying to create a simple 2D app that is supposed to show a lot of ants crawling around. For that I have basically 3 different textures that I would like to cycle through. This works well for the most part. I went with InstancedMeshes here and the performance is great, even when running in the browser, I can show 20k different ones at the same time with no performance hit which is awesome!
But I also noticed that they flicker when they are rendered on top of each other. This looks similiar to Z-fighting. I've tried to set a unique z-value for each entity, basically moving each of them to a unique distance to the camera, which is what worked when I had a unique Gm for each of them (tho then the performance tanks with a higher number of entities). But when I use InstancedMeshes this does not work. Now my guess is that it is because I use one InstancedMesh for each texture and they get rendered one after the other (basically, I have 3 different InstancedMeshes, one for each frame of the animation). Here is a video to show what I mean, I slowed the animation way down so it is easy to see:
Antler.Ubuntu-22.04.2025-01-16.00-34-39.1.mp4
I recreate the assigned Instances each frame based on the animation state of the entities and assign these to the individual InstancedMeshes that each represent a texture. I don't care which one is in front or the back to be honest, I just want the resulting flickering to be gone.
Well, for that I would like to know if there is a way to control which Instances are in front or back on a per instance basis or if there is a way to organize this all into a singular InstancedMesh and have the texture that is used be set on a per instance basis or if maybe my approach is real bad and there is a better way to do this altogether :)
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions