#ActualStyves

Posted 15 March 2013 - 04:41 AM

This is probably fine.

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. 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.

#1Styves

Posted 15 March 2013 - 04:39 AM

This is probably fine.

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.