简体   繁体   English

如何在不使用抗锯齿的情况下使盒子的边缘光滑?

[英]How can I make a box's edges smooth without anti-aliasing?

I'm creating a dice game for the iPhone. 我正在为iPhone创建骰子游戏。 I'm using SIO2 as engine, but I think this question is more general OpenGL-related. 我使用SIO2作为引擎,但是我认为这个问题与OpenGL有关。

Since the iPhone lacks support for anti-aliasing, my dice looks kind of edgy. 由于iPhone不支持抗锯齿功能,因此我的骰子看起来有些前卫。 If possible, I'd like to make the edges of the die rounded and smooth instead of sharp. 如果可能的话,我想使模具的边缘变圆且光滑而不是锐利。 I've found one app, MotionX, that manages to do this, and I think without using anti-aliasing. 我找到了一个可以成功做到这一点的应用程序MotionX,而且我认为无需使用抗锯齿功能。 See screenshot here . 在这里查看截图。 If you look closely at the dice edges, you see there is a floating transition from the brightly lit top face to the shadowed side face. 如果仔细观察骰子边缘,您会发现从明亮的顶面到阴影的侧面有一个浮动过渡。 This looks kind of round from far away. 这看起来很遥远。

Does anyone know how to recreate such an effect? 有谁知道如何重现这种效果?

You need to create the dice with slightly rounded edges and corners. 您需要创建带有稍微圆滑的边缘和角落的骰子。 That way there won't be a sharp transition between each face. 这样一来,每张脸之间就不会出现急剧的过渡。

If your modelling package can create them you could use Superquadrics to create this sort of model. 如果您的建模包可以创建它们,则可以使用Superquadrics创建此类模型。 You can change the parameters of the equation to produce the effect. 您可以更改方程式的参数以产生效果。

See the top left figure on this image 参见此图像的左上图

替代文字
(source: free-online.co.uk ) (来源: free-online.co.uk

If you look closely at the dice edges, you see there is a floating transition from the brightly lit top face to the shadowed side face 如果仔细观察骰子边缘,您会发现从明亮的顶面到阴影的侧面有一个浮动过渡

Not sure if the iPhone supports this, but you may be able to achieve this effect with a normal map: 不确定iPhone是否支持此功能,但是您可以通过法线贴图实现此效果:

http://en.wikipedia.org/wiki/Normal_mapping http://en.wikipedia.org/wiki/Normal_mapping

Of course, you'll need to truncate the corners to get them sufficiently round enough that the normal map will get you the rest of the way. 当然,您需要截断拐角以使它们足够圆,以至于法线贴图将为您提供余下的一切。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM