ModifyTerrain - RealTime Parameter MAV

Archives Forums/Blitz3D Bug Reports/ModifyTerrain - RealTime Parameter MAV

The_Nici(Posted 2010) [#1]
Hello.
The following code crashes Blitz3D on my computer:
Graphics3D 800,600,32,2
SetBuffer BackBuffer()
terr = CreateTerrain(512)
ModifyTerrain terr, 32,32,1.0,True
WaitKey()
End


Hardware/Software Specs:
OS: Windows 7 Ultimate x64
GPU: ASUS ENGTX480 (nVIDIA GTX480)

Adding TerrainDetail before the ModifyTerrain call does not solve the problem, just as a sidenote.

Is this a bug in Blitz3D?


dawlane(Posted 2010) [#2]
I think that this has something to do with how Blitz3D works though I will have a wild stab and say that before you can use realtime update of the terrain you have make sure the scene has been rendered once before hand.

Graphics3D 800,600,32,2
SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,(32*10)/2,50,0
RotateEntity camera,30,0,0

light=CreateLight()
RotateEntity light,90,0,0

terr = CreateTerrain(32)
ScaleEntity terr,10,50,10

grass_tex=LoadTexture("mossyground.bmp") ; Use your own image here
EntityTexture terr,grass_tex

RenderWorld
WaitKey()
ModifyTerrain terr,16,16,1.0,True
RenderWorld
Flip
WaitKey()

End



_Skully(Posted 2010) [#3]
Don't you just have to updateworld before rendering it? The MAV is probably a disparity between whats on the graphics card and whats in the memory.

I seem to recall something like this from when I wrote TerraScape (now lost code) so many years ago... back in the "tracer" days. It was a custom terrain solution that wouldn't hold up against whats out there now! I seem to recall having to call UpdateWorld after any terrain changes.


dawlane(Posted 2010) [#4]
The problem is when ModifyTerrain's realtime flag is set to true. Using UpdateWorld or RenderWorld after the ModifyTerrain command with the realtime flag set just causes the MAV, but if you use RenderWorld (note the UpdateWorld doesn't work on it's own you still have to use RenderWorld) before the ModifyTerrain command with said flag set it does.
Graphics3D 800,600,32,2
SetBuffer BackBuffer()

camera=CreateCamera()
PositionEntity camera,(32*10)/2,50,0
RotateEntity camera,30,0,0

light=CreateLight()
RotateEntity light,90,0,0

terr = CreateTerrain(32)
ScaleEntity terr,10,50,10
h# = TerrainHeight(terr,16,16)

grass_tex=LoadTexture("mossyground.bmp") ; Use your own image here
EntityTexture terr,grass_tex

While h# < 1.001
        UpdateWorld        ; The manual says this updates Animation and Collisions but can be omitted in this example as it will still work
	RenderWorld
	ModifyTerrain terr,16,16,h#,True
	Text 0,0,h#
	Flip
	h# = h# + 0.001
Wend

WaitKey()
End



The_Nici(Posted 2010) [#5]
hm. That's weird.
Thanks. But I think I'll stop using B3D anyways, I don't see any sense of keep programming in it when bug reports pop up now every day and the only answers are workarounds. :(