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



What would you recommend to achieve this effect?


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.

| improve this answer | |
  • \$\begingroup\$ didn't think about making a separate geometry for it. Thanks \$\endgroup\$ – Pacha Aug 25 '13 at 22:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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