How can I calculate by what scale a billboard is getting reduced at a given distance from camera when scaleByDistance is set? I am trying to calculate if some billboards are over lapping in the current camera view. I have scaleByDistance set at NearFarScalar(1.0e6, 1.0, 5.0e7, 0.0) and I am trying to find out by what factor I should reduce width/height of a billboard to calculate the space it is occupying in the current view.
> How can I calculate by what scale a billboard is getting reduced at a
> given distance from camera when scaleByDistance is set? I am trying to
> calculate if some billboards are over lapping in the current camera
> view. I have scaleByDistance set at NearFarScalar(1.0e6, 1.0, 5.0e7,
> 0.0) and I am trying to find out by what factor I should reduce
> width/height of a billboard to calculate the space it is occupying in
> the current view.
the scale change is non-linear and calculated as:
t = [(distance^2 - near^2)/(far^2 - near^2)]^0.2
t = clamp(t, 0, 1);
scale = nearValue*(1.0-t) + farValue*t;
See
Source/Shaders/BuiltIn/Functions/nearFarScalar.glsl