我必须在Unity中使用网格中的共享顶点吗

我必须在Unity中使用网格中的共享顶点吗

本文介绍了我必须在Unity中使用网格中的共享顶点吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我认为最好的方法是创建三个唯一顶点

我想在Unity3D中创建具有平滑阴影效果的程序生成的横向网格。 / strong>,并使用一个计算的法线作为顶点。构建这个网格会导致多余的顶点位置信息。 (它会影响渲染时间吗?)

无论如何...问题是我想使用着色技术,例如该网格上的环境遮挡。我不想搞乱Unity3D期望着色器的网格拓扑结构。



创建具有共享顶点的网格,添加一个自定义顶点属性,例如'flat_normal'并自定义着色器使用它?

解决方案

简单的答案是

不,



Unity丝毫没有寻找共享顶点。 3D管道与共享vert没有任何关系。共享垂直根本无助于或阻碍3D管道。

(很多时候,例如当我们制作动态网格时,我们只是从不使用共享顶点因为,正如你可能已经发现的那样,不是使用共享vert通常简单得多。)



唯一的原因是使用共享顶点是出于某种原因,如果它恰巧使它更方便。在这种情况下,3D流水线(Unity或其他地方)允许共享垂直,没有缺点。

I want to create procedurally generated landscape meshes with a flat shaded look in Unity3D.

I thought it would be the best to create three unique vertices per triangle and use one calculated normal for the vertices. Building this mesh would lead to redundant vertex position information. (Would it have an impact on render time?)

Anyway... the problem is that I would like to use shading techniques e.g. ambient occlusion on this mesh. I don't want to mess up the mesh topology that Unity3D expects for its shaders.

Is it better to create the meshwith shared vertices, add perhaps a custom vertex attribute e.g. 'flat_normal' and customize the shaders to use this?

解决方案

The simple answer is

No,

Unity does not, in the slightest, "look for" shared verts. No 3D pipeline has anything to do with shared verts. Shared verts does not help or hinder the 3D pipeline in anyway at all.

(Very often, when for example we are making dynamic mesh, we just "never use shared verts at all" because, as you have probably found, it's often far simpler to not use shared verts.)

The one and only reason to use shared verts is if, for some reason, it happens to make it more convenient for you. In that case the 3D pipeline (Unity or elsewhere) "allows" shared verts, with no downside.

这篇关于我必须在Unity中使用网格中的共享顶点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 01:21