- Home /
Why does resizing a plane with the lightmap/mirror shader distort the reflection? youtube link included
See the package at
http://www.unifycommunity.com/wiki/index.php?title=MirrorReflectionLightmapped
Surely not being able to resize the plane makes this unusable?
video of the problem in action:
Have you tried making a bigger plane in your modeler and just applying the shader to that?
$$anonymous$$y guess is it has something to do with UV coordinates, from the looks of it, but I'm not 100% sure. I would do as Peter said, and create whatever size plane you need to in a 3D modeling program and just use that - don't rely on the built-in Unity types for advanced things like this. You're supposed to create your own.
Answer by desov · Oct 04, 2010 at 11:12 PM
Just use Water script from Pro Standard Assets with MirrorReflectionLightmapped shader. Works fine.
Ow, You might want to get rid of refraction section from the script ;)
Had the same problems, this package is a cut down version of the water script itself, so as desov mentionned ( that's how I did too) simply use the normal water script and tweak it, remove water animation, refraction etc, and you will get perfect reflection.
Answer by Q_B · Nov 30, 2010 at 08:58 AM
The way I solved this problem:
On the MirrorReflection.cs script, add a new variable
public int custom_scale = 1;
Then, on line 95, substitute
//Matrix4x4 mtx = transform.localToWorldMatrix * Matrix4x4.Scale( new Vector3(1.0f/scale.x, 1.0f/scale.y, 1.0f/scale.z) );
Matrix4x4 mtx = transform.localToWorldMatrix * Matrix4x4.Scale( new Vector3(custom_scale/scale.x, custom_scale/scale.y, custom_scale/scale.z) );
Now all you have to do is to put on custom_scale the same value you have on your plane's scale.
This could even be done by referring to the transform.scale component of the object, but I'm in a hurry and haven't implemented it like that yet, so :)
But this way it works. Hope it helps!
(edit)
Ok then, you can also add
public float custom_scale = 1;
instead, and then, lets say, before line 95, add the following
custom_scale = transform.lossyScale.x;
and then the Matrix4x4 code changes stated above.
This way, it will always use your plane's scale (I'm assuming you have a uniform scale on all axis, so just use the x scale)
Hope it helps!
Answer by zante · Sep 09, 2010 at 11:06 AM
Just imported a plane from max, the rest of the model was made in sketchup. None of the proposed solutions worked.
Answer by desov · Oct 28, 2010 at 04:39 PM
This might help :
( mirror reflection script) Try to experiment with the value of Clip Plane Offset. Tweek it untill you find the right reflection distance.
Your answer
Follow this Question
Related Questions
Problem with reflection probe 0 Answers
Which project settings for mirrors? 0 Answers
How to use two reflection cameras in the same scene? 0 Answers
mirror effect reversed side? 1 Answer
Curved Mirror - How to do it? 0 Answers