Problem Getting World Coordinates From Shader Material (And Setting Alpha)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Alack Sunrider

Hey there. I’m making a 3D game, and I need to make a slice shader (example).
I don’t need it to be solid where the slice happened, but it would be nice. The way I’m trying to do it is using a shader material for the mesh I want to slice. If the fragment world position is inside the area culled, ALPHA = 0.. That brings two problems, though:

  • Apparently, setting the ALPHA for any fragment in the object makes it transparent
  • I can’t get the world coordinates for the fragments in the mesh itself

If I follow this tutorial, I get the wold coordinates for the fragments behind the mesh.

Any ideas on how I can get it to work? :frowning:

Edit: I solved the alpha problem. Just had to set the flag depth_draw_always. Still can’t get the position, though
Edit2: For anyone else who needs help getting the world coordinates, someone on reddit gave me the answer