kode80 / kode80SSR

An open source screen space reflections implementation for Unity3D 5.
BSD 2-Clause "Simplified" License
382 stars 92 forks source link

Transparent Reflection Shader #10

Open jessyoblio opened 9 years ago

jessyoblio commented 9 years ago

If you create a new depth pass based on a layer ( TransparentFX layer for example ), is possible to create a Shader for reproduce reflections on transparent objects? I did some tests, the result is not great, the reflections are noticed, but are projected very bad. I've tried on a Opaque shader with alpha blending options...

KenzieMac130 commented 9 years ago

Unity Seems to have problems with rendering GBufffers with proper transparency. you could use dithered alpha clipping to fake the appearance of transparency at the cost of quality. Which might work sometimes for what you need but if not you can just use reflection probes or your early solution.

PBR Dither Shader, Free to Use: https://www.dropbox.com/s/bfz5rm59t2trj1k/Transparent%20For%20SSR.shader?dl=0

Sorry about any messy shader code. I generated it in Shader Forge as a quick example. Add Anti-aliasing and depth of field for the best results.

jessyoblio commented 9 years ago

I don't think is a Unity problem, because, transparencies works in forward rendering mode... Anyway, I've tried your shader, but don't reflect. Thank you for your time

KenzieMac130 commented 9 years ago

Ya, it doesn't reflect very well unless it is at a high opacity. The way I understand it is that transparency is handled with extra rendering steps for sorting. I tried making a rainy surface post shader using Unity GBuffers a while ago and I found that Unity Handled some transparent shaders in the GBuffers by ignoring them and drawing the surface behind them instead or just discarding those pixels in other transparent shaders (sometimes treating fixed function the same way) . There's not much you can do to control it based on my observations but I haven't really tried Forward rendering so I could be wrong.