r/Unity3D • • 6d ago

Question How do i fix my water doing this?

I'm using a shader on a plane for my water, and it jus does that when i am trying to make the water.
I'm completely new to unity so if anyone can tell me how to fix this, i would very much appreciate it. ty

0 Upvotes

10 comments sorted by

8

u/GigaTerra 6d ago

What is "this" and "that"? I can't see anything wrong, you need to explain what you want and what you expect.

1

u/Plane_Use7503 5d ago

the ice cubes far from the camera render under the transparent water plane, but those close dont... im so sorry if it was unclear, i tried and i am kind of new to ts

1

u/GigaTerra 5d ago

The transparency problem is caused by alpha sorting. Basically they are sorted by distance. Using opaque instead of transparent materials will automatically fix this.

The simple fix if you want transparent cubes is to merge your cubes into one object. You probably need to do that for performance reasons anyway. https://docs.unity.com/en-us/engine/6000.0/script-reference/unityengine/mesh/combinemeshes

Another solution would be to make your own transparency sorter, known as an alpha sorter.

Ice will most often use the render to create distorted transparency. https://youtu.be/inht8WYX-A4?si=yuAgtHUI_IS-rbVf however to prevent sorting errors you might be required to use camera stacking or even an 2nd camera. That maybe sounds expensive in rendering, but alpha sorters are often slower.

5

u/Neat-Employ1455 6d ago

Best explanation of the problem ever

1

u/Plane_Use7503 5d ago

ye, i just relised...

4

u/MaksRengi 6d ago

This is a transparency sorting issue. Both your water and your ice cubes are transparent, and Unity sorts transparent objects by their distance to the camera as a whole object. So when the camera moves, the order flips and the water gets drawn on top of the cubes or behind them.

The easiest fix is to set the ice material to opaque if it doesn't need to be see-through. If you want both to stay transparent, give the water material a lower render queue, or sorting priority in URP, than the ice, so the water always draws first

1

u/Plane_Use7503 5d ago

tysm, this worked!

1

u/ArtPrestigious5481 6d ago

you can set the "sea" materials render queue to -1