Jump to content

[SOLVED] Water rendering and render_distance_scale


photo

Recommended Posts

Posted

Hello,

We are trying to simulate a short FOV sensor for sea Search and Rescue (SAR) missions in ocean. The camera has a short FOV (a few degrees). Usually, on land, I would simply use render_distance_scale with a value compensating the objects LOD distance settings (usually set for a FOV around 60°).

So typically, I should have this code running in update:

ConsoleVariableVec4 render_distance_scale_fov{ "render_distance_scale_fov", "<scale1 scale2 fov1 fov2> Map FOV scale to Distance scale", false, {1,10,60,6} };

// In update()
const float fov = decomposePerspectiveFov(Game::getPlayer()->getProjection());
float k = inverseLerp(render_distance_scale_fov.get()[2], render_distance_scale_fov.get()[3], fov);
float ds = lerp(render_distance_scale_fov.get()[0], render_distance_scale_fov.get()[1], k);
Render::setDistanceScale(ds);

This works correctly on land, but fails miserably with water in the world because it produces way too much triangles. What would be the correct way to fix this? Thanks.

Posted

Hi Stephane,

Indeed, the ObjectWaterGlobal is not fully ready to direct distance scale changes. Maybe you can mitigate the performance drop by switching to custom water settings and decreasing Geometry Progression values when you change FOV.

You can do it inside Editor as well in Windows -> Settings -> Water -> Geometry -> Preset -> Custom -> Geometry Progression:

image.png

Thanks!

  • Thanks 1

How to submit a good bug report
---
FTP server for test scenes and user uploads:

  • 2 weeks later...
Posted

After further testing, this doesn't seem as a viable option, as it can clearly change the water shape especially with large Beaufort wind conditions. It also breaks in one scenario with extremely narrow FOV (low earth orbit satellite sim).

I think this situation is very similar to the one we encountered with Landscape: both Landscape and Water already account for reduced FOV, so indeed changing render_distance_scale with "large" values and low FOV will not work well. So I would suggest you go with the same strategy as with Landscape, and make Water just ignore render_distance_scale altogether (or at least make it an option).

  • silent changed the title to [SOLVED] Water rendering and render_distance_scale
×
×
  • Create New...