Dynamic Imposter

We implemented Imposter Rendering, it makes us to render 10K+ animating objects with quads.

But as you might noticed, there’s one problem in this method.

Since we only have one camera view angle,

We can only render front face of the object.

So, we need to implement additional camera view angles.

I will put 7 more cameras, and place these to facing toward to the animating object.

Front Camera, Left-Front Camera, Left Camera, Left-Back Camera, Back Camera, Right-Back Camera, Right Camera, Right-Front Camera

We can capture animating object in various angles with using these cameras.

Also, need to include additional framebuffers for capturing.

Previous camera status

New cameras status

Now we have captures of object in various angles.

We need to calculate angles between billboard objects and camera position.

I utilized compute shader to calculate those, and return which camera index that the object should use.

For the angle compute, we can get with dot product, since result of dot product contains cosine angle value, we can get angle by using arc cosine function.

Then, we convert radian to degree

If the angle is between 0f ~ 22.5f, means front view of object should display.

If angle is in 157.5f ~ 180.f, means back side of object should display.

In my camera indexing, 0 is front view camera, and 1 is back view camera, so return those numbers.

Then, we need to know whether object is in left side or right side.

We can decide that with cross product.

Since our object’s y position is fixed, we can decide whether left or right side with cross result’s y value.

boDirection : object facing direction.

boPos : object position.

If result.y is below than 0, means object is left side of camera.

If not, object is right side of camera.

Looks good!