I usually ignore the refractive properties and render it in two passes. The first pass outputs the color which is multiplied with the backbuffer. The second pass is additive and renders the reflection. So I use these two blend modes:
Blend Zero SrcColor
// Output color
Blend One One
// Output reflection
Unfortunately, I don’t know anything about writing shaders. It’s a thing I’ve planned to learn later, but it seems that I’ll have to learn that now… Got any good tutorial ?
I’ve already tried to put the standard shader on transparent rendering and it is not that good. It seems that sometimes other objects overlap it even if they are behind it. I will put a screenshot when I’ll be on my computer.
There are a couple of recent techniques that “solve” the issue of “order independent” (properly sorted) transparency, but they more accurately approximate it better, and really they just have a different set of artifacts. They’re also all much more expensive.
The standard shader doesn’t seems to fit this, and the refractive glass shader given in the standart assets package make the object completly transparent and add refractions that are a real FPS killer. What I’d like is a transparent material but not 100%, with a diffuse color. The tubes I’ve put in the first message are transparent but you still can see them because those got a blue diffuse color. Just like the PS2 Bios, the cylinder-like floating things are transparent but got a blue diffuse.
I hope someone got a solution Thanks for reading and answering me
More accurately those have an environment map gloss, possibly just a strong fresnel, and a blue tinted refraction. There’s no actual lighting on those at all, just a lot of fakery.
I quickly mocked up this, does it look along the right lines?
The attached image has the material settings I used. The only other thing I used was a reflection probe with the intensity set up to 20, to get nice bright glints.
Wow, so many thanks ! How did you managed to found a way to achieve this result ? I’ve played for hours with the material settings before giving up. Mine doesn’t look as good as yours but is nearly the same. I got a slight FPS drop when the camera is near the cylinder, maybe dropping from 30fps to 20-25fps, but it is good enough.
I’m still impressed that an old PS2 could handle this kind of material and refractions in real time, because my laptop can’t handle this really well. I got a frame drop from 60fps to around 20fps when I use a refractive material. I know that there’s a lot of things that are different between a console and a computer, but well, it’s still impressive!
Refractive materials will hurt performance, my example doesn’t use any. The ps2 was really quite powerful in terms of fill rate, so it did well with effects that layered on top of each other.
Hi everybody, I wrote a shader for glass (and translucency or custom lightmaps too) called Standard Plus. I think it does what you want because you can just put the refraction to zero. My glass has various controls on refraction, as well as fresnel. And on top of that, you can use thickness map to count for the model different thickness, producing much better results, because the thickness will affect not only the refraction but the glass color as well. And on top of that, it has the same functionality of the standard shader.
Take a look! https://www.assetstore.unity3d.com/en/#!/content/93745
Well, that all depends on the accuracy. A simple one time refracted ray that looks up in a cubemap does not hurt performance much at all. Raytracing 16 bounces in 3 colors would be a lot more accurate and still no problem for desktop hardware. I tried this once years ago, 2009. (I should really make a new version of that in Unity…)