Merry Christmas, Community - Poly Soup
by Kyle Carter · 12/24/2006 (5:03 pm) · 143 comments
Wow - almost three months since my last .plan. I guess I should write these things more often. What have I been up to? Nothing that's quite ready to be talked about in depth, but in brief: developing ways for us to do more releases at a higher quality and with bigger feature sets.
And probably some smaller stuff that I'll be posting about in coming months, too. :)
Speaking of smaller stuff, I took a few days about a month ago and extended 3space and TSStatic in TSE to support more flexible collision scenarios. Or to speak more directly, polysoup collision. I've collaborated on this with Tom Spilman, who spent some time debugging it, integrating it into a project, and cleaning it up a bit, and the end result is a polysoup implementation that seems fairly usable.
So, here's a screenshot of an orc on a concave donut:

Now, some caveats: this is just the result of a few day's hacking, not an official announcement of GG support for polysoup in Torque. So while it's pretty easy to integrate, you do have to have some coding knowledge to use it.
It's also not bullet proof. We use OpCode, so it's pretty fast & efficient, but if you expect to drop ten orc models into a level and not have a performance hit when you run a buggy into them, you'll have to think again. But if you want to build a building in DTS, and don't go overboard in your model complexity, you should do just fine.
Finally, it collides against ALL the meshes in your model, including invisible ones. So if you want a model to work for polysoup you probably want to kill all your Col-1 meshes & so forth for proper results. Adding some sort of filtering rule wouldn't be hard but it was unclear the best way to do that so we left it a bit braindead.
You can get this at its page on TDN, if you're a TSE owner. Remember, you're on your own using it!
I figure I can't very well give you hearty Christmas cheer this holiday, so I may as well post up something nice and useful. :)
And probably some smaller stuff that I'll be posting about in coming months, too. :)
Speaking of smaller stuff, I took a few days about a month ago and extended 3space and TSStatic in TSE to support more flexible collision scenarios. Or to speak more directly, polysoup collision. I've collaborated on this with Tom Spilman, who spent some time debugging it, integrating it into a project, and cleaning it up a bit, and the end result is a polysoup implementation that seems fairly usable.
So, here's a screenshot of an orc on a concave donut:

