- Home /
How would I fix this DrawMeshInstancedIndirect and Translucent object problem?
I wrote a script in DOTS using the DrawMeshInstancedIndirect (DMII) to render translucent voxels (Cubes) without the hybrid renderer. The cubes render in the order that they are in the NativeArray that is put into the DMII function and are not in order of closest to the camera to farthest. I know of a solution to fix this where I sort the array myself in the order of distance from the camera, but I would prefer not to do this as in this game, there are hundreds of thousands of voxels as it is a voxel simulator game. The DMII function works perfectly when setting the parameter in the Shader Graph "Render Type" to opaque, but I need translucent voxels for glass, water, light, gases, smoke, and such. Is there any other method of extremely performant method of fixing this problem? If not, I am just going to use compute shaders and buffers and calculate the distances, sort, and reconfigure the rendering queue on the GPU.
In the image above, the sort order matches the direction that the camera is facing as shown by the coordinate icon in the top right. This is what I want
Now, with the camera flipped 180 degrees on the other side of the cubes, the back cubes render through the front cubes.
Thanks for helping in advance!
Bump, once I get the voxel DOTS rendering system working with transparencies, optimized, and some other features, I'll make it a free asset for others if they want to make a voxel game or custom mesh particle emitter.
Your answer
Follow this Question
Related Questions
Shader queue tags not working...? -3 Answers
Particles visible through everything! :( 1 Answer
Image effect shader not running 1 Answer
How can i get my quad to only render my texture without stretching it? 1 Answer
Unity System Fog Access 0 Answers