I am using distance fade to smoothly change LODs.
In fact, I tried scaling objects, which also gives the effect of disappearing shadows.
if( INSTANCE_CUSTOM.r == 1.0 ) //LOD ID
{
scale = clamp(smoothstep( 60.0, 40.0, fade_distance ), 0.0, 1.0);
}
VERTEX = (VERTEX - world_obj_pos) * scale + world_obj_pos;
//___________________________________________
OR
//___________________________________________
int x = int(FRAGCOORD.x) % 4;
int y = int(FRAGCOORD.y) % 4;
int index = x + y * 4;
const float limits [16] = {0.0625, 0.5625, 0.1875, 0.6875, 0.8125, 0.3125, 0.9375, 0.4375, 0.25, 0.75, 0.125, 0.625, 1.0, 0.5, 0.875, 0.375};
float limit = limits[index];
float fade_distance = abs((INV_CAMERA_MATRIX * WORLD_MATRIX[3]).z);
float fade = clamp( smoothstep( 49.0, 50.0, fade_distance), 0.0, 1.0);
What am I doing wrong? Please, help))