View Full Version : how to display a logo and a text string above a 3d model?

01-10-2017, 04:17 AM
for example:

there is a cube in the scene, I want to display a logo icon and a string "cube king"
above the cube.

no matter how i rotate the cube,or zoom in or zoom out,
the logo and the text should always face to me.

I use this to display the logo and rolename in my test rpg game.

Thank you all

01-10-2017, 04:37 AM
You could make a quad (rectangle out of 2 triangles) and texture it with the logo and string. A little math can keep it pointed at the camera. That's basically what's called a "billboard", which you should find significant information on how to do on the Internet.

Doing strings of variable text is a bit more complicated, but can be done in basically the same way except that each letter could have its own quad but they would need to rotate as a single rectangle. The logo could be a separate quad as well.

One way to link the letter quads could be to give each its own matrix and parent them together. It would involve deciding which letter is at the center of the word and making it the parent of all the others. Then by rotating the center letter, all the others would remain attached as the center letter rotates. This method would also allow for leading and kerning.

Vector subtraction should give you a vector from the object/billboard/letter/logo to the camera. You could probably use a LookAt function to produce a matrix that "looks at" the camera from the letter. You could use that for the parent I believe.

Of course, the children are parented to their parent by multiplying their world/object matrices together and using the result as if it were the child's matrix. But if you've never done this before, I would start by putting it all on a single quad to start with.

01-10-2017, 11:36 PM
I found a demo here