Unity3D, round the edges of a box, cube?

后端 未结 3 517
伪装坚强ぢ
伪装坚强ぢ 2020-12-31 22:28

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

\"enter

相关标签:
3条回答
  • 2020-12-31 23:05

    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.

    enter image description here

    Simple averaged normals (1 pixel width):

    enter image description here

    Simple averaged normals (2 pixel width):

    enter image description here

    Simple averaged normals (3 pixel width):

    enter image description here

    0 讨论(0)
  • 2020-12-31 23:05

    We were able to accomplish beveled cubes for our game WorldToBuild. The key is really that you can go ahead and make the beveled model, then just move the vertices in groups.

    So in short, all I had to do to achieve the effect was:

    • Create a beveled cube (I used Blender).
    • Find what vertices you're going to move in each direction by their position from center.
    • Calculate out the beveled edges, and set the exact size.

    I wrote an article about it here. Scroll to the bottom of the article if you just want to know the process:

    https://www.linkedin.com/pulse/coding-resizable-beveled-cubes-unity-richard-christley

    0 讨论(0)
  • 2020-12-31 23:17

    I'd certainly defer to a shader-oriented answer, but especially if the necessary shaders aren't available on a given platform, I'd accomplish this with a few "level of detail" models aka LoD.

    • Give the GameObject for this object meshes for a 6-sided box, a slightly-curved box, and an up-close very-curved box. (http://www.wings3d.com/ is my go-to simple modeling tool)
    • Give the GameObject a behavior script that checks each frame for distance from camera.

    • Activate the appropriate mesh based on the distance, and deactivate the others, this should be done at a distance where the change isn't detectable at the highest resolution available to the player.

    This technique is pretty widely used in 3d games, a good way to represent far-off swarms of things that can become much more detailed once the camera gets up close.

    0 讨论(0)
提交回复
热议问题