- Computational geometry studies mathematical descriptions of surfaces.
- Point clouds are not commonly used to encode objects because they require too many resources.
- Object geometry encodings use mathematical models with parameters.
- Various approaches have been developed, including:
- Meshes
- Hermite surfaces
- NURBS
- HSS
- Metaballs
- Face: a polygon that represents a planar surface on an object.
- Edge: a side of a polygon; often where two faces intersect.
- Vertex: the starting and ending point of an edge, where at least three faces come together in a solid object.
- Triangle: three unaligned points identify a unique plane and a triangle.
- Mesh: a set of adjacent triangles
Meshes are encoded based on a set of vertices that help the rendering engine to determine the end points of the triangles forming the mesh. Different types of mesh encoding have been defined in the literature. However, in Vulkan, only two of them are standard:
-
Triangle Lists: three different coordinates and do not reuse any vertex. Used with triangles which are not connected. to encode
$N$ triangles are necessary$3N$ vertices. -
Triangle Strips: set of adjacent triangles that define a band-like surface. A simple rule: each new vertex is connected to the previous two.
$N+2$ vertices are required to encode$N$ triangles.
Triangle strips save up to
Indexed primitives are expressed with two different sets: vertex set and triangles sets. In the triangles set the vertex declaration are not repeated, but there are just the index associated with that vertices (in the first set)
Indexed primitives have two sets:
- vertex set
- triangle set
The triangle set uses indices instead of vertex declarations to avoid duplicate vertex information.
The two main types of wireframe meshes encoding are:
- Line Lists: encode each segment as a couple of two vertices. To encode
$N$ segments,$2N$ vertices are required. - Line Strips: encode a path of connected vertices.
$N$ segments,$N+1$ vertices are required.
In addition, Vulkan also allows to draw standard objects using only the contour of their triangles: this is the technique used in the assignments to create the wireframe images against which the filled one should be matched.
Rendering creates the illusion of illumination using light sources and the surface features of 3D objects. Some physical background:
-
Energy (expressed in Joules
$J$ ) measures the total light emitted by a surface in all the directions during a time interval. -
Power (measured in Watts
$W = J \cdot s^{-1}$ ) is the instantaneous light energy (emitted by a surface in all the directions in a given time instant). -
Irradiance is the fraction of power emitted by a point of a surface (in a given time instant). It is measured in
$\frac{W}{m^2}$ . -
Radiance measures the energy emitted in a given time instant from a point of a surface in a given direction. It is measured in
$\frac{W}{m^2 \cdot sr}$ .$sr$ are steradians: the unit of measure for the solid-angle.
Rendering basically it's the process which determines radiance received in each point (each pixel) of projection plane based on direction of corresponding projection ray.
Bidirectional Reflectance Distribution Function simulates material properties.
The function tells how much irradiance from the incoming angle, is reflected to an outgoing angle. It's called "bidirectional" since the value of function remains unchanged if ingoing and outgoing directions are swapped. Energy is conservated means that the BRDF cannot increase the total irradiance that leaves a point on a surface. BRDF implies conservation of energy: it cannot increase the total irradiance leaving a point on a surface.
https://developer.nvidia.com/gpugems/gpugems/part-iii-materials/chapter-18-spatial-brdfs
The BRDF allows relating together the irradiance in all the directions for all the points of the objects composing a scene. This relation is called the rendering equation:
The integral also includes other points of the same object to allow the computation of effects such as self-shadowing or selfreflection.
Rendering equation's incognita is
Note that the rendering equation is repeated for every wavelength
Rendering equation computes reflections, shadows, matte and glossy materials but cannot simulate gases or transparent objects like glass and water. The BDRF and the rendering equations have been extended:
- BTDF: Bidirectional Transmittance Distribution Function
- Bidirectional Scattering Distribution Function: usually the angles for the BRDF and BTDF do not overlap, they are included in a single function.
- BSSRDF: Bidirectional surface reflectance distribution function: the rendering equation now integrates over all the points of an object to compute the quantity of lights that exits from a give position.
Rendering equations are complex to solve and require advanced discretization techniques. However, there are simpler approximations to the rendering equation that give good results with reasonable complexity. Vulkan supports some of these techniques with specific types of pipelines. Techniques for approximating the rendering equation:
- Scan-line rendering
- Ray casting
- Ray tracing
- Radiosity
- Montecarlo techniques
These techniques are closely related to the types that implement them. For example, as it has already been outlined, in Vulkan they are:
Graphic pipelines • Ray-tracing pipelines • Mesh Shading pipelines • Compute pipelinesGraphic pipelines • Ray-tracing pipelines • Mesh Shading pipelines • Compute pipelines
Graphic pipelines:
- Series of stages that transform 3D data to 2D screen space
- Consist of vertex processing, primitive assembly, rasterization and pixel processing
- Used for real-time rendering
Ray-tracing pipelines:
- Based on simulating the physical behavior of light
- Can produce highly realistic images with accurate shadows, reflections and refractions
- Require significant computational power and are therefore usually rendered offline
Mesh Shading pipelines:
- New pipeline introduced in modern graphics APIs
- Allows efficient processing of large numbers of geometric primitives
- Ideal for complex scenes with many objects
Compute pipelines:
- Used for general purpose computations on the GPU
- Can be used for tasks such as physics simulations, machine learning, and post processing effects
- Provide significant performance improvements over traditional CPU-based computation
To create an image on screen from mesh data, we follow a sequence of operations called a Pipeline. The Pipeline is similar in Vulkan, OpenGL, Metal, and Microsoft DirectX 12.
The actions taken in each stage of the pipeline can be either fixed by Vulkan or programmed. Algorithms running in the programmable stages of the pipeline are called Shaders. Vulkan versions support four pipeline types:
- Graphic pipelines
- Ray-tracing pipelines
- Mesh shading pipelines
- Compute pipelines
Shaders are written in high level languages, such as:
- GLSL (openGL Shading Language)
- HLSL (High Level Shading Language
Both languages can be used in Vulkan. The Standard, Portable Intermediate Representation - V (SPIR-V) is an intermediate language for defining shaders.
Each shader is compiled a shader into SPIR-V