Minimum texture size estimation

W. Pasman
Revision, 14/11/2001

Overview of calculations

We estimate required texture size at near and far distances
and then we glue them together with a correction factor t0 on the near estimate

Estimation at large distances

FarTextureSize is required number of pixels at large distances
Uses rough estimate based on target distortion, distance and radius of object
Distortion is in 1/rad.
We assume that at large distances only the front side is required (REMOVED factor 2 from previous versions).
Minimum distance where this formula will be used is distance=MinDis.

FarTextureSize[r_, distance_, 
          Distortion_] := (((2  ArcTan[r/distance]/Distortion))^2);

Estimation at small distances

Clear[θ]

ScanArea estimates how large an area the observer can scan from nearby
given his speed, time and object radius
This is a simple version, convenient for following calculations but not checking whether more than the whole is scanned.
Better version follows later.

Integrate[
      2 π (r^2) Sin[θ], {θ, 0, 
        dnear/(r + MinDistance)}]

ScanArea[dnear_, r_, MinDistance_] := 
        2 π (r^2) (1 - 
              Cos[(dnear/(MinDistance + r))]);

ScanPixels estimates how many pixels the observer can scan from nearby, given his speed, time and object radius
see ScanArea.

ScanPixels[dnear_, r_, MinDistance_, Distortion_] := 
        ScanArea[dnear, r, 
            MinDistance]/(((MinDistance Tan[Distortion]))^2);

VisPixels is same as ScanPixels but adds a correction factor d0[...] to correct for pixels that are not straight under the observer but which he might nevertheless see.We will use these factor to'glue' together the near-distance estimate'ScanArea' and the large-distance estimate'FarTextureSize'.

Clear[d0]

VisPixels[dnear_, r_, MinDistance_, Distortion_] := 
        ScanPixels[dnear + d0[dnear, r, MinDistance, Distortion], r, 
          MinDistance, Distortion];

Estimation of the correction factor d0

d0 is determined so that both formulas give same value
at minimum distance where FarTextureSize formula can be used.

VisPixels[0, r, MinDistance, Distortion] == 
      FarTextureSize[r, MinDistance, Distortion]

Simplify[
      Solve[VisPixels[0, r, MinDistance, Distortion] == 
          FarTextureSize[r, MinDistance, Distortion], 
        d0[0, r, MinDistance, Distortion]]]

d0[dnear_, r_, MinDistance_, 
          Distortion_] := (MinDistance + r) ArcCos[
            1 - ((2 (MinDistance^2) ArcTan[(r/MinDistance)]^2 Tan[Distortion]^2)/((Distortion^2) π (r^2)))];

Integrating the results

Limit ScanArea - you can never scan more than the whole = 4 π (r^2).That is, (dnear/(2 π (MinDistance + r))) < π

ScanArea[dnear_, r_, MinDistance_] := 
If[
        (dnear/(MinDistance + r)) < π, 
        2 π (r^2) (1 - Cos[(dnear/(MinDistance + r))]), 
        4.  π (r^2)]

Plot[ScanArea[d, 5, 0], {d, 0, 16}]

Plot[VisPixels[d, 5,  .1,  .004], {d, 0, 16}]

Glue the near and far estimates, using the estimated d0. Tnear is remaining time that observer could spend close to object.Our choice of d0 should glue the near and far estimates seamlessly together.W=total walkabke distance=vT and dnear=W-(distance-MinDist).

TextureSize[r_, distance_, W_, Distortion_, MinDistance_] := 
        If[W > distance - 
              MinDistance   ,  
          VisPixels[W - (distance - MinDistance), r, MinDistance, 
            Distortion],  
          FarTextureSize[r, distance - W, Distortion]];

This is the final complete formula

TexSize[r_, distance_, T_, Distortion_, MinDistance_, ObsSpeed_] := 
        TextureSize[r, distance, T ObsSpeed, Distortion, 
          MinDistance];

Picture of the result

<< Graphics`Graphics`

There is no LogPlot3D function but we use the log ticks

\(Plot3D[
      Log[10, TexSize[ .5, d, 
          T,  .004\  (*distortion*) ,  .2 (*mindist*) ,  .7 (*obsspeed*) ]], {d, 1, 4}, {T, 1, 
        4}, 
AxesLabel -> {"d", "t", "texsize"}, 
ViewPoint -> {2.377, \ 1.842, \ 1.551}, 
      PlotRange -> {4, 7}, 
      Ticks -> {Automatic, Automatic, 
          LogScale[4, 7]}
]\)

Export["bla.eps", %];

\(Rough\ check . \ sphere\ of\ 0.5  
        m\ has\ area\ of\ 4  π\ \((0.5)\)\^2 = \(π . 
Looking\ at\ distance\ of\ 0.2  
          m\ and\ target\ distortion\ of\ 0.004\ rad\ gives\ us\ pixel\ width\ x\ with\ x/0.2 = tan0  .004\)\)
or x = 0.2 tan0  .004 .  
            The area of each pixel is the square of this :  A = 
        (x^2) .  So for the total sphere we need π/A

π/((( .2 Tan[ .004]))^2)

This looks about right with the asymptote of the above curve.