我怎样才能让一个盒子的边缘光滑无抗锯齿?光滑、盒子、边缘、抗锯齿

2023-09-08 01:13:50 作者:夢醒ぴ誮落盡

我创建一个骰子游戏的iPhone。我使用的是SiO2为引擎,但我​​认为这个问题是比较普遍的OpenGL相关。

由于iPhone缺乏对抗锯齿的支持,我的骰子看起来种尖锐的。如果可能的话,我想提出的模圆角边缘和平滑,而不是尖锐的。我发现一个应用程序,的MotionX,它成功地做到这一点,我认为不使用抗锯齿。见截图这里。如果你仔细观察骰子的边缘,你看到有从灯火通明的顶面的阴影侧面浮动过渡。这看起来种轮从很远。

有谁知道如何重现这样的效果?

解决方案   

如果你仔细观察骰子的边缘,你看有来自灯火通明顶面的浮动过渡到阴影侧面

不知道,如果iPhone支持这一点,但您可能能够达到这种效果了法线贴图:

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

当然,你需要截断角落,让他们充分全面,以至于正常的地图将让你的方式休息。

芒果自主OS的牛奶盒子,能否唤醒边缘徘徊的互联网电视盒子

I'm creating a dice game for the iPhone. I'm using SIO2 as engine, but I think this question is more general OpenGL-related.

Since the iPhone lacks support for anti-aliasing, my dice looks kind of edgy. 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. 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?

解决方案

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:

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.