Jump to content

  • Log In with Google      Sign In   
  • Create Account


Multilayer Refraction


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Quat   Members   -  Reputation: 401

Like
0Likes
Like

Posted 14 March 2013 - 05:50 PM

I have multiple overlapping water meshes that use a refraction map.  Right now my engine doesn't support this scenario.  Assuming the geometry does not intersect, one solution I thought of would be just to ping-pong the render target and refraction map, and render the overlapping water features in back-to-front order.  I've ping-ponged buffers before.  Would this be too expensive?  This seems kind of brute force, are there better solutions?

 


-----Quat

Sponsor:

#2 Styves   Members   -  Reputation: 940

Like
0Likes
Like

Posted 15 March 2013 - 04:39 AM

This is probably fine. smile.png

 

You can also try copying the current screen (backbuffer, what have you) to a render target after rendering each water mesh and read that in the water shader for the next mesh - that way you don't need to reset the shader resources and rebind the new ping-ponged buffer for every mesh. You also wouldn't need to worry about which one to copy to the screen when you're doing rendering all the water - it'll be directly rendered to your scene.

 

To save some performance during the copy, you can use scissoring to only copy what's inside the meshes screen space bounding box (using a full screen pass). This'll help speed it up especially if some of your water meshes are viewed from a distance since you won't need to copy the entire screen for every mesh. smile.png If you do it this way you can also get away with tricks like using a downscaled buffer for the refraction map (since ping-ponging requires full res, otherwise you'd end up with some water looking aliased and some not). You can even blur the map during the downscale/copy if you wanted to, or pack the refraction color into a lower bit target (if you're in HDR) and lower memory consumption.


Edited by Styves, 15 March 2013 - 04:41 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS