- Home /
Looking through glass windows
I looked at quite a few threads, but I'm still not sure how to do what I want to do. I would like to have a glass window. I've experimented with the transparency shaders and alpha adjustment, but it doesn't give me quite the effect that I'm looking for.
I would like to have it so that you can look through a window and see what's on the other side, but still tell that there is glass there. Is there some creative way I can do this (Using a "Glass texture" with a transparency shader, perhaps)? I tried render to texture, but it gave the same effect as transparency (and also seems like a bad idea in a hall of windows).
I don't need any form of reflection at all, simply realistic transparency.
Thank you.
You have to be more specific and maybe post pics. It sounds like you don't know exactly what you want the glass to look like. Your problem could be as simple as using the wrong material color- (white or grey) the RGB components of glass should be nearly black with some blue-green. A cubemap (fake reflection) would go a long way toward making the glass look more real too
Answer by Moor · Dec 12, 2013 at 05:28 AM
Simple glass shader by unity wiki:
Shader "Glass" {
Properties {
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
_Shininess ("Shininess", Range (0.01, 1)) = 0.078125
}
SubShader {
Tags {
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
}
LOD 300
CGPROGRAM
#pragma surface surf BlinnPhong decal:add nolightmap
half _Shininess;
struct Input {
float dummy;
};
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = 0;
o.Gloss = 1;
o.Specular = _Shininess;
o.Alpha = 0;
}
ENDCG
}
FallBack "Transparent/VertexLit"
}
I appreciate the comment, but the issue is: I don't know how to add a texture to the material that uses this shader that will actually make it look like proper glass.
I read about that shader in This link from a forum post, but I couldn't see how it would solve the "$$anonymous$$ake the glass visible" issue. Is it just picking a better texture or?
Shader "Simple Glass11" {
Properties {
_Color ("$$anonymous$$ain Color", Color) = (1,1,1,0)
_SpecColor ("Spec Color", Color) = (1,1,1,1)
_Shininess ("Shininess", Range (0.01, 1)) = 0.7
_$$anonymous$$ainTex ("Base (RGB)", 2D) = "white" { }
}
SubShader {
// We use the material in many passes by defining them in the subshader.
// Anything defined here becomes default values for all contained passes.
$$anonymous$$aterial {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
}
Lighting On
SeparateSpecular On
// Set up alpha blending
Blend SrcAlpha One$$anonymous$$inusSrcAlpha
// Render the back facing parts of the object.
// If the object is convex, these will always be further away
// than the front-faces.
Pass {
Cull Front
SetTexture [_$$anonymous$$ainTex] {
Combine Primary
}
}
// Render the parts of the object facing us.
// If the object is convex, these will be closer than the
// back-faces.
Pass {
Cull Back
SetTexture [_$$anonymous$$ainTex] {
Combine Primary
}
}
}
}
Your answer
Follow this Question
Related Questions
Making a glass/window shader with cubemap reflection and transparency options 2 Answers
Creating realistic glass 4 Answers
How to Make a Window? 2 Answers
Windows (glass) 4 Answers
How do I stop seeing through models by glass windows? 1 Answer