- Home /
Puddle reflection effect
Is it possible to have real-time reflection on something like a puddle all over a terrain?
the effect intended is this:
I've done some research and the possibilities are:
use some 3D application to create the effect and import the mesh and materials to unity.
or
use some texture and shader to create the puddle over the floor texture and generate the reflection.
thanks in advance.
Answer by mstevenson · Nov 17, 2012 at 08:33 AM
Your best bet is to render a cubemap in-engine and use a reflective shader to display it.
Thanks for the answer. I have no experience on this, so I'll study and see what I can do. Any deeper explanations help a lot at this stage.
I know responding to an old topic is useless, but none the less this might still be useful for people in need of that particular kind of question.
A cumbemap works but the parallax is not 1-1 and if you make it 1-1 then all objects are flat on all the edges.
A better implementation would be rendering a camera to a render texture and adjust its transform according to the position of the player.
Luckily that kind of script already exists in unity, it is the water pro script.
Here you can find a stripped down version without the unneeded water effects. http://wiki.unity3d.com/index.php/$$anonymous$$irrorReflection3 In there is also a basic shader that will implement the script below. This will give you your desired 'mirror' effect in the puddle shaped mesh.
You can always write an more advanced shader, which I am doing at the moment for making very realistic glass/mirror, only keep in $$anonymous$$d that the texture name in the shader has to be as told in the information from the link.
I did not make that script, but incase anybody reads this in search of an answer, they have it now. :)
Answer by kebrus · Nov 17, 2012 at 03:25 PM
That particular image is probably achieved using different kinds of maps
A diffuse map that tells where the color is: in the puddle you can have the same color as the ground or any other color to get the water a tinting effect in cases the reflecting isn't 100%
A normal map or bump map that creates that 3d effect on the ground: in the puddle water the little rock in the middle as normals pointing in various directions but in the water parts the normal is always point up to make the water plain and the rock sticking out
A reflection map to tells where reflection exists and how strong: this is a black and white map where black means no reflection and white means full reflection and any gray color in between means it's translucent, in the image the puddle has full reflection, but along the edges it's starts to blurs out, notice though that the ground has some reflections here and there to make it look wet
A specular map for different reasons: this one is optional and i don't think that particular image has it because the reflection map usually replaces the specular map, but sometimes this map is used for additional effects like blurring out the reflection or make it shiny (think sweat on a body), i'm not entirely sure on those red and greens lights on the floor being specular maps or not
the reflection is either produced in-engine with a bunch of complicated tricks or you can use cubemaps that mimic and fake a reflection. I would go for the cubemaps
Your answer
Follow this Question
Related Questions
angrybot water shader lagging problem 0 Answers
Subnautica like underwater effect / rays 0 Answers
How can I Control the Strength of the Reflection in the Pro FX Water Shader 4 Answers
2D water shader effect 1 Answer
Unity Water Shadows? 0 Answers