top of page
  • 작성자 사진JP Lee

Color variation tech with preventing to increasing draw call how to by old of unity version.

Color variation tech with preventing to increasing draw call how to by old of unity version.

In case tested by Unity3D 5.X

上面的网格,使用了一个Material。

从理论上来看,单个Material有颜色的时候(Property并不需要排列来管理),Draw call 是29。

上面的网格,没有使用Material Property的 _Color,直接把color32信息Mapping到顶点来处理得。

这样的话,不仅颜色可以多变,还可以通过 Static batching来减少Draw call。

这边重要的点是,

不使用Mesh mesh = GetComponent<MeshFilter>().sharedMesh;

会用Mesh mesh = GetComponent<MeshFilter>().mesh; (重要)

sharedMesh的情况,游戏运行之前,因为网格本身已经共用,所以不需要再往各个Mesh 顶点信息单独再输入Vertex Color 。

(结果)





看上图,可以确认所有都是以Static Batching变更为一个网格的。

Draw call 从29 减为 5 

样品代码




Light Map 正常导出确认



为了接收顶点信息的Shader Code




조회수 5회댓글 0개

최근 게시물

전체 보기
bottom of page