5
\$\begingroup\$

My 2D game has a second camera on the scene that renders an upside down image of the scene and distorts it, giving the effect of water reflection. I render this camera first, and on top of it I render the main camera.

This is working correctly as expected, however, I want to improve it's performance by performing this process in small sections of the scene instead of the whole screen. I created a trigger to detect which items should be turned upside down and rendered.

How can I turn these items and distort them as I did with the whole scene, but only to the GameObjects detected inside the trigger?

Note: I can't assign them to a layer since the layer is already in use.

\$\endgroup\$
2
  • \$\begingroup\$ Have you explored using a GrabPass so that you only need to render the scene once? \$\endgroup\$
    – DMGregory
    Nov 17, 2015 at 15:45
  • \$\begingroup\$ Just use a GrabPass and assign it a name so it only gets rendered once \$\endgroup\$
    – cortvi
    Aug 22, 2017 at 1:01

2 Answers 2

1
\$\begingroup\$

If you are looking for a water effect like the one used in the "Ramboat" game, you need to that use a replica for each image of which you want water reflection and distortion, and then use a raw image in your second camera, with a minimum opacity value.

This gives you an effect, like as follows:

enter image description here

\$\endgroup\$
0
-2
\$\begingroup\$

Inside the trigger : then activate object renderer. Outside the trigger : then deactivate object renderer.

\$\endgroup\$
2
  • \$\begingroup\$ But that will affect my main camera too. Right? \$\endgroup\$
    – Leo
    Mar 20, 2015 at 9:34
  • \$\begingroup\$ right. And.. render the "water" camera to "Target texture". And place the texture on water areas ? (getting lost the trigger management?) \$\endgroup\$ Mar 20, 2015 at 9:55

You must log in to answer this question.

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