Game Development Community

512x512 terrain textures...

by J. Donavan Stanley · in Torque Game Engine · 12/21/2002 (8:49 am) · 41 replies

I made some quick modifications to the terrain rendering this morning to allow 512x512 terrain textures to be used. However, in so doing I had to disable the assembler version of the blender, which bothers me.

Here's what I did, anyone have a better approach?

In blender.cc I changed:
TEXELS_PER_SOURCE_EDGE_LOG2 to 9 from 8.

In terrRender.h I changed:
MaxDetailLevel to 10 from 9
MaxMipLevel to 9 from 8
TerrainTextureMipLevel to 9 from 7
SmallMipLevel to 7 from 6

In terrRender.cc I fixed the creation of mBlendBitmap to use the enum value for TerrainTextureSize instead of a hardcoded value of 256.
Page «Previous 1 2 3 Last »
#1
12/21/2002 (9:00 am)
Have you found any effect on framerate ?
#2
12/21/2002 (9:18 am)
I didn't think to grab "before" numbers but I'm seeing the following:

1280x1024x32 Fullscreen ~ 55fps
1280x1024x16 Fullscreen ~ 70fps

1280x1024x32 Windowed ~ 36fps
1280x1024x16 Windowed ~ 39fps

This is on a P4 1.5ghz with a Geforce4 128MB.

Edit: I imagine things could be sped up if the asm blender would work with larger textures but I know JACK about assembly
#3
12/21/2002 (9:28 am)
You can turn off the asm blender and work with the c code to see if modifying the blender would make any difference.

Undefine BLENDER_USE_ASM in blender.cc
#4
12/21/2002 (10:39 am)
That's the whole problem. The asm blender cannot deal with 512x512 textures it generates lines across the textures for some reason.
#5
12/21/2002 (10:59 am)
I should have read your original post more closely. Yes that asm blender is hairy. It also has a blending bug (some textures on scorched planet look different than with the c blender...the c blender looks more "correct")
#6
12/22/2002 (9:11 am)
Now THIS is scortched earth:

www.jdonavan.net/scortched.jpg
The increased detail makes a difference. Now to get bump mapping working...
#7
12/22/2002 (10:24 am)
Quote:This is on a P4 1.5ghz with a Geforce4 128MB.

What video card is that exactly? a 4200 Ti, 4400 Ti or 4600 Ti?
Becuase when I run our game on 1024*768 (lower res then you have there), on my P4 2Ghz GF 4200 Ti, I have an avarage framerate of 260 fps (so your framerate sounds quit slow to me). I would love to implement this too.... but I'm not willing to loose more then 10-20 fps on my machine becuase of it.
#8
12/22/2002 (10:43 am)
I'm running a Geforce 4 Ti 4600. If I drop the resolution down to 1024x768x16 I get around 170 fps. Tack on another 500mhz on the CPU and you'd get 200+ I imagine.

If an assembler guru could fix the assembler blender it'd bump that up some more.

