0
$\begingroup$

If I have a cube in OpenGL, how can I have it appear like rounded? I think it's too complicated to really have the cube rounded so is there any "light trick" to have something like this:

enter image description here

The cubes in the image seem to be rounded on the top. The screenshot is from the game Voxatron

Another view of the cubes (see how they seem rounded on the top):

enter image description here

$\endgroup$
2
  • $\begingroup$ "The cubes in the image" Um, what cubes? I just see some seemingly arbitrary colors. $\endgroup$ Aug 3, 2019 at 19:52
  • 2
    $\begingroup$ Those look like colors baked into the textures. $\endgroup$ Aug 4, 2019 at 3:05

1 Answer 1

3
$\begingroup$

If silhouette is not important, you could bend the shading normal near edges.

Since it's a cube you can probably compute the normal procedurally in the shader based off of the uv. I.e. if uv is in range [0,0.1] or [0.9,1.0] start bending the normal towards horizontal.

If silhouette is important, drawing a rounded cube model with vertex normals would make the most sense. There are cube models which have the beveling to look like a rounded cube.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.