Page 1 of 1

Lack of tangents on billboards/chains.

Posted: Sat Dec 15, 2012 5:42 am
by mkultra333
I may have mentioned this before, but I've run into it again.

You can't set normals or tangent vectors on billboards or billboard chains. This is a pain, because you need normals and tangents for some types of effects. You can sort of get a normal by assuming the billboard faces the camera (which might not be true if the billboard is oriented self, or the chain is at a sharp angle). But a tangent seems to be impossible. The only way I can think to possibly sneak a tangent in is via the colour parameter, but I already use that for colouring.

Why would I want a tangent on a billboard? I've got blood splats flying around, made of billboards and billboard chains. A specular highlight on those flying blood splats would look great, correctly lit to point to the spotlights, but I can't do normal mapping because there's no tangent vector.

Edit: Perhaps I can make a tangent from the UV coords, I'll see. Still no real normal, but using the view dir might be close enough.

Re: Lack of tangents on billboards/chains.

Posted: Sat Dec 15, 2012 6:55 am
by mkultra333
Nope. I realized that there isn't the information needed to make a correct tangent or normal. They would have to be created as a part of the billboard, in the vertex structure, running from one vert to the next. And updated each frame along with the vertex positions.

While I realize this would add to the size and update time of billboards, it needn't be active unless the user requests it, and without the normals and tangents there's simply no way to do accurate specular hightlights and diffuse shading on billboards, something that's quite nice on things like smoke clouds (diffuse emphasis on shape) and flying liquids (specular highlights).

Re: Lack of tangents on billboards/chains.

Posted: Sat Dec 15, 2012 12:14 pm
by bstone
You might want to derive a class from Ogre::BillboardChain as it's very open to that (unlike Ogre::BillboardSet). You'll have to override the vertex buffer setup to add the normals and tangents to the vertex stream, then override the vertex buffer generation to actually fill those elements in.

Re: Lack of tangents on billboards/chains.

Posted: Sun Dec 16, 2012 3:52 am
by mkultra333
I might have a look later when I have the time. It'd really need to work for both billboards and billboard chains.