Game Development Community

TSstatic and hide mesh

by Steve Acaster · in Torque 3D Professional · 07/06/2009 (9:05 am) · 17 replies

I had an idea about making a fully enclosed level (tunnels/corridors etc) out of a single DTS with multiple meshes, and then hiding various areas/meshes with triggers. Doing a quick dump() I saw that TSstatic doesn't have the function setmeshhidden() as stock.

I was wondering if there were any technical reason preventing this? Or whether it just wasn't set up on the grounds of "it's not in 'cos it isn't".

#1
07/06/2009 (9:33 am)
I don't know the technical answer to this, but it's interesting that you brought it up because I just implemented this feature myself.

It was pretty straightforward to do, let me know if you need any of the code for it.
#2
07/06/2009 (9:38 am)
Quote:
I don't know the technical answer to this, but it's interesting that you brought it up because I just implemented this feature myself.

If you've done it, then I guess that there isn't a technical reason for not having it!

Please feel free to post your code in the new T3D Resources and Code Sharing Area and hopefully it'll make it into the stock code for the next beta and final release.
*hint*hint* ;)
#3
07/06/2009 (9:44 am)
Ah, crud. Wasn't paying attention to which forum I was in, so no, I haven't done this in T3D. Not enough coffee today, sorry about that.
#4
07/06/2009 (9:48 am)
Lol, it's probably quite similar anyhow. Enjoy your nice cup of Joe. :)
#5
07/06/2009 (11:48 am)
The setMeshHidden() stuff is implemented in shapeBase. TSStatic is much simpler and derives straight from SceneObject.

Right away, using a StaticShape would solve the problem.
#6
07/06/2009 (1:14 pm)
There isn't any reason why the same functionality in ShapeBase couldn't be copied to TSStatic. The only issue is exposing it to the editor somehow... or you could just live with scripting it.

If someone gets this working drop me a line and i'll merge it into the trunk.
#7
07/06/2009 (1:21 pm)
It does sound very similar to the way it was set up in TGE, with the functionality implemented for ShapeBase but not TSStatic objects. It was a fairly straightforward matter to duplicate the few lines of code that accomplished this, so I imagine it would probably be similar with T3D.
#8
07/06/2009 (2:21 pm)
I was just thinking of utilising it with scripted triggers. The idea being to hide areas of corridor/tunnel not visible.

I haven't messed around with the new portals/zones as I'm waiting on some docs on what to do with them, but it's a performance boosting idea I'm after. No point rendering what can't be seen and isn't near, whilst only using a single DTS.
#9
07/06/2009 (2:27 pm)
Yeah, that's exactly what I'm using it for (with TGE). I use scripted triggers to keep track of where the player is, and have code set up to show only those areas which should be visible, and hide the rest.

I also set it up to do the same with DIFs as well.
#10
07/06/2009 (3:38 pm)
I've found the relevant code for hiding meshes in tsShapeInstance ... but aren't sure what file/s TSstatic use, so aren't sure where to copy it to. I'm not a programmer so I might be barking up the wrong tree here.
I was thinking tsShape but got confused by all the collada stuff in it

EDIT:
lol, and if I look outside of ts/ I find T3d/TSstatic files....
#11
07/06/2009 (6:20 pm)
That's right @Steve, it won't be so hard to merge mesh hidden to TSStatic, because almost everything was done in TSShapeInstance, shapebase only networktify the hidden status. So, if you want to do this, just copy the relavant code from shapebase to tsstatic, of course, some minor changes was needed.
#12
07/06/2009 (10:33 pm)
So yea... you can expose the mesh visibility state to TSStatic... but your shouldn't be using that to optimize visibility.

Give the Zone and Portal objects a shot. Put down zones... things totally inside a zone can only be seen thru a portal. Put down Portals which slightly overlaps two zones to make a doorway between them. Don't worry about making the zones butt up against each other... the portal shape acts like a tunnel between them. A portal that only overlaps one zone is a portal to the gloabl outside zone.

In general i would recommend using as few zones as possible... try to make them cover large areas that can be easily culled thru one or two simple portals. Remember its not about matching every room, hall, and doorway with zones... its about skipping large parts of your scene with as few procssed zones as possible.

Oh... one big limitation that directly applies to you Steve... it doesn't cull submeshes within a single DTS. But i'm thinking about some tricks to get around that.

There was a bug fix for one zone and portal issue over here.

Zones and Portals are very new... the more feedback we can get on them the better they will be in 1.0.
#13
07/07/2009 (7:38 am)
Quote:
Give the Zone and Portal objects a shot. Put down zones... things totally inside a zone can only be seen thru a portal. Put down Portals which slightly overlaps two zones to make a doorway between them. Don't worry about making the zones butt up against each other... the portal shape acts like a tunnel between them. A portal that only overlaps one zone is a portal to the gloabl outside zone.

That's what I wanted, a bit of info on what I was supposed to do with them. I'll have a play.
#14
07/07/2009 (9:30 am)
I think a small demo level showing best practice for portals and zones
would be beneficial to just about everyone.
#15
07/07/2009 (9:35 am)
Seconded!
#16
07/30/2012 (6:49 pm)
Did you find a solution for this Steve? Not sure if its been added into 1.2, or a work around?
#17
07/30/2012 (7:19 pm)
3 years is a bit long to remember ...