Reflective Glass Shader that reflects the scene

Hi all

Is it possible to have a proper reflective glass shader?

All the ones I have tried so far expect an existing cube map but I am looking for scene reflections. I have Pro.

I think a reflective glass shader should have:

Transparency amount
Tint color
Reflection amount
Reflection Blur amount (if possible)
Bump map
Specular

Any help would be great thanks.

Check out the MirrorReflection script + shader on the Unify wiki.

Hi

Is it possible to make that so it has a reflection percentage rather than being 100% reflective?

Cheers

I was just looking to do the exact same thing 8^) I am also wishing to allow refraction along with the live reflection that is translucent.

look at the pro water shader, that does exactly that

I happen to have NO experience with coding or modifying shaders so I have a feeling I would probably just need to alter the color = white to RGBA and set the alpha lower perhaps… but I am not sure.

I am using the mirror shader and it shows the skybox area in the reflection as bright pure white and not the skybox.

Hmm, I did try that previously but it wasnt right, my reflections were all upside down etc.

Setting offsets to -1 didnt help either.

I am modifying the mirror shader now and trying to take my limited knowledge with logic and use the window reflection shader as a reference to make this thing translucent lol. Just made it pitch black so thats a start I guess.

Good luck.

I gave up with the water shader in the end. Couldn’t make it semi transparent and the scene reflections were upside down :confused:

I DID IT LOL!!! yay.

here it is. I set it up so you can change the amount of reflection and tint the glass as well. Be sure to drop the mirror.cs script onto the window etc.

Shader "FX/Mirror Reflection" {

Properties {
	_Color ("Alpha=ratio", Color) = (0,0,0,0)
    _MainTex ("Base (RGB) Gloss (A)", 2D) = "white"
    _ReflectionTex ("Reflection (RGB) Gloss (A)", 2D) = "black" { TexGen ObjectLinear }
	//_ReflectColor ("Reflection Color", Color) = (1.0, 1.0, 1.0, 0)
}
Category {
Tags {Queue = Transparent}

// two texture cards: full thing
Subshader {
UsePass "Alpha/Glossy/BASE"
    Pass {
	Blend SrcAlpha OneMinusSrcAlpha
        SetTexture[_MainTex] { constantColor [_Color] combine texture }
        SetTexture[_ReflectionTex] { matrix [_ProjMatrix] constantColor [_Color]
            Combine texture * previous DOUBLE, texture * constant  }

    }
}

// fallback: just main texture
Subshader {
    Pass {
        SetTexture [_MainTex] { combine texture }
    }
}
}
}

Not too bad for having NO experience with shaders at all. This could get fun!

It looks really awesome!!! VERY REALISTIC! I am now happy. I like this a lot. My only issue now is that the skybox is not showing up in my reflections. It wasn’t in the mirror to begin with. Wonder why. hmmmm

Have it reflecting the skybox too now. For some reason, the mirror script was not using my camera as current so I changed it to camera.main and added a skybox directly to my camera and its working.

Look forward to trying this out today, if its a winner then you should put it onto the Wiki in the shader section.

Didnt work for me in latest unity 3.0 build, MirrorReflection.cs kept throwing lots of errors up about texture not being a power of 2 (even when it was set to 256)

Care for creating a little web player demo to show it working on your setup?

Here you go…also has other cool things I have been working on.

http://forum.unity3d.com/viewtopic.php?p=398969#398969

I’ve also been searching for a glass shader with dynamic reflections. I eventually managed to make one, by modifying the MirrorReflective shader/script to include transparency, a base texture, and tinting.

I made a page for it on the Wiki: http://wiki.unity3d.com/index.php/SurfaceReflection

It requires Unity Pro, though.

HI There, can anyone explains to me why is mine is reflecting the Skybox while my object is in a showroom? it seem as if it is picking up the Skybox even though I put in another texture.

I want a mirror like texture on a cube like a mirror cube :). Thanks in advance.