Unity3D,围绕盒子的边缘,立方体? [英] Unity3D, round the edges of a box, cube?

查看:48
本文介绍了Unity3D,围绕盒子的边缘,立方体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在立方体(如示例中的矩形对象)上圆角的常用方法是什么?

What's the usual way to round the edges on a cube, a rectangular object as in the examples?

理想的结果看起来与这些图像非常相似.

The ideal result would look pretty much exactly like these images.

(当然,您可以从字面上使用具有仔细圆润的边缘和角落的网格,但需要多次尝试才能实现这一点.)

(Naturally, you could literally use a mesh that has carefully rounded edges and corners, but it takes many tris to achieve that.)

注意,当然对于 NON 着色器方法...

Note, of course for a NON-shader approach...

添加两个小的扁平盒子,然后简单地将新法线放在两侧的中间,即 45 度:

Add two small flat boxes and simply make that new normal halfway, i.e., 45 degrees, between the two sides:

那将被完美地画成圆形......

That would be drawn perfectly round ...

下面的 GDG 提供了一篇文章,其中有人断言,如果不使用着色器方法,这确实是最好的方法.

GDG below has provided an article where someone asserts that this is indeed the best way, if not using a shader approach.

我真的很想知道如何使用着色器来做到这一点.

I'm really wondering how to do this with a shader though.

注意 - 关于非着色器方法的非常详细的教程

Note - incredibly detailed tutorial on the non-shader approach

http://catlikecoding.com/unity/tutorials/rounded-cube/

推荐答案

使用延迟着色,您可以像在 这篇论文.虽然它是一种后处理技术,因此它能够在某些像素的限制内模拟圆度.

Using deferred shading you may access G-buffer to locate and round edges like it done in this paper. Though it is a post-processing technique so it is able to emulate roundness in a limits of some pixels.

简单的平均法线(1 像素宽度):

Simple averaged normals (1 pixel width):

简单的平均法线(2 像素宽度):

Simple averaged normals (2 pixel width):

简单的平均法线(3 像素宽度):

Simple averaged normals (3 pixel width):

这篇关于Unity3D,围绕盒子的边缘,立方体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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