- Home /
Nicely fade transparency with standard shader?
I'm working on a training application that already has been set up using the standard (specular setup) shaders. I'd like to stick with those shaders, but I am trying to add the ability to fade objects out nicely and it is becoming clear that there is no way to do this with this shader.
In Transparent mode, it never goes completely invisible, the specular highlights are always visible. In Fade mode, it looks really awkward and not opaque at all even with the alpha at 1, but does fade to invisible with alpha = 0. So, neither provide a nice fade from 100% opaque to 100% invisible.
Is there any way to get this effect with the standard shader or do I just need to move on to a different one that actually supports transparency?
You can certainly look for a better shader, but the Fade mode of the Standard Shader does really well, given the difficult restraints of handling transparency in a PBR system. You won't easily find one that works better.
Thanks for the info and quick response! The problem with fade, is that even with an alpha of 1, the model is awkwardly transparent in some spots/not actually opaque. Here is opaque mode and then fade mode with alpha=1 for the body object of this assembly. As you can see they look nothing alike and it would be visually jarring for me to swap to this and then fade out. I tried changing the render queue and it has little effect.
link removed
I found a way to get the standard shader to fade properly in fade mode by frankensteining a Zwrite pre pass I found on the forums into a renamed copy of the built in standard specular shader. It works great. If you set it to fade mode and change the alpha, it fades perfectly from opaque to invisible. I've never written a shader and wish I knew more about how this worked, as there is probably a better way to do it, but this works great for anyone else with this issue:
https://www.dropbox.com/s/o0ef7ws2d08fos8/StandardSpecular_Edited.shader?dl=0
Answer by Straafe · Jul 15, 2017 at 01:38 AM
I found a way to get the standard shader to fade properly in fade mode by frankensteining a Zwrite pre pass I found on the forums into a renamed copy of the built in standard specular shader. It works great. If you set it to fade mode and change the alpha, it fades perfectly from opaque to invisible. I've never written a shader and wish I knew more about how this worked, as there is probably a better way to do it, but this works great for my needs (just needed to be able to fade out a standard shader and have it look nice) https://www.dropbox.com/s/o0ef7ws2d08fos8/StandardSpecular_Edited.shader?dl=0
Hmm, I tried it but it started with a semi-transparent effect at full opacity, just like the regular standard shader....
I had the same issue, the unity standard shader - fade render (at alpha 1) is different from opaque render -
This shader fixed my issue, i had an error when added to the project, but reimport fixed that error too.
Answer by Ziplock9000 · Dec 14, 2018 at 03:08 PM
This seems to work well, but it's a shame it uses the specular workflow, not the metallic one for standard shaders, which itself will be obsolete soon with HDR
Your answer
Follow this Question
Related Questions
Outline flat mesh 1 Answer
Mesh shader to outline colour changes 1 Answer
Hiding parts of mesh but only on defined objects 0 Answers
Create a hole in a mesh using a shader 0 Answers
How to use mesh data in shader 0 Answers