Rendering Pipeline in Unity by Ahmed Schrute

Rendering Pipeline In Unity

Ahmed Schrute
Shader Coding in Unity from a to z
4 min readNov 7, 2019

--

Introduction to Rendering Pipeline in Unity

Overview of Rendering in Unity3d
Rendering Vs Drawing
Rendering Vs Drawing, Source: Wikipedia

Rendering

Rendering is the process of drawing a scene on the computer screen.

Rendering involves a combination of geometry calculations, textures, surface treatments, the viewer’s perspective, and lighting.

The rendering pipeline is the process of transforming all of these data into the virtual environment on the screen.

Rendering Pipeline consists of:

Rendering Pipe Line in Unity
Rendering Pipe Line

Application (CPU work happening in the background)

CPU Input to the GPU, where Geometry and Rasterization will take place, Source: Wikipedia
CPU Input to the GPU, where Geometry and Rasterization will take place, Source: Wikipedia

In the Application Phase, you are giving instructions for handling Geometry and Rasterization. This phase affects Geometry and Rasterization.

for example, triggering post-processing effects to signal a collision will have Rasterization.

Geometry

Creating 3d and 2d models using the mesh data and simulating the virtual world with its dimensions.

Creation of Models using Mesh Data, Source: Wikipedia

It includes calculations about the position of the camera and transformation, rotation and scaling of the virtual world.

Rasterization or (Rasterisation)

Since our screens are 2D, Rasterization is how the Geometry (3D & 2D) will be drawn on our 2D screen.

Rasterization is converting an image from vector graphics format to raster image(ser image)
Rasterization is converting an image from vector graphics format to a raster image(pixeled image), Source: ShichenLiu

Rasterization is where we process the virtual environment several times through different filters then output the result on the screen.

Post-processing effects: Effects that happen to the 2d version of the objects (Screen model) not the 3d model (Geometry Model)

Rendering Processes:

  1. Geometry

Mesh data are collected (Vertices Array, Normals Array, Triangle Array and UV Array)

Mesh Data collected in Unity to create 3d Models
Stanford Bunny Mesh, Source: http://watkins.cs.queensu.ca/

2.Illumination (Models are colored and lit)

In the Illumination stage also we add lighting effects to the virtual world

Using different lighting models we lit our objects

Using different inputs(textures, normal maps … ,etc.) we color objects in the virtual world.

Stanford Bunny Texture, Source: ALICE project-team
After Adding texture to the Stanford Bunny
Using Uv arrays from Mesh Data to map a texture on the Stanford Bunny, Source: Reddit

3. Viewer’s Perspective (Camera Input)

Before rendering the environment on the screen we consider the camera input such as (field of view, Projection Mode[Orthographic or Prespective])

4.Clipping

(Remove objects outside of the Camera View)

Screen Space Projection using clipping planes, Source: LearnOpenGL

5. Screen space Projection

(Projection of 3d Environment on the 2d screen model)

Source: Scratchapixel

6.Adding post-processing effects

Those are the effects we add to the 2D image just before Displaying the final output on the screen

Depth of field is a post-processing effect applied to the 2D final image
Depth of field is a post-processing effect applied to the 2D final image, Source: Bart Wronski
Bloom is a post-processing effect applied to the 2D final image
Bloom is a post-processing effect applied to the 2D final image, Source: GamersNexus

7. Display

Finally, we renderer our scene.

This was a macroscopic look of the rendering line processes in Unity, it provides an inside perspective about the rendering pipeline and the work done by lots of magnificent engineers to help us create better apps and tools.

Mesh Anatomy In Unity https://medium.com/shader-coding-in-unity-from-a-to-z/understanding-mesh-anatomy-in-unity-2507cb1ae011

I am currently looking for a Unity Dev job (Remote or in the Bay Area).

If you know someone who can help, my email is ah1053@stanford.edu

--

--