Game Development Community

Memory issues with TSMesh

by Joshua "The Power Nap" Taylor · in Torque Game Engine · 08/25/2003 (9:28 pm) · 8 replies

I've been working on adding binormals and tangents to the actual mesh of the TSShape. I've been using the inverse gradient aproach to calculate the texture space, so it didn't need to be exported from the tools.

It seems to have a royal fit when I try and allocate some memory for the tangents and binormals. I know this might have to do with the resouce manager, but I was wondering if anyone had a definate answer. From what I can see the whole of the TSMesh uses pre-existing memory.

#1
08/25/2003 (10:36 pm)
I think that TSMesh tries to preallocate everything, instead of dynamically growing it; since the format has the info, it saves on allocation/load time, and not having to assume dynamic vectors lets you speed things up.

Have you tried adding the binormal/tangent data to the vertex struct the TSMesh uses, but not the format it uses for the vertexbuffer? You might have to do some interesting hacking to get that to work right if you do the latter.
#2
08/26/2003 (7:40 pm)
So is there only one instance of TSMesh per model?(I know that a model may be composed of several instances of TSMesh nodes, but what I mean is there isn't a separate mesh for every player) Where does TSSkinMesh play into this?

As far as the memory issue goes, I'm seeing what I can do.
#3
08/27/2003 (3:55 am)
A TSShape contains a collection of TSMesh, TSSkinMesh, etc. based on the data which was exported to the DTS being loaded. The instance specific data for a model is stord in TSShapeInstance (such as currently active animations, node transforms, etc.)
#4
08/27/2003 (7:41 pm)
Okay, that's what I figured.
#5
08/28/2003 (10:38 am)
Hey hey, I'm very interested in this. I've been trying to add specular lighting support to all of the rendered objects, and I've done water and terrain since they're easy to calculate the tangents and binormals for, but I don't quite know how to do this for three space objects. How far have you gotten?
#6
08/28/2003 (8:26 pm)
I've got the formula to make the tangent and binormal from the text coordinates and the verticies in threespace. All that remains is the memory issue. I have an idea of how to deal with it, I just need to sit down and do it.
#7
08/28/2003 (10:57 pm)
Ah, ok. How are you allocating the memory? I had the same issue going through the fram allocator on the terrain. Apparently, holding that info takes up a few megs of memory and I had to change the frame allocator size from 3 to 20 megs. I still have to make it precalculate that stuff so it doesn't have to keep calculating them per frame and allocating that memory.

And, would you be able to share what you did or an explaination of it?
#8
08/29/2003 (6:25 pm)
I don't have any problem sharing with you Chris, but I still have some testing to do on it. Drop me an email and I'll give you a rundown.