1
\$\begingroup\$

I have a 1x1x1 cube made in Blender with a simple UVW mapping. It represents a 3D platform of variable size.

The thing is that this cube gets resized a lot, and I want to draw a "border" of a fixed-length on each cube.

Another problem is that I am using Static Geometry, so I have to use a shader (I am using openGL, so I have to use GLSL).

So far I made this (note that the second platform is big, so it has larger borders):

cube-1

cube2

What would you recommend to achieve this effect?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

Either use a geometry shader (or possibly some vertex/fragment shader magic) to generate the border from each vertex of the cube, or write a function that generates a new box with a fixed border size.

By scaling a box, you scale the whole box. There's no magical way of scaling the border separately. And it's a box, which should be simple enough to generate. There's no need to import it as a mesh from Blender. If you want a fixed border regardless of box size, you have to have separate geometry for it.

At the very least, use nearest neighbor filtering instead of linear to avoid the blurry edge on the border.

\$\endgroup\$
1
  • \$\begingroup\$ didn't think about making a separate geometry for it. Thanks \$\endgroup\$
    – Pacha
    Commented Aug 25, 2013 at 22:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .