Game Development Community

TerrainBlock::BlockShift question...

by Robert Blanchet Jr. · in Torque Game Engine · 03/01/2003 (12:55 pm) · 10 replies

I'm trying to reduce the terrain poly count by modifying the TerrainBlock::BlockShift value as noted in this.plan.

The way he described it, sounded like all you needed to do was modify that one value, but that isn't the case.

Currently, I have each value set at:
BlockSize = 128, //256,
      BlockShift = 7, //8,
      LightmapSize = 512,
      LightmapShift = 9,
      ChunkSquareWidth = 32, //64,
      ChunkSize = 4,
      ChunkDownShift = 2,
      ChunkShift = BlockShift - ChunkDownShift,
      BlockSquareWidth = 128, //256,
      SquareMaxPoints = 1024,
      BlockMask = 127, //255,
      GridMapSize = 0x15555,
      FlagMapWidth = 128, // flags map is for 2x2 squares
      FlagMapMask = 127,
      MaxMipLevel = 6,
      NumBaseTextures = 16,
      MaterialGroups = 8,
      MaxEmptyRunPairs = 100

But this makes the current missions terrain disappear and further more makes the editor crash when generating a new terrain. I think my problem is I have to modify the GridMapSize value as well but I am not sure what to change it to.

Also to clarify, I believe I have edited out all of the 'magic numbers' regarding the terrain sizes and so forth from the code so I don't think that is an issue in the crash.

Any help would greatly be appreciated.

#1
02/25/2005 (9:50 am)
I know the original post is nearly 2 years old, but did anyone ever figure this out? I'm also trying to get my terrain size down.
#2
02/25/2005 (2:00 pm)
Yes, I got it all figured out. Unfortunately I dont have my changes with me at work so I wont be able to help you until I get home.
#3
02/28/2005 (6:03 am)
Are the mods simple enough to post here? Thanks in advance.
#4
02/28/2005 (10:21 am)
Ah, sorry I completely forgot about this. I'll send myself an email :)
#5
03/01/2005 (5:15 am)
I didn't think blockshift would work with a value of 7. Doesn't that have to be powers of 2?
#6
04/27/2005 (11:23 am)
Robert, could you please post these code changes? Im sure they will be
helpful to a lot of people, including me =D
#7
04/27/2005 (1:33 pm)
Here's my random guesses for these values:

BlockSize = 128, //256,
      BlockShift = 7, //8,
      LightmapSize = 512,
      LightmapShift = 9,
      ChunkSquareWidth = 64, //64,
      ChunkSize = 4,
      ChunkDownShift = 3,
      ChunkShift = BlockShift - ChunkDownShift,
      BlockSquareWidth = 128, //256,
      SquareMaxPoints = 1024,
      BlockMask = 127, //255,
      GridMapSize = 0x1555,
      FlagMapWidth = 64, // flags map is for 2x2 squares
      FlagMapMask = 63,
      MaxMipLevel = 6,
      NumBaseTextures = 16,
      MaterialGroups = 8,
      MaxEmptyRunPairs = 100
#8
05/03/2005 (5:29 pm)
Has anyone tried Ben's guesses? I'll try them myself tomorrow, but I would be curious to hear if anyone has tried them already.
#9
05/04/2005 (9:35 am)
I'm getting a crash in TerrainRender::buildBlendMap with these numbers. The line is the call to blend (mCurrentBlock->mBlender->blend). I'm not knowledgeable enough with the terrain manager to debug this, so I'm just going to revert my numbers.
#10
05/06/2005 (11:38 pm)
Blender has its own hard-coded numbers. Use the C blender if you want to get something that will be easier to muck with. :)