In computer graphics you often want to know how big an object looks on the screen, whether under OpenGL, DirectX, ... !
A simple way to obtain an upper bound on pixel coverage is to embed an object in a bounding box, such as a sphere, and then simply rasterize the sphere or box to determine the number of pixels. This leads to increased performance and better rendering in 3D!
This requires complexity in the 3D engine and likely delays processing, as the result is slow. Modern hardware allows for conditional rendering, but the technique can still only be applied in certain cases. For example, it would be useful if a 3D tessellation or geometry were able to spontaneously tessellate or omit tree leaves based on the object's pixel coverage!
Contents:
1.) ... A simple example with 3D spheres!
2.) ... An example with 3D spheres/cubes!
3.) ... WebGL planar and perspective projection mapping!
1.) A simple example with 3D spheres!
Here you will find a simple and elective solution: ►► https://www.shadertoy.com/view/XdBGzdPS:
Of course, this whole thing needs to be thought through further in order to develop its full advantages on the corresponding 3D engine!
(Image-1) Spherical projection, with OpenGL and calculations! |
![]() |
Info:
Spheres in 3D space become ellipses when projected onto the camera's view plane. In fact, these ellipses can be analytically determined from the camera parameters and sphere geometry, allowing their precise position, orientation, and surface area to be calculated. This means that, given a sphere and a camera and buffer resolution, there is an analytical formula that specifies the number of pixels covered by a sphere in the image. This can be very useful for implementing LOD for objects based on their on-screen size (think of trees, vegetation, characters, or other complex objects).
Spheres in 3D space become ellipses when projected onto the camera's view plane. In fact, these ellipses can be analytically determined from the camera parameters and sphere geometry, allowing their precise position, orientation, and surface area to be calculated. This means that, given a sphere and a camera and buffer resolution, there is an analytical formula that specifies the number of pixels covered by a sphere in the image. This can be very useful for implementing LOD for objects based on their on-screen size (think of trees, vegetation, characters, or other complex objects).

2.) An example with 3D balls / cubes!
Here is a second example to understand the projection:
►►► https://www.shadertoy.com/view/WtfGW2
(Image-2) Spherical projection, and 3D cube! |
![]() |

3.) WebGL planar and perspective projection mapping!
Projection mapping is the process of "projecting" an image in the same sense as pointing a movie projector at a screen and projecting a film onto it. A movie projector projects a perspective plane. The farther the screen is from the projector, the larger the image becomes. If you tilt the screen so that it is not perpendicular to the movie projector, the result would be a trapezoid or any quadrilateral.
You can learn about this in a fun way here:
►► https://webglfundamentals.org/webgl/lessons/webgl-planar-projection-mapping.html
(Image-3) Projection, with OpenGL and calculations! |
![]() |