Edit to add: I'm also running with npatch enabled for the terrain so that's some additional overhead. If I think about it later I'll turn it back off and check the numbers again.
#10
12/22/2002 (12:31 pm)
nPatch subdivides the terrain to make it smoother. Basically it takes the polygons for the terrain, and splits them up into lots more triangles automatically, the result is better lighting and smoother looking terrain.
#12
01/08/2003 (3:05 pm)
for anyone who got stripes, i found a fix that worked for me, because same happened in waterworld map, i changed MaxDetailLevel to 12, and now everything works clearly for me, btw J. Donavan Stanley - my problem was that my code killed the else for not using asm blend heh.. but i caught that and tore that junk out (it was for a different effect i was trying, didn't work) - (my textures were quality 12 (0 compression)so i tried that)
#13
01/14/2003 (4:09 am)
I hate myself, but following your instruction above results in a crash for me. No assertion (debug built), no nothing. Just segfault and goodbye. The blender.cc choice is the responsible part, I can change everything else and it works just fine, as soon as I modify that one byte, it's game over.

This is what the backtrace says:

#0 0x082845f6 in Blender::blend(int, int, int, unsigned short const*, unsigned short**) (this=0x40c0dbe8, x=128, y=0, squaresPerTargetEdge_log2=6,
lmap=0x499deb88, destmips=0xbffff020) at terrain/blender.cc:852
#1 0x082999d9 in TerrainRender::buildBlendMap(AllocatedTexture*) (
tex=0x40be1ad8) at terrain/terrRender.cc:2381
#2 0x08298683 in TerrainRender::renderBlock(TerrainBlock*, SceneState*) (
block=0x40bf4048, state=0x40cf7c08) at terrain/terrRender.cc:2001
#3 0x0828d170 in TerrainBlock::renderObject(SceneState*, SceneRenderImage*) (
this=0x40bf4048, state=0x40cf7c08) at terrain/terrData.cc:910
#4 0x0824ab83 in (anonymous namespace)::renderImage(SceneState*, SceneRenderImage*) (state=0x40cf7c08, image=0x40cf9608) at sceneGraph/sceneState.cc:106
#5 0x082487cf in SceneState::renderCurrentImages() (this=0x40cf7c08)
at sceneGraph/sceneState.cc:480
#6 0x08236c3c in SceneGraph::traverseSceneTree(SceneState*) (this=0x40989498,
pState=0x40cf7c08) at sceneGraph/sceneGraph.cc:457
#7 0x08235a7b in SceneGraph::renderScene(unsigned) (this=0x40989498,
objectMask=4294967295) at sceneGraph/sceneGraph.cc:193
#8 0x08144350 in GameRenderWorld() () at game/game.cc:1124
#9 0x081503bb in GameTSCtrl::renderWorld(RectI const&) (this=0x2,
updateRect=@0xbffff770) at game/gameTSCtrl.cc:43
#10 0x0811bc0e in GuiTSCtrl::onRender(Point2I, RectI const&) (this=0x40ae0e68,
offset=0xbffff720, updateRect=@0xbffff770) at gui/guiTSControl.cc:147
#11 0x081505ed in GameTSCtrl::onRender(Point2I, RectI const&) (
this=0x40ae0e68, offset=0xbffff780, updateRect=@0xbffff770)
at game/gameTSCtrl.cc:78
#12 0x080ee7ee in GuiCanvas::renderFrame(bool) (this=0x405f2798,
preRenderOnly=false) at gui/guiCanvas.cc:1183
#13 0x08132243 in DemoGame::processTimeEvent(TimeEvent*) (this=0x4e,
event=0xbffff8d8) at game/main.cc:691
#14 0x0822d425 in GameInterface::processEvent(Event*) (this=0x841eb40,
event=0xbffff8d8) at platform/gameInterface.cc:72
#15 0x0822d5b9 in GameInterface::postEvent(Event&) (this=0x841eb40,
event=@0xbffff8d8) at platform/gameInterface.cc:153
#16 0x082f2462 in TimeManager::process() ()
at platformX86UNIX/x86UNIXWindow.cc:799
#17 0x08131d89 in DemoGame::main(int, char const**) (this=0x85f3e00, argc=1,
argv=0x405fb3d8) at game/main.cc:489
#18 0x082f263f in main (argc=1, argv=0xbffff9a4)
at platformX86UNIX/x86UNIXWindow.cc:852
#14
01/14/2003 (5:41 am)
Hrm I've only had one issue relating to using the lightmap lookup tables but it only reared it's head under oddball circustances so I haven't tracked it down yet. Perhaps this is related...
#15
01/14/2003 (6:37 am)
I just realized that the line numbers may be off due to the comments I added to disable the asm renderer.

the line where it segfaults should be this one:

dstcol[i] = alphaTable[index | srcbits[i]];
#16
01/14/2003 (9:44 am)
Yep sounds like the bug I found but haven't fixed yet. There's a define something like "USE_LIGHTMAP_TABLE_AT_2" that you can set to false that should clear it up at the expense of some extra integer math.
#17
01/15/2003 (2:39 am)
Hm, I found the USE_ALPHA_TABLE_AT_* defines, but they don't change a thing.

But, the crash is only happening with some maps, while others run fine. I even found one map that starts up fine, but crashes later on.
#18
01/15/2003 (5:44 am)
Hmmm looks like I'll have to dig into the alpha map code and get a better handle on what's going on. I know how I can reproduce it so when I get a shot I'll dig into it.
#19
06/14/2003 (6:23 pm)
Just as an FYI... These instructions are wrong. I've got to do some digging.
#20
11/04/2003 (2:06 pm)
Bump on this post to find out if anyone found a way of doing it well and not dropping too many FPS without going as low level as assembler...

Help me! I'm on a desert island with lots of stripey rocks :)
Page «Previous 1 2 3 Last »