Transparent colored plastic-ish material

Hello everyone,

I’d like to know how to create some transparent colored plastic-ishmaterials like this picture:
Source: http://www.hunterlab.com/images/content-images/PLASTIC_Preforms_Overview.png

Most glass material makes objects completly transparent and usually refractive, but I can’t find a way to have this result.

Thanks for reading me, I hope someone will find a solution :slight_smile:

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

Hi, thanks for replying.

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 ?

Thanks for replying :slight_smile:

If you don’t care about the refraction you could get reasonable result using the standard shader.

Set rendering mode to transparent, then give it a fully blue albedo color with alpha set around halfway.

Metallic to 0, and smoothness quite high.

Not perfect, but if you add a reflection probe (or even use screen space reflections) it won’t look half bad.

1 Like

Screen space reflections don’t work on transparent materials.

1 Like

Ah, hadn’t tried that. Good to know!

Hi, sorry for late replying.

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.

Unity’s batching screws with the sort order of transparency some, but the short version is real time transparency is an unsolved problem.

http://forum.unity3d.com/threads/render-mode-transparent-doesnt-work-see-video.357853/#post-2315934

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.

To be more precise, I’d like to have the very same material as the PS2 bios:

source: http://motkar.pl/e64news/pcsx2.jpg

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 :slight_smile: Thanks for reading and answering me :slight_smile:

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.

1 Like

I quickly mocked up this, does it look along the right lines? :slight_smile:

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.

3 Likes

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!

Thank you so much again !

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

1 Like

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…)

https://www.youtube.com/watch?v=9779RtEN_uA

(Sorry it’s from before the HD time.)

1 Like

4.5 years later, Thanks!

I found that using a reflection probe really helps.