- Home /
how to do A reflective shader of the marble
how to do A reflective shader of the marble
Answer by noradninja · Dec 13, 2009 at 12:45 AM
It would help a lot if you were more descriptive about what you are trying to do, I am sure that is why your post got modded down.
Aside from that, I am assuming you are asking how you would make a shader that is reflective and also looks like marble.
There are a couple of ways you can do this.
First, you can use the Reflective Diffuse shader (Click here). You will need a cubemap for the reflection, and a texture of a marble surface for the base color. The alpha channel of the base color texture determines how strong the reflection strength is; if you want the floor to be 100% reflective, make the alpha channel black. If you don't want it to reflect, make it white; if you want say 50% reflection, make it a medium grey.
Another thing you can do is use the Transparent Diffuse shader (Click here). You will need a marble texture, and again, the alpha channel will in this case control the transparency: white is 100% solid and black is 100% transparent, with shades of grey being in between. Once you set this up and put it on your reflective marble surface (I assume it is a floor or a ceiling), you can then duplicate your level geometry and flip it 180 degrees so that it mirrors the level in the floor like so:
You might ask, 'if the first way is so easy, why would you do it the second way?' and that is a good question. A good reason would be if you had two reflective surfaces facing each other (a marble floor and a mirrored ceiling, for example). The reflective shaders are good, but they have a hard time working out this sort of thing. Another reason is that unless you do some code work, the cubemap used by the reflective shader is static; it wont reflect dynamic objects like your player character as he walks around the floor. And, finally, not everyone has hardware that can do cube maps, a good example of this is the iPhone. You can use a custom shader and a spherical map to get a similar effect, but thats a topic for a different discussion.
I hope that this explanation helps you understand what you were trying to do, and please, in the future, don't be afraid to ask questions, but the more detail you give us about what you are trying to do, the better the answers will be and the community will benefit as a whole from that.