问题描述
在示例中,将立方体的矩形上的边缘圆角的常用方法是什么?
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,圆框的边缘,立方体吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!