3
\$\begingroup\$

I've been working on a simple game with semi-realistic water. I followed some tutorials to get:

  • a flat water surface
  • reflection and refraction (blended using fresnel term)
  • ripples using a bump/normal map

Next step, I created a mesh to form actual waves. I'm animating it, and it looks great (for my intents and purposes).

Normally, to get the reflection, I would render everything on a second camera, which is actually the normal camera, but mirrored over the water plane, like in the image below: Reflection explained

Then, just sample that camera's output to find the reflected color. Obviously, this technique doesn't work if the water level isn't consistent. In other words, with an animated mesh, this looks terrible.

Can anybody suggest a different way to implement reflections? Or show a workaround method?

\$\endgroup\$
6
  • \$\begingroup\$ rendering the camera B on the water mesh texture? \$\endgroup\$ Aug 17, 2015 at 11:38
  • \$\begingroup\$ Could you explain? I don't understand how that would work. \$\endgroup\$
    – Peethor
    Aug 17, 2015 at 11:52
  • \$\begingroup\$ Sorry , i thinked of Unity, where you can render a camera output into a texture \$\endgroup\$ Aug 17, 2015 at 12:01
  • \$\begingroup\$ Maybe you could use a cubemap. \$\endgroup\$
    – Ocelot
    Aug 17, 2015 at 12:28
  • \$\begingroup\$ I've looked into cubemaps, but it seems like that would only work for a single point or a relatively small 3d object around said point. As far as I can tell, cubemaps dont work for planar surfaces. \$\endgroup\$
    – Peethor
    Aug 17, 2015 at 13:19

1 Answer 1

1
\$\begingroup\$

For future reference: I solved this problem by mirroring everything over the local waterheight instead of a plane. I rendered all that using the standard camera.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .