Plan for Tom Spilman
by Tom Spilman · 05/20/2005 (11:24 pm) · 19 comments
So we finally released Torque Pipeline and so far a lot of people have picked it up and seem to love it. If you don't know what Pipeline is you should check it out!
So aside from that i've been working on rendering GUIs on textures so that i can place them it in the environment and interact with them. My first attempt was focused on interiors and it worked out fairly well. But of course putting them on DTS shapes.... in particular physics driven DTS shapes was alot cooler. So that's what i did (the video uses the XviD codec):

It took me a long while thinking of how to properly integrate things into Torque... then i gave up and hacked it in. I added a castRayTri() function to TSMesh which would test all visible triangles on a shape against my ray and would return the material and UV hit point of the closest triangle. This could use some optimization, but it works for now.
The thing that drives all this, as described in this thread, is a new class called GuiTextureCanvas. It deals with rendering the GUI on to a dynamic texture and holds a static console method which will fire off the castRayTri() on the SceneObject you pass to it.
Oh and i'm totally screwing the server/client boundary here, but you know what... i don't care. The client server boundary is a bitch... especially when you're doing a single player game. I guess i need more experience with it.
The physics by the way are courtesy of Thomas Lund's rigid shape resource. I'm looking into other solutions as the rigid shape stuff leaves alot to be desired. Gary Brigg's stuff looks promising as well as Akio's. Still I'm taking a serious look at the NovodeX SDK as neither is really ready to be used (correct me if i'm wrong... we're willing to pay for working ODE/Newton/Novodex physices in Torque). Lucky for us our game is single player which should help alot.
I know people are gonna ask me to release this as a resource, but it requires alot of other stuff that is unrelated like my object interaction system. I would do it, but frankly i'm feeling too lazy to gather all the changes to make it available. I'll see if I can get some time to gather it all and organize it. It really is a lot of work putting up a good resource.
So aside from that i've been working on rendering GUIs on textures so that i can place them it in the environment and interact with them. My first attempt was focused on interiors and it worked out fairly well. But of course putting them on DTS shapes.... in particular physics driven DTS shapes was alot cooler. So that's what i did (the video uses the XviD codec):

It took me a long while thinking of how to properly integrate things into Torque... then i gave up and hacked it in. I added a castRayTri() function to TSMesh which would test all visible triangles on a shape against my ray and would return the material and UV hit point of the closest triangle. This could use some optimization, but it works for now.
The thing that drives all this, as described in this thread, is a new class called GuiTextureCanvas. It deals with rendering the GUI on to a dynamic texture and holds a static console method which will fire off the castRayTri() on the SceneObject you pass to it.
Oh and i'm totally screwing the server/client boundary here, but you know what... i don't care. The client server boundary is a bitch... especially when you're doing a single player game. I guess i need more experience with it.
The physics by the way are courtesy of Thomas Lund's rigid shape resource. I'm looking into other solutions as the rigid shape stuff leaves alot to be desired. Gary Brigg's stuff looks promising as well as Akio's. Still I'm taking a serious look at the NovodeX SDK as neither is really ready to be used (correct me if i'm wrong... we're willing to pay for working ODE/Newton/Novodex physices in Torque). Lucky for us our game is single player which should help alot.
I know people are gonna ask me to release this as a resource, but it requires alot of other stuff that is unrelated like my object interaction system. I would do it, but frankly i'm feeling too lazy to gather all the changes to make it available. I'll see if I can get some time to gather it all and organize it. It really is a lot of work putting up a good resource.
About the author
Tom is a programmer and co-owner of Sickhead Games, LLC.
#2
05/21/2005 (12:53 am)
Damn cool Tom!!! Damn cool
#3
05/21/2005 (1:08 am)
Very cool, Tom. BTW, I have a castRayTri implementation, too... Hmm. Get in touch with me, maybe it's a good time to set up a little geometry helper lib in TGE. :)
#4
05/21/2005 (3:07 am)
that is so ace!
#5
05/21/2005 (9:57 am)
VEry neat
#6
05/21/2005 (10:41 am)
GuiTextureCanvas - I don't have permission to access the forum thread. >_<
#7
05/21/2005 (11:09 am)
@Daniel - The class is actually fairly simple. It derives from GuiCanvas and adds creation of a texture render target on onAdd() and inspectPostApply(). It also overloads renderFrame() to set the render target then use begin() and end() to render the GuiControls added to the canvas. GuiCanvas has a slight change to render all GuiTextureCanvas instances before it renders itself (which renders the GuiTSCtrl which renders the scene). Oh GuiTextureCanvas does a lazy sort of culling... it has a dirty flag that is set by MatInstance::setupPass right before the texture is used. The texture always updates one frame late, but that hasn't been a problem so far.
#8
05/21/2005 (11:33 am)
Awesome! :)
#9
05/21/2005 (12:58 pm)
Thanks for the info Tom!
#10
So what method did you use to create the off-screen texture you render the gui into? thats really the heart of this for me. I already know the cockpit texture to replace, so I just need a good cross-platform capable method fo render to texture that plays nice in the gui.
05/21/2005 (1:09 pm)
Hmmm, I really am interested in having a play with something like this for cockpit controls in my 3D cockpit, static controls are so yesterday :)So what method did you use to create the off-screen texture you render the gui into? thats really the heart of this for me. I already know the cockpit texture to replace, so I just need a good cross-platform capable method fo render to texture that plays nice in the gui.
#11
05/21/2005 (4:22 pm)
That kicks so much ass.
#13
05/23/2005 (5:15 am)
Wow, that looks like so much fun! How long did it take to code, aprox?
#14
05/23/2005 (7:34 am)
Kick ass video !...Congratulations !
#15
05/23/2005 (11:06 am)
@Stefan - I spent more time thinking about how to code it up than actually making the code changes and fixing my bugs. I thought about it for over a week as i wanted a solution that wouldn't require changes to critical sections of Torque. What i ended up with makes changes to TSMesh which i wanted to avoid, but once i started coding it was less than two days with bug fixes. Not alot of code either... less than a thousand lines.
#16
10/02/2005 (10:35 pm)
I -just- saw this, and I thought I should reply, albeit late. I did this same thing, as outlined in one of my PLANs, however, I did not need to make a new class, I made an implementation that used the current guiCanvas class... it involved making a separate renderCanvas pointer, though.
#17
Thanks for letting me know about this, this could really save us months of piecing together little bits of highway.
-John
12/06/2005 (12:54 am)
Tom I am extremely interested in the Torque Pipeline product for the Cartography Shop. For my game, which is a racing game, I've had to create the tracks in 250m sections using the old version of Worldcraft because that's the biggest brush you can create. TCS allows you to make brushes hundreds of thousands of units big. Are Cartography Shop units the same scale as Worldcraft (ie: does 32 CS units = 1m just like WC?) Also, will you provide free updates to the Pipeline when TSE becomes more mature?Thanks for letting me know about this, this could really save us months of piecing together little bits of highway.
-John
#18
07/19/2006 (9:19 am)
Tom, would you care to post your code on a thread that's accessible to the TGE developers too? Seems the link above is restricted to Shader Engine folks... thanks! 
Torque Owner Josh Moore