Game Development Community

Render flags and super large objects

by Angelo Concepcion · in Torque Game Engine · 12/11/2002 (8:22 am) · 5 replies

My artist has come up with a gigantic tree with spidering branches that extend through most of the entire level. This tree is the base fixture for one of our levels. The tree is in engine and looking good except for the problem of how torque renders single static objects. Just to save myself some time and thought I'll quote his problem. The rest of his post can be read here.

Quote:ok, so I've got this level with this huge tree model whose branches span all throughout the level. The problem of course is that torque seems to use the center point of the object to apply fog and detail levels to it, so by the time I get to the far end of a branch, the entire tree just vanishes. Also, the fog effects are applied uniformly to the whole object, which means the branches look flat and gray the further you travel from the tree's center.

Here's a snapshot: www.mojosite.org/stuff/tree.jpg
That's what the tree looks like when I move too far from it's center.

Now Ben Garney (<--fixed :) gave us some helpful suggestions, one of them being that we should attempt to flag the tree so that Torque renders it differently. Can anyone help me out in that department? I've never touched render code before. Basically we want the tree to be treated in the same way the terrain geometry is treated (i.e. gradual fog shading and polygon drop-off instead of object drop-off). Any help would be appreciated.

Thanks.

#1
12/11/2002 (11:27 am)
Now is the time where you have to decide how badly you want that tree to look good ;)

Implementing a continuous level of detail algorithm like the terrain uses will be time consuming. It'll look great (when it's done), but it'll be a lot of work.

The single easiest thing to change to make it look better will be to make a new flag for objects (call it "useRealFog" or something) the defaults to false. When it's true, then you should use an alternative fogging method that does "real" fog - ie, uses the same techniques the terrain does for fogging.

Look at about line 230 of sceneGraph\sceneGraph.h for the definitions of the functions the terrain uses. See line 1941 in terrain\terrRender.cc for some of the fogging code. Throughout terrRender.c, various fogging calculations occur. Search for gClientSceneGraph->getFogCoordPair for a lot of them. See line 1174 in interior/interior.cc to see how interiors render things.

...

Speaking of that, you _did_ set up the tree as an interior, right? Because that would be by far the simplest way to make it be fogged.
#2
12/11/2002 (5:56 pm)
How do you set up an object to be an interior? I don't know if that's been done or not, but I imagine not.
#3
12/12/2002 (6:04 am)
It means you have to get it into DIF format, basically. You can use Hammer/Worldcraft, Quark, or (maybe) 3dsMax to build your objects in MAP format, then you run map2dif to convert them to the engine's format.

http://www.garagegames.com/docs/torque.sdk/tools/map2dif.html

Dif is designed for large static objects, unlike DTS, which is for small animated things. (Or small static things).
#4
12/12/2002 (12:02 pm)
Ah ha, this is very interesting. I don't think any of us were aware of the different object formats. We have been making all of our objects as DTS.
#5
12/12/2002 (12:03 pm)
Yeah... The interiors are much better suited for things to climb about on. :)