Lack of tangents on billboards/chains.

What it says on the tin: a place to discuss proposed new features.
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Lack of tangents on billboards/chains.

Post 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.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: Lack of tangents on billboards/chains.

Post 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).
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.
bstone
OGRE Expert User
OGRE Expert User
Posts: 1920
Joined: Sun Feb 19, 2012 9:24 pm
Location: Russia
x 201

Re: Lack of tangents on billboards/chains.

Post 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.
User avatar
mkultra333
Gold Sponsor
Gold Sponsor
Posts: 1894
Joined: Sun Mar 08, 2009 5:25 am
x 116

Re: Lack of tangents on billboards/chains.

Post 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.
"In theory there is no difference between practice and theory. In practice, there is." - Psychology Textbook.