Jump to content

LOD does not swap until camera moves


photo

Recommended Posts

We noticed an issue in Unigine 2.13 where sometimes objects become invisible when they are being moved around while the camera stays stationary. I was able to reproduce this in the UnigineEditor as well using the following steps:

  1. Create a new project (empty script only project using 2.13.0.1)
  2. Open editor (note that editor still stays 2.13.0.0, is that right?)
  3. Drag the box (from core/meshes) in the scene
  4. Change 'Max Visibility' from inf to 10 in the surface properties of the box
  5. Use the manipulator to move the box 10 meters from the camera
  6. Move the camera slightly to the left or right using WASD
  7. Use the manipulator to move the box back to the camera
  8. Bug: observe the box not being visible
  9. Again move the camera slightly and notice the box reappearing

If you skip step 6 the bug does not appear, you have to move the camera at least once when the object is past it's max visibility range to trigger the issue. Also rotating the camera does not seem to work, the camera position needs to be moved.

InvisibleBox.jpg

Link to comment

You can patch following files to fix this:

source/engine/objects/Object.h (Line 478):

// old
	Vec3 old_camera;
	float old_idistance_scale;
	int old_alpha_fade;


// fixed
	Vec3 old_camera;
	float old_distance = -1.0f;
	float old_idistance_scale = -1.0f;
	int old_alpha_fade = 0;

source/engine/objects/Object.cpp (void Object::updateLods())

// old
int alpha_fade = engine.render->isAlphaFade();

if (old_camera == camera && old_idistance_scale == idistance_scale && old_alpha_fade == alpha_fade)
	return;
old_camera = camera;
old_idistance_scale = idistance_scale;

if (old_alpha_fade != alpha_fade)
float min_distance = 0.0f;
float max_distance = 0.0f;

// distance to own node
float distance_offset = render_distance_offset.get();
float distance = max(getRenderDistanceValid(camera), 0.0f) + distance_offset;

///////////
// fixed //
int alpha_fade = engine.render->isAlphaFade();

// distance to own node
float distance_offset = render_distance_offset.get();
float distance = max(getRenderDistanceValid(camera), 0.0f) + distance_offset;

if (old_camera == camera && old_distance == distance && old_idistance_scale == idistance_scale && old_alpha_fade == alpha_fade)
	return;
old_camera = camera;
old_distance = distance;
old_idistance_scale = idistance_scale;

if (old_alpha_fade != alpha_fade)
float min_distance = 0.0f;
float max_distance = 0.0f;

Thanks!

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

Link to comment

Fix seems to work perfectly, thanks!

Out of curiosity, since we are transitioning to a non-src SDK, how will fixes like this be provided in the future? Will you provide nightly builds or something like that? Or will there be more hotfix releases?

Link to comment
Quote

will there be more hotfix releases?

As an option - yes, some additional hotfix may be required. This exact behavior was introduced in 2.11 and affects very specific use case, so there is no urgent need to fix this (at least it can be fixed in the next minor update 2.13 -> 2.14).

Thanks!

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

Link to comment
×
×
  • Create New...