Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the flow of the Unity rendering pipeline

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces the relevant knowledge of "how the Unity rendering pipeline process is". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The following figure is a rendering flowchart from the book getting started with Unity Shader.

ApplicationStage phase: prepare scene information (scene body, camera parameters), coarse-grained culling, and define rendering commands for each model (material, shader)-- defined by the developer without discussion

GemetryStage phase: Vertex shader, surface subdivision shader, geometric shader, cropping, screen mapping

RasterizerStage stage: triangle setting traversal, slice element shader, piece by piece operation

The specific operation of each stage is as follows (dotted frame is an optional stage):

Model space-matrix transformation-homogeneous clipping space-perspective division-NDC standard equipment coordinates-screen mapping

The homogeneous cutting space is the visual body space (platform body).

CVV: standard visual volume-that is, the space corresponding to the NDC coordinate system

Perspective division: the vertex coordinates are divided by the w component, and the section in which the current z depth is located is scaled to the cross section coordinate (2); so the w component records the z depth information.

The hardware does perspective division to obtain the NDC normalized device coordinates-- and then obtains the vertex coordinates under the screen coordinate system through screen mapping.

Unity uses the NDC,z component of OpenGL in [- 1]

Differences between OpenGL and DirectX

NDC space-- OpenGL is [- 1), DirectX is [0], and the depth z range is different.

Window coordinate system-the origin of the upper left corner of DirectX and the origin of the lower left corner of OpenGL

Projection plane-- the DirectX projection plane is the near section of the visual body, and the OpenGL has a visual plane.

Left-handed and right-handed coordinate system-- DirectX left-handed, OpenGL right-handed, cross order

Question:

Why are the pieces not called pixels?

A slice is a collection of many states, recording the screen coordinates, depth information, normals, UV, etc., of the pixel.

Why does DrawCall affect performance?

DrawCall is the process by which CPU adds rendering commands to GPU. During the process, CPU sends data (model information) to GPU. The more times of DrawCall, the greater the performance of CPU. Too many times of DrawCall will cause the CPU not to send all the data to GPU rendering in time for each frame.

GPU has a command cache (Command Buffer), where CPU's rendering commands are stored. GPU executes rendering commands from the command cache in turn.

Two rendering commands: render model (CPU submits model information that is DrawCall) and change render state (shader texture state changes, which is more time-consuming)

In general, GPU rendering is completed, waiting for CPU to issue a rendering command.

This is the end of the content of "how the Unity rendering pipeline process is". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report