Unity Transparent Material Batch

Source: Internet
Author: User

NO Batch?

There are a lot of examples in the game scene, the pressure of the drallcall is very large, but after a walk through the discovery, why the same particle effects are not merged, why? After a lot of testing, I found that if the transparent material is modified to be non-translucent, it can be merged, which makes me very strange? Unity provides the ability to dynamically merge materials, though with a lot of limitations, unity seems to give a very iffy answer to the merging of transparent materials:

Semitransparent shaders most often require objects to being rendered in back-to-front order for transparency to work. Unity first Orders objects in this order, and then tries to batch them-but because the order must be strictly satisfied, This often means less batching can is achieved than with opaque objects.

This Nima equals not to say .... But the reason is clear: transparent material transparent material

The test found:

1 particles with transparent material if the depth is completely separated, then the same material based on can be merged

2 The rendering order of different transparent materials can be merged completely or separately

Transparent materials use alpha blend to render from backward to camera distance, and if you render a particle with the same depth and render order, unity may render completely in a disorderly manner. However, after modifying the depth or render order, the particles of the same material may be rendered in the adjacent order. This means that objects with the same material need to be merged in an adjacent render queue. The idea is clear, and only the order or depth of the particles should be sorted properly.

Render Order

Particles are generally put together, modify the depth may not be too realistic, the art of the sister is not happy, that OK, can only modify the rendering order, there are two situations:

(1) Different shader materials can be defined directly in the shader Renderqueue, Renderqueue can view the official Unity definition: http://docs.unity3d.com/Manual/SL-SubShaderTags.html. Generally the transparent material is starting from 3000, when rendering this value from small to large rendering ( before the art of rendering order all in thefirst).

(2) Same shader different stickers: I can't do this, I can only modify it with the debug mode in the Unity Properties panel

After the scene processing, the different material uses the unused rendering order, the particle's drallcall can completely merge.

Some thoughts (1) rendering order problem in scene

In fact, Unity has divided the objects in the scene into different types, such as, but in use still need to pay much attention. It is best to categorize the rendering order that might be used in the scene at the beginning of the project.

(2) Transparency cross-rendering (OIT)

Particles are smaller, so there may be no cross-rendering problems, but for transparent objects, the alpha blend mode needs to be rendered backwards from the back, which can be cumbersome if there is a transparent object crossing. Such as:

Please refer to this article for specific details

http://blog.csdn.net/candycat1992/article/details/41599167

For transparent rendering unrelated to sorting, refer to:

Https://developer.nvidia.com/content/transparency-or-translucency-rendering

Http://www.cnblogs.com/wubugui/p/5099418.html

Unity Transparent Material Batch

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.