我必须在 Unity 的网格中使用共享顶点吗? [英] Do I have to use shared vertices in mesh in Unity?

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

问题描述

我想在 Unity3D 中创建具有平面阴影外观的程序生成的景观网格.

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?)

无论如何...问题是我想使用着色技术,例如此网格上的环境光遮挡.我不想弄乱 Unity3D 为其着色器所期望的网格拓扑.

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.

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

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?

推荐答案

简单的答案是

Unity 丝毫没有寻找"共享顶点没有任何 3D 管道与共享顶点有关.共享顶点根本不会帮助或阻碍 3D 管道.

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.)

使用共享顶点的唯一原因是,出于某种原因,它碰巧让您更方便.在那种情况下,3D 管道(Unity 或其他地方)允许"共享顶点,没有缺点.

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 的网格中使用共享顶点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