Torque Shader Engine/PolySoupAddon

From TDN

Contents

Introduction

Hi! See my .plan [[1]] for more information on this resource.

This resource was developed against TGEA using VC7.1. It should work fine in TGE with some minor tweaks, and also with other compiler versions.

Since this is an advanced piece of functionality, it's restricted to Torque Advanced users. If you have a TGE license in addition to your TGEA license, feel free to use it in your TGE projects.

Installation

Download & extract the rar: Media:Polysoup.rar. Copy files in engine directory over corresponding files in your TGEA checkout. Copy opcode directory under lib into lib in your copy of TGEA.

Add lib/opcode to your TGEA project's include path. Compile the opcode lib and add the resulting libs to your linker settings.

Compile TGEA!



Edit: (Merged by: Kerry Lyon)

Polysoup TGEA 1.0.3 files Media:TGEA1_0_3_Polysoup.zip
(You will still need the Polysoup.rar file above for the "opcode" directory. It is not included in the TGEA1.0.3 zip file above.)

Then just follow the rest of the documentation here to get it to compile and work with TGEA 1.0.3

Edit: Ron Nelson

Added the shadow enhancements in TGEA 1.70 to 1.03 as well as the fixes to prevent wall walking. Still follow the instructions, but this has all of the installation files besides the Opcode Polysoup TGEA 1.0.3 files Media:TGEA1_0_3_Polysoup_Shadows.zip

Use

Go to the world creator (hit F11, then F4, IIRC). Select a DTS file, and click it to create a new TSStatic. Go to the TSStatic in the inspector and check the polysoup checkbox. You are now colliding against the actual rendered meshes!

Be aware that it considers ALL meshes, even invisible ones, for collision, so you may need to add code to filter out Col-1 meshes, or simply remove them from your model.

Finally, although OPCODE is a good collision library, it's not perfect, and you do need to use discretion in building your models to get good performance! Try not to have more than a dozen polygons in a given cubic meter volume; this should keep your performance good.

Legal & Credits

The PolySoup Addon is © 2006 GarageGames, Inc. with All Rights Reserved.

I would appreciate it if you credited Ben Garney of GarageGames in your game credits section and if your feeling like this has been very useful feel free to visit my amazon wish list!

UPDATE: The code here is now available free for both private & commercial use. This code now only requires a Torque Game Engine or Torque Game Engine Advance Indie or Commercial license in order to be used for publicly distributed for profit games. Thanks!
Special thanks to Tom Spilman who also contributed several bug fixes and enhancements to this code, and Mark Barry of InMotion Simulation for all his help with being an early adopter licensee of this code!

Conclusion

That's it. Please see my .plan [2] for more information.

Known Issues

  • Polysoup Flag The polysoup flag isn't really meant to be toggled at runtime (although it should work well enough for editing purposes) - the object doesn't fully deal with flushing the collision caches and other data structures on toggle. Best results are where it's always one or the other. If you do change it, moving any objects that are colliding with it away a bit and then back ought to make things work properly again, but I'm not gonna swear to it. :)