Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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