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 are the factors that affect the rendering order in Unity

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly introduces the factors that affect the rendering order in Unity. It is very detailed and has a certain reference value. Friends who are interested must finish reading it!

1. Camera Depth

For the camera depth set on the camera component, the greater the depth, the lower the rendering.

2. Separation of transparent and opaque objects

RenderQueue 2500 is a watershed between transparency and opacity.

Under the same camera

Objects with Renderqueue less than 2500 are always drawn before Renderqueue is greater than 2500.

III. Sorting Layer

Visible in Tags & Layers settings

If the Camera is the same, then look at the Sorting Layers, the lower the earlier the drawing.

Sorting Layers is set through the sortingLayerName property of Renderer.

Global Soring Layers is set in Edit- > ProjectSettings- > Tags&Layers

You can set the sortinglayer of an object by setting the render.sortingLayerName= "Effect" runtime through the code. If you look at it in the particle system, you can see that the Sorting Layers drop-down form of the Render item lists the names of all Sorting Layers.

IV. Order In Layer

Compared to the suborder of Sorting Layer, the comparison with this value is valid only if it is all at the same level.

SoringOrder is also an attribute of Render. This order sets a number. The larger the number, the more it is displayed on it.

5. RenderQueue

The "Queue" set for Tags in Shader.

If the above items are all the same, it depends on renderQueue. RenderQueure is an attribute of Material, which is actually renderQueue in Shader. This is also an int attribute. The smaller the value, the more forward the rendering.

After Unity5, the renderq parameter can be set in each material.

Sixth, depth sorting. Sort by the depth of the bounding box

Opaque objects are sorted first from near to far

Transparent objects are sorted first from far to near

Sort by the depth of the center point of the bounding box.

Deep tween

ZBias, when two objects with the same or very close depth at the center of the bounding box are together, the sorting may go wrong (not necessarily which comes first), so the z value of this point can be fine-tuned. Modify the outline or moving position of the object. )

Summary of figure 1: regular solutions are clearly layered:

For example, if the translucency (special effects, patches) on UI is always above the 3D scene, it is generally drawn by multiple cameras.

Most of them are suitable for games with clear layering. For example, horizontal version of the game, clear close-range vision

Objects with large fill rates, such as terrain, sky, etc., are usually drawn in delayed batches in order to increase the depth.

Draw character before the terrain.

UGUI scheme

The same canvas, the order in which Hierarchy is used

Use sort order to sort between different canvas

NGUI

Different pannel are sorted by depth value, and nodes in the same pannel are sorted by depth.

The above is all the contents of the article "what are the factors that affect the rendering order in Unity". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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

Internet Technology

Wechat

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

12
Report