Hi everyone, I'm very new to unity, and I'm amazed by the work done. Big applause! :)
Having said that, my problem is that the mirror I'm using gets me a pretty dark reflection. It is the same shader and script from the characterCustomization tutorial (not a single line changed, and the example works perfectly). The funny thing is that while I'm in "Play mode" the mirror is dark, but when I'm in the editor the reflection is fine. My scene has 10 lights, could it have something to do?
I've just reduced the number of lights and tried to play with the light intensities, but it has no effect on the mirror.
Answer by Hannibalov
Mar 07, 2012 at 11:48 PM
Adding camera.renderingPath = RenderingPath.Forward; in CreateMirrorObjects:
private void CreateMirrorObjects( Camera currentCamera, out Camera reflectionCamera )
reflectionCamera = null;
// Reflection render texture
if( !m_ReflectionTexture || m_OldReflectionTextureSize != m_TextureSize )
if( m_ReflectionTexture )
DestroyImmediate( m_ReflectionTexture );
m_ReflectionTexture = new RenderTexture( m_TextureSize, m_TextureSize, 16 );
m_ReflectionTexture.name = "__MirrorReflection" + GetInstanceID();
m_ReflectionTexture.isPowerOfTwo = true;
m_ReflectionTexture.hideFlags = HideFlags.DontSave;
m_OldReflectionTextureSize = m_TextureSize;
// Camera for reflection
reflectionCamera = m_ReflectionCameras[currentCamera] as Camera;
if( !reflectionCamera ) // catch both not-in-dictionary and in-dictionary-but-deleted-GO
GameObject go = new GameObject( "Mirror Refl Camera id" + GetInstanceID() + " for " + currentCamera.GetInstanceID(), typeof(Camera), typeof(Skybox) );
reflectionCamera = go.camera;
reflectionCamera.enabled = false;
reflectionCamera.transform.position = transform.position;
reflectionCamera.transform.rotation = transform.rotation;
reflectionCamera.renderingPath = RenderingPath.Forward;
go.hideFlags = HideFlags.HideAndDontSave;
m_ReflectionCameras[currentCamera] = reflectionCamera;
It'd be nice to have shadows in the mirror, but it looks good anyway
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
4 People are following this question.
Reflection of projected light (cookie)?
mirror effect reversed side?
Reflection upside down? Unity 3.3.0f4 (63135)
How to make a mirror in 3.x?
How to mirror an object (reverse its sides)?