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

二次信任 提交于 2019-12-10 12:22:41

问题


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?


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/3480161/how-can-i-make-a-boxs-edges-smooth-without-anti-aliasing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!