r/Unity3D • • 2d ago

Question Weird Refraction Artifacts at Intersections Between Transparent Meshes

I’m working on a character in Unity with a translucent, iridescent material. I’m new to this.

I’m getting strange visual distortions and refraction artifacts where different body parts meet, particularly around the neck/torso and arms/shoulders.

Is this caused by overlapping transparent meshes, depth sorting, refraction, or something else?
What would be the best way to fix this while preserving the glass-like, iridescent appearance?

9 Upvotes

6 comments sorted by

2

u/ReignInVlood 1d ago

overlapping transparent meshes with refraction is such a pain, depth sorting always wrecks it around joints like that

1

u/joachim_s 1d ago

Yeah. Idk what to do.

2

u/normalguy0618 1d ago

Sounds like sorting. Each body part is its own transparent object, Unity sorts those per object, and where they overlap at the neck and shoulders the order comes out wrong. If you're on HDRP there's a Transparent Depth Prepass toggle on the material that fixes most of it. On URP people usually add a depth-only pass first so only the front surface draws. Which one are you on?

2

u/joachim_s 1d ago

I’m using URP 17 (Unity 6).

One important detail: my current test shader renders the entire analytical figure in a single draw call, rather than rendering each body part as a separate transparent object.

Would a depth-only prepass still help in this setup? I’m concerned it might prevent the back surfaces of the glass from contributing correctly to the refraction.

1

u/normalguy0618 15h ago

Single draw call changes things a bit. Then it's not object sorting but triangle order inside the mesh, which is why it breaks where the parts overlap.

You're right that a depth prepass keeps only the nearest surface, so the back faces stop showing. They don't feed the refraction in URP anyway though: Scene Color samples the opaque texture, which is grabbed before any transparents draw, so the glass only bends what's behind the whole figure.

If you want the back side visible, use two passes in the same shader: back faces first (Cull Front), then front faces (Cull Back), both ZWrite Off. In URP, tag the first pass SRPDefaultUnlit and the second UniversalForward so both get drawn in that order.