Projection screen, tangents and binormals.

I have a quick informative question.

When using the ProjectionScreen class, does it recalculate the tangents and binormals along with the texcoords? It seems like it doesn’t, at least by default.

Correct, it does not. Doesn’t even have an option to do so, sorry.

David

Thanks for the answer, that’s what I thought. Is there any chance this functionality could be added? Either into the projection screen or a separate method somewhere? I don’t expect it to be present in Panda currently.

I don’t see why it couldn’t be added to ProjectionScreen. Would you be willing and able to make the needed changes? We’d be happy to accept a patch. :slight_smile:

David

Heh, and I’d love to make that contribution, but I’m illiterate when it comes to C++, so it was more of a feature request than an offer, unfortunately…

Is there anything in Panda that does this calculation right now?

If not, I might have to take a look at the code in yabee that does that, and translate it from Blender-speak to Panda-speak. The bad thing is that it’s Python, and tangents/binormals seem to be quite some math to deal with.

The only part of Panda that calculates tangents/binormals is built into the egg library. If you load your geometry using the EggData class, you can compute the UV’s and normals that you want for each vertex and then call EggData.recomputeTangentBinormal() to recompute all of the tangents and binormals based on the UV’s and normals. It’s the same thing as using the -tbn option to egg-trans.

But beyond that, there’s nothing built into Panda to compute that data for geometry on-the-fly.

Of course, when you are using a projection, the tangents and binormals are fairly straightforward to compute.

David

How is it different from using manually created texture coordinates? Maybe there are some simpler equations for this case?

I need this for my editor’s brushes. I have texturing, vertex smoothing and vertex editing there. Each brush is composed of a number of faces formed by separate, procedurally created meshes. Each face is made of two triangles, so the objects are as simple as they can possibly be.

Tangents and binormals are implicit from the projection, so you don’t have to examine the existing texture coordinates to determine their direction.

David