- Home /
How do i change the Alphasorting Center to the Pivot in Meshrenderers?
Hey, so i have the issue that I have to show semitransparent Planes intersecting.
I have figured out that the issue why half the time a plane is shown completely behind and half the time completely in Front of the other is called Alpha-sorting so Unity takes the center of the objects and draws the Objects one after the other.
What I have done so far is mathematically calculate where the Mesh intersects with the other and split the Mesh into two. so now when two Planes intersect, they get cut into two meshes and half of it is in Front again, half in the back, so far so good. However, when the two square planes intersect with the corners diagonally, so that the resulting meshes are triangles, i have a problem.
The Alpha-Sorting takes the Object Center to calculate whether or not an Object is in Front of another, this Center is not well positioned in some cases, with a triangle like this: (-1,1),(1,1),(1,-1) the center is set to be (0,0) because i think it takes the bounding box center, i have a functional pivot point that i could use for the correct Alpha-sorting. Is there a way to set the Alpha Sorting point in the MeshRenderer to be the Pivot and not the Center?
Greetings, Gerrit
Ps.: I just tested out an idea that seems to "solve" my problem but is really not cool. by adding vertices with no connection to anything with UV cooridnates at (0,0) you can scale the bounding box and by doing that, move the center of it and with that move the center of the object the Renderer uses for Alpha sorting. to be honest, this is not good, i would still prefer to find an option to just set it to the pivot and not fiddle with 0 size vertices that might get patched out someday for performance reasons, so if anyone has a cleaner solution, i would be glad to hear
Your answer
Follow this Question
Related Questions
Shader queue tags not working...? -3 Answers
HDRP DepthMask Possible? 0 Answers
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Standard Shader Still Visible through Stencil Shader 0 Answers