0
Исправлен

alpha z buffer

vincent 11 лет назад обновлен Freya Holmér (Developer) 11 лет назад 8

Hi, I want to create a soft alpha shader that writes to the z buffer. I use your Clip and Transmission shader for this, first I disconnect the alpha from the Alpha Clip input in the Main node and put it in the Alpha input above it. Next I uncheck the Auto-sort box and check the Write to Z Buffer box. I believe this is the way to create a soft alpha with depth sorting?

The problem now is a is a bit hard to explain but from some view angles(I look at the plant in the example scene) when 2 or more leafs overlap the leaf that's at the back is masked by the whole polygon not just the alpha. While the floor behind it is rendered correct. I hope you understand what I mean;)

This is fixed when I connect both the alpha and the alpa clip inputs.

I dont't know if it is a bug or the only way to use an alpha with z buffer?

Are you using deferred or forward rendering?
Also, transparency is tricky, there's no perfect solution. The issue is that a pixel either writes to the Z buffer, or it doesn't. There's no "softly" writing to it. This is why alpha clip is always sorted properly.
Thx for the clear answer!! Unity always has problems with the sorting of 'soft' alpha . I was hoping that there was some kind of fix for it. (It is a bit of a downside of the Unity engine since it would be great for character hair and stuff.) So I will just use the alpha clip.
Maybe it is better for Shader Forge to 'grey out'  the Write to Depth buffer check box when using the alpha input since it it not working properly and I am guessing it won't?
Thx

It is working properly, it's just not working the way you expect it to :) There might be some special effects where you want to be able to control it, so I'll leave it open!
I will have to revise my expectations;p

Сервис поддержки клиентов работает на платформе UserEcho