This is an very helpfull shader BUT it don’t work on Windows since Unity V2.0 (in fact it seems don’t work with directX, b’cause it was OK with Unity 1.6.2 -OpenGl)
Any idea Aras ? :roll:
Thanks to the UnityTeam for 2.0
It has several bonuses over 1.x version: works in scene view and with multiple cameras, does not require vertex shaders, the mirror can have a texture, and the mirror can be arbitrarily scaled.
I just setup the Mirror reflection shader and its super cool. I have a couple of problems though:
Doesn’t work with Orthographic cameras
I want to use a black texture for my reflective surface (a la Leopards Cover flow style) but the reflection is almost invisible
The reflective layer seems to lose the nice effect of the pixel lights in the scene, which makes it look a little dull - is there a way to just “add” the reflections to an existing material?
The shader multiplies texture with the reflection (combine texture * previous). You can change that to add (combine texture + previous), add signed (combine previous ± texture) and so on, whatever you like.
I did not try, but I think what could work is:
setup the mirror renderer to use two materials (change array size in mesh renderer),
set first material to use regular material you want,
set second material to use mirror shader,
change shader to do additive blending, something like (untested):
If you’ve got nothing under your mirror plane, then just commenting out call to CalculateObliqueMatrix in the mirror reflection script should work.
Meanwhile I’m trying to figure out how to do this oblique clipping matrix for orthographic camera, and this projective math is a bit over my head. If anyone knows how to do it, let me know…
Updated the MirrorReflection2 on the wiki, now supports orthographic cameras. Only the CalculateObliqueMatrix function in MirrorReflection script has changed.
this works great. is there anyway of making the reflection say 10% strength… trying to achieve a highly polished concrete floor that reflects the columns and ceiling around it… any suggestions?
Since I was doing something similar just now, the alpha channel of the main texture controls the reflection strength (I just changed the FX/Mirror Reflection shader slightly):
Is it my imagination, or can unity not read a solid color as an alpha channel?
I created a flat color with a solid grey alpha channel and it kept coming up white ie no alpha. I changed the levels of gray from white through black still nothing. I then scribbled black and white and there is was. Even a small dot of different shade enabled the alpha. But flat no way. Is it me or is that weird?