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 '15 at 15:45
  • \$\begingroup\$ Just use a GrabPass and assign it a name so it only gets rendered once \$\endgroup\$
    – marsh
    Aug 22 '17 at 1:01
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 '15 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 '15 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.