Now, some caveats: this is just the result of a few day's hacking, not an official announcement of GG support for polysoup in Torque. So while it's pretty easy to integrate, you do have to have some coding knowledge to use it.
It's also not bullet proof. We use OpCode, so it's pretty fast & efficient, but if you expect to drop ten orc models into a level and not have a performance hit when you run a buggy into them, you'll have to think again. But if you want to build a building in DTS, and don't go overboard in your model complexity, you should do just fine.
Finally, it collides against ALL the meshes in your model, including invisible ones. So if you want a model to work for polysoup you probably want to kill all your Col-1 meshes & so forth for proper results. Adding some sort of filtering rule wouldn't be hard but it was unclear the best way to do that so we left it a bit braindead.
You can get this at its page on TDN, if you're a TSE owner. Remember, you're on your own using it!
I figure I can't very well give you hearty Christmas cheer this holiday, so I may as well post up something nice and useful. :)
#122
As I recall, there were some Windows specific keywords used for indicating linkage [__stdcall, __declspec come to mind]. These would have to be #ifdef'd as well. The other thing I changed was the includes. I think it was using #include instead of #include "foo.h" unnecessarily in a lot of places.
The static linking comment I made was because I just remember finding it easier in terms of some of the crazy Windows linkage defines [I think there was some OP_NO_DLL or something] to just make it static. On Windows you have to do this whole __declspec(dllexport)/__declspec(import) thing which doesn't apply to the rest of the world. So instead of messing with all of that, I just made it static - which I think is a better solution anyways. There's no need for this to be dynamically linked.
01/11/2008 (10:56 pm)
No, of course Windows does things differently. Mac and Linux are much closer to each other [both being UNIX-derived] than either is to Windows. For the __int64 stuff, I would just #ifdef it in the header and use 'long long' for non-Windows builds.As I recall, there were some Windows specific keywords used for indicating linkage [__stdcall, __declspec come to mind]. These would have to be #ifdef'd as well. The other thing I changed was the includes. I think it was using #include
The static linking comment I made was because I just remember finding it easier in terms of some of the crazy Windows linkage defines [I think there was some OP_NO_DLL or something] to just make it static. On Windows you have to do this whole __declspec(dllexport)/__declspec(import) thing which doesn't apply to the rest of the world. So instead of messing with all of that, I just made it static - which I think is a better solution anyways. There's no need for this to be dynamically linked.
#123
I've managed to work through most of my issues so far, but this one has me stumped. My guess would be it's related to something that's handled differently in the Super Environment Pack www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=14152 but I can't find any differences relating to opcode when I compare the files in Winmerge. Here's the error I'm getting from VS 2005 Express
Any pointers on where to look? Thanks!
03/16/2008 (7:49 am)
Edit for more detail - I'm using TGE 1.5.2, with the resource linked below. I see that Lee L. had a similar issue earlier in TGEA, but I'm not entirely clear how it was he fixed it.I've managed to work through most of my issues so far, but this one has me stumped. My guess would be it's related to something that's handled differently in the Super Environment Pack www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=14152 but I can't find any differences relating to opcode when I compare the files in Winmerge. Here's the error I'm getting from VS 2005 Express
1>Linking... 1>tsStatic.obj : error LNK2019: unresolved external symbol "public: bool __thiscall TSShapeInstance::castRayOpcode(int,class Point3F const &,class Point3F const &,struct RayInfo *)" (?castRayOpcode@TSShapeInstance@@QAE_NHABVPoint3F@@0PAURayInfo@@@Z) referenced in function "protected: virtual bool __thiscall TSStatic::castRay(class Point3F const &,class Point3F const &,struct RayInfo *)" (?castRay@TSStatic@@MAE_NABVPoint3F@@0PAURayInfo@@@Z) 1>tsStatic.obj : error LNK2019: unresolved external symbol "public: bool __thiscall TSShapeInstance::buildPolyListOpcode(int,class AbstractPolyList *,class Box3F const &)" (?buildPolyListOpcode@TSShapeInstance@@QAE_NHPAVAbstractPolyList@@ABVBox3F@@@Z) referenced in function "protected: virtual bool __thiscall TSStatic::buildPolyList(class AbstractPolyList *,class Box3F const &,class SphereF const &)" (?buildPolyList@TSStatic@@MAE_NPAVAbstractPolyList@@ABVBox3F@@ABVSphereF@@@Z) 1>tsStatic.obj : error LNK2019: unresolved external symbol "public: bool __thiscall TSShapeInstance::buildConvexOpcode(class MatrixF,class Point3F,int,class Box3F const &,class Convex *,class Convex *)" (?buildConvexOpcode@TSShapeInstance@@QAE_NVMatrixF@@VPoint3F@@HABVBox3F@@PAVConvex@@3@Z) referenced in function "protected: virtual void __thiscall TSStatic::buildConvex(class Box3F const &,class Convex *)" (?buildConvex@TSStatic@@MAEXABVBox3F@@PAVConvex@@@Z) 1>../example/torqueDemo.exe : fatal error LNK1120: 3 unresolved externals 1>Build log was saved at "file://c:\Torque\TGE_1_5_2\engine\out.VC8.RELEASE\BuildLog.htm" 1>Torque Demo - 4 error(s), 0 warning(s)
Any pointers on where to look? Thanks!
#124
EDIT: Ok, so ultimately all I've done is extend this .plan by 2 posts. =) I re-merged after taking a break to clear my head and it works just fine. tsStatic.cc was the culprit, although I can't say that I could tell you where the problem was. I was just more careful, and I do think it was easier merging the Super Environment Pack into polysoup than it was the other way around.
03/16/2008 (9:41 am)
Ok, I stepped back to a clean version of TGE 1.5.2 and re-merged. It compiled with 0 errors and 0 warnings in both debug and release. I'll try to merge the resource I was using back in and see if it was a conflict in code or in my merge.EDIT: Ok, so ultimately all I've done is extend this .plan by 2 posts. =) I re-merged after taking a break to clear my head and it works just fine. tsStatic.cc was the culprit, although I can't say that I could tell you where the problem was. I was just more careful, and I do think it was easier merging the Super Environment Pack into polysoup than it was the other way around.
#125
It seems to not like poly meshes with poly's missing ie holes, but thats easy enough to work around. I did some testing on what it does as far as CPU usage and frame rate and it really doesn't seem to bog down at all. I was getting 80 fps on a geforce 8800GT dual core with about 100,000 polys in the soup and I was only using 3/4s of a core.
Thanks so much for this. I have big plans for it.. big plans!
Colin
04/05/2008 (9:27 pm)
Wow this is the best. Works great! I got it going in TGE 1.5.2 (took some work, but followed all the instructions and did some guess work and got it going)It seems to not like poly meshes with poly's missing ie holes, but thats easy enough to work around. I did some testing on what it does as far as CPU usage and frame rate and it really doesn't seem to bog down at all. I was getting 80 fps on a geforce 8800GT dual core with about 100,000 polys in the soup and I was only using 3/4s of a core.
Thanks so much for this. I have big plans for it.. big plans!
Colin
#126
04/05/2008 (9:30 pm)
Oh and one more question.. should it be possible to have an animated or bone driven polysoup?
#127
04/05/2008 (9:46 pm)
Not without doing some changes to the polysoup system. It _might_ support moving fixed meshes around, although the meshes won't push anyone around, but skeletal animation definitely won't work. There wasn't a lot of incentive to add that because Torque in general doesn't support static world geometry pushing stuff around. The naive way to do that for skeletal case would be to regenerate the lookup structures after every animation update. Expensive but it would work ok for simple models. For more complex stuff you'd have to be a lot trickier... :)
#128
04/05/2008 (11:53 pm)
It's awesome enough. I'm using it in my game for 100% dif-free environments, and I'm delighted. No more map2dif for me....
#129
http://www.youtube.com/watch?v=rM93s_HOmMk
04/06/2008 (10:50 pm)
yes it rocks for sure. Here is a video of some .dts meshes I added to the polysoup.. including a cave ;-)http://www.youtube.com/watch?v=rM93s_HOmMk
#130
04/06/2008 (11:27 pm)
Awesome, cool to see a video of it in action!
#131
The most disturbing thing is that it doesn't seem to be related to the exporter per se, since taking it through Milkshape doesn't seem to help.
Any input would be greatly appreciated, as I am completely addicted to polysoup at this point :-)
04/11/2008 (2:15 pm)
There is one issue I have run into recently. I'm switching from Milkshape to Blender as my primary modelling tool, and one thing that happens is that much of the time my player gets "hung" near triangle edges in the mesh when he's walking along. This will even happen if I import the mesh from Milkshape (via obj) and export in Blender. It will also happen if I export the Blender-created shape to Milkshape and export from there! So clearly Blender does something with the meshes that the polysoup collision code doesn't like--waaay over my head, I think. I have, of course, jacked with the export settings endlessly to no avail.The most disturbing thing is that it doesn't seem to be related to the exporter per se, since taking it through Milkshape doesn't seem to help.
Any input would be greatly appreciated, as I am completely addicted to polysoup at this point :-)
#132
04/11/2008 (2:29 pm)
Maybe one of the tools is duplicating verts or doing other things to change the actual structure of the mesh?
#133
If yourself or anyone is interested, the blend and dts file are here (35k):
www.singularityfps.com/images/kitchen.zip
This is a room that players are meant to run around on, and the issue happens on the bottom of the floor, which is just six big triangles which meet in the center. I've had the issue with grid-like configurations as well, though.
04/11/2008 (3:38 pm)
Darn, I thought you might be on to something there, but no luck. It did remove about 50 doubles in Blender. Also, I turned on glenableoutline and it seems the guy gets stuck well before the edges of the triangles. He can jump over these invisible obstacles and continue on, usually.If yourself or anyone is interested, the blend and dts file are here (35k):
www.singularityfps.com/images/kitchen.zip
This is a room that players are meant to run around on, and the issue happens on the bottom of the floor, which is just six big triangles which meet in the center. I've had the issue with grid-like configurations as well, though.
#134
04/11/2008 (5:41 pm)
Solved! Blender defaults to two-sided meshes. Turned that off, and everything's hunky dory again :-) Thanks Ben for answering, and thanks to Joseph Greenawalt in another thread for helping me find it.
#135
05/07/2008 (10:55 pm)
Is there a version out there for 1.5.2 with the shadow fixes for 1.7 TGEA? If not what would it take to fix the code for 1.5.2?
#136
This is the rar file that's updated for 1.5.2 that I got from ramen sama when I was having problems. The opcode stuff for polysoup is the same, its just updated with the things added in since 1.5.0 which I believe is a bunch of lightmap stuff. I had used the TGE resource in the rar file above and removed too much when merging them. I uploaded it here:
[url="http://www.soon-tm.com/files/polysoup1_5_2.zip]Polysoup1_5_2.zip[/url]
-----------------
One problem that I've started running into with the polysoup is that I'm crashing as soon as my flying vehicle touches the bounding box of a static mesh with polysoup checked. This doesn't happen to all models yet, but the only differences between them is one has a material applied and the other doesn't. Skins or materials on the models and it crashes, no materials and nicely shiney and it works perfectly. I had thought it was the collision with the polygons that was crashing when I hit a smaller mesh but trying a larger mesh its definitely the bounding box.
Anybody else had a similar problem?
05/09/2008 (8:12 pm)
@FreemanThis is the rar file that's updated for 1.5.2 that I got from ramen sama when I was having problems. The opcode stuff for polysoup is the same, its just updated with the things added in since 1.5.0 which I believe is a bunch of lightmap stuff. I had used the TGE resource in the rar file above and removed too much when merging them. I uploaded it here:
[url="http://www.soon-tm.com/files/polysoup1_5_2.zip]Polysoup1_5_2.zip[/url]
-----------------
One problem that I've started running into with the polysoup is that I'm crashing as soon as my flying vehicle touches the bounding box of a static mesh with polysoup checked. This doesn't happen to all models yet, but the only differences between them is one has a material applied and the other doesn't. Skins or materials on the models and it crashes, no materials and nicely shiney and it works perfectly. I had thought it was the collision with the polygons that was crashing when I hit a smaller mesh but trying a larger mesh its definitely the bounding box.
Anybody else had a similar problem?
#137
Yes, I definitely had that problem, and applying a bunch of fixes from this thread helped a TON--although not completely. I still get crashes if someone does a whole lot of plane/mesh collision:
www.garagegames.com/mg/forums/result.thread.php?qt=63305
I'd appreciate it if you could let me know if you get it solid.
05/09/2008 (9:45 pm)
@K.Anderson:Yes, I definitely had that problem, and applying a bunch of fixes from this thread helped a TON--although not completely. I still get crashes if someone does a whole lot of plane/mesh collision:
www.garagegames.com/mg/forums/result.thread.php?qt=63305
I'd appreciate it if you could let me know if you get it solid.
#138
Will do, I haven't had a chance to get back to this just yet but I'll give that thread a shot, thanks.
05/14/2008 (12:22 am)
@LeeWill do, I haven't had a chance to get back to this just yet but I'll give that thread a shot, thanks.
#139
@KAnderson I wonder if your crashing will get fixed if you turn off all dynamic shadow casting? If not, I'm stumped.
Admittedly I havn't played with scripted .dts files and polysoup meshes. I might give it a spin tonight to see if I get similar results.
Thanks for the patch by the way.
10/22/2008 (3:12 pm)
hmmm.. sorry about the super slow response to those last issues.. but I noticed something very similar that might be related with difs. Several month back I was having issues with crashes and .difs that were completely nulled with no texture other than the null. If a .dts file cast a dynamic shadow on the .dif, it would crash instantly. If I added a texture to the .dif , say on a hidden face, and left the rest nulled, it would work without crashing.@KAnderson I wonder if your crashing will get fixed if you turn off all dynamic shadow casting? If not, I'm stumped.
Admittedly I havn't played with scripted .dts files and polysoup meshes. I might give it a spin tonight to see if I get similar results.
Thanks for the patch by the way.
#140
I was suggesting someone in the forums check it out the other day and he couldn't find it...and neither could I.
10/22/2008 (3:52 pm)
Hey is there still a publicly available TGE polysoup resource? It looks like the official RAR file only has the TGEA version...which I thought was build into TGEA now?I was suggesting someone in the forums check it out the other day and he couldn't find it...and neither could I.

Torque Owner Lee Latham
Default Studio Name
This is in the compiling stage, where I presume it doesn't matter if it's statically linked or not...or not?