Tutorial: HC Terrain (2/3)

Released! - Discuss progress and updates on the biggest Trespasser level endeavor ever, JPDS - a dark Tres mod by Draco and co.

Moderators: scallenger, JPDS Team

Post Reply
Troodon

Tutorial: HC Terrain (2/3)

Post by Troodon »

Here is a HC terrain flyby, low res animation (MPEG compression):

Image
http://diehard.ath.cx/~ftp/fanstuff/hc-flyby.avi

It would obviously look nicer with a decent texture.

If you open any Tres level in TresEd, then turn on "Show terrain objects", and select all of the base objects you will notice the grid layout. Why not a single object for the entire level, given that terrain looks more or less the same everywhere (exceptions being dirt, sand, rocky areas, and other "special" terrain objects)? The answer seems to be related to performance.

When developing the HC terrain I imported a base terrain object and examined its scale factor: 64. The entire HC level can be covered with only a 5x5 base object grid. But the fact is, it's possible to resize a single base object so that it covers almost the entire terrain in this level. Here I rescaled it to 256 (fourfold).

Image

As you can see above I attempted to change its texture to something "nicer", that is:

Image

The result was deceiving. Pixels in the bitmap texture became large squares in Trespasser, resulting in a patchy terrain:

Image
Image

This prompted me to explore the way texture is mapped to terrain objects in Trespasser. It turned out the texture of an original terrain base object is like a motif repeated multiple times to fill out the entire object, while my new texture was stretched to cover my single terrain object. I thought that all I needed to do was break my bitmap into a number of sectors equal to the number of base terrain objects and use the individual sectors as textures for these objects. But, as you know, the maximum size of a bitmap in Trespasser is 256x256 pixels. Given the size of the patches you can see in the screenshots above I calculated that, for the size of the HC level, I needed a grid of 128x128 base terrain objects. Unfortunately, that slowed down the game too much; even with a 64x64 grid the slowdown is significant when compared to a 5x5 grid. Well, that's too bad, so have a final look at this green shore from across the lake: :)

Image

But wait, why not use a single base object, with the original Tres texture and mapping mode? Wouldn't that increase performance? I tried that too, and the answer is, here again, no. Possibly, the engine fine-renders terrain objects nearest Anne; if there is only one but it's too big (scale factor is too large) then CPU cycles may be wasted on applying the texture all across that object.

It appears the original Trespasser developer team have found the best trade-off: a reasonable number of base terrain objects for each level, with a simple, repeated bitmap texture, and extra terrain objects for special effects at various locations; there may be little, if anything, we can improve on terrain design/texture mapping at this point.
Last edited by Troodon on Wed Apr 09, 2003 5:47 am, edited 7 times in total.
User avatar
Rebel
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 6121
Joined: Sun Nov 10, 2002 10:26 pm
Location: That country nobody likes (you know the one)
Contact:

Post by Rebel »

Good job on the terrain, Troodon. :wink:
Troodon

Post by Troodon »

Thanks, Rebel. Well, the "tutorial" above is more about what I haven't been able to do but hopefully it will help other Tres fans save time and finish their new levels sooner. :)
User avatar
Dapper Dan
-=TresCom Elder=-
-=TresCom Elder=-
Posts: 2010
Joined: Tue Nov 12, 2002 7:43 am
Location: South Carolina
Contact:

Post by Dapper Dan »

Fascinating Troodon! I don't know much about what you just showed us there, but I do know the only way to find out what works is to find out what doesn't! :wink:
Remdul
-=TresCom Developer=-
-=TresCom Developer=-
Posts: 1845
Joined: Mon Jul 22, 2002 12:35 pm
Location: Holland, Europe

Post by Remdul »

Very cool you are testing this stuff. We can only use the engine properly when we know its limitations...

Keep going Troodon! :)
Post Reply