Camerapick + Terrain = bug?

Archives Forums/Blitz3D Bug Reports/Camerapick + Terrain = bug?

Tab(Posted 2007) [#1]

I have a problem with terrains and camerapick, in some cases the "Pickentity()" don't return anything, the "PickedX/Y/Z()" only return the value of the last point where "pickentity" return something... see the example. ( In some closed angles the terrain literaly don't exist )

Move the mouse slowly over the surface of the terrain and check the PickedEntity value...

Please fix, this problem kill my terrain editor. T_T

Tested in B3D 1.99 - Win XP SP2 - DX9.0b - GF7600GS

I tried also with ver.1.98~1.85 and the result is the same.

Graphics3D 640,480,0,2
SetBuffer BackBuffer()

PositionEntity camera,0,2,-10

RotateEntity light,90,0,0

EntityPickMode plane,2,True
PositionEntity plane,-60,-10,-10

While Not KeyDown( 1 )

If KeyDown( 205 ) Then TurnEntity camera,0,-1,0
If KeyDown( 203 ) TurnEntity camera,0,1,0
If KeyDown( 208 ) MoveEntity camera,0,0,-0.05
If KeyDown( 200 ) MoveEntity camera,0,0,0.05

If MouseDown(1) CameraPick(camera,MouseX(),MouseY())


Text 0,40,"PickedX: "+PickedX#()
Text 0,60,"PickedY: "+PickedY#()
Text 0,80,"PickedZ: "+PickedZ#()
Text 0,100,"PickedNX: "+PickedNX#()
Text 0,120,"PickedNY: "+PickedNY#()
Text 0,140,"PickedNZ: "+PickedNZ#()
Text 0,160,"PickedTime: "+PickedTime#()
Text 0,180,"PickedEntity: "+PickedEntity()
Text 0,200,"PickedSurface: "+PickedSurface()
Text 0,220,"PickedTriangle: "+PickedTriangle()




Tab(Posted 2007) [#2]
Can someone please confirm this bug? T_T

big10p(Posted 2007) [#3]
I've never used terrains but it does appear to be a bug, yes.

John Blackledge(Posted 2007) [#4]
You mean other than the fact that you've got RenderWorld before UpdateWorld?

Tab(Posted 2007) [#5]
Wow, i put Updateworld in the example @_@... removed.

Anyway, Renderworld befor Updateworld don't change anything about the bug, the problem still exist.

John Blackledge(Posted 2007) [#6]
Sorry? You've removed UpdateWorld?

Then you've removed the workhorse of Blitz3D that does all the calculations.
Check the code structure of any of the examples that come with Blitz3D.

Tab(Posted 2007) [#7]
John is only a example... the only important thing here is the BUG with Camerapick or Linepick (without radius) with terrains.

big10p(Posted 2007) [#8]
John: you only need to call UpdateWorld if you're using animated models or collisions.

John Blackledge(Posted 2007) [#9]
Big10p - or if you need Blitz to update its internal settings and return the correct values after a MoveEntity, TurnEntity etc.
But you guys carry on as you are.

DJWoodgate(Posted 2007) [#10]
It is affected by Camerarange as well, which suggests a possible workaround, because what is a singularity at one range setting will probably not be at another one, so do two or three picks with altered camera range.
The same might be the case with linepick though I have not tried it. Extend the pick vector a bit and have a few cracks at it to be sure there really is nothing there.
Not ideal of course because picks are expensive, but c'est la vie.

Ross C(Posted 2007) [#11]
Hmmm, i think the problem might arise from the LOD aspect of terrains. Since the terrain is always changing LOD when the camera is moving, it might create oddities in the terrain.

TBH, even though this is a bug, i would recommend changing to a mesh. Far more control over it :o)

Tab(Posted 2007) [#12]
I can't change to a mesh for several reasons... T_T

Ross C(Posted 2007) [#13]
Can you explain them and we can see if there are any workarounds :o)

Tab(Posted 2007) [#14]
I created a system to paint terrains ( with textures ), and i use Camerapick to select where is applied, but with this problem some times don't work well.

Ross C(Posted 2007) [#15]
You could probably do that with a mesh easier i reckon.

Tab(Posted 2007) [#16]
But with a mesh i can't use the LOD sys, and in my game i need only spend 800~1000 polys in the terrain.

Ross C(Posted 2007) [#17]
The problem is, the amount of time the computer spends with the LOD aspect of terrains, you could easily have a mesh at least twice as detailed as the blitz terrain.

Tab(Posted 2007) [#18]
Hmm... maybe is better a terrain with more polys than a terrain with LOD... anyway, this don't change the existence of the BUG.

Ross C(Posted 2007) [#19]
That's true man. Seems like a definate bug to me.

jfk EO-11110(Posted 2007) [#20]
Does the "radius" parameter have any impact on this behaviour?

I don't remember any problems like that, and I was working with terrains + Linepicks several times.

Tab(Posted 2007) [#21]
The "radius" only works in some cases... but the problem persist when the "hole" is bigger than radius.

jfk EO-11110(Posted 2007) [#22]
The radius parameter is for LinePick only, not for CameraPick, so pls excuse my fault. I do confirm the existance of this bug. You may try to emulate a camerapick using a linepick, probably this will fix it.

Or do 5 camerapicks (neighbour pixels) instead on only one to recognize holes and do some kind of workaround.

Tab(Posted 2008) [#23]
Yep, but i'm try to avoid the linepick... anyway, i have a much better result now with a terrain mesh ( Thx Ross C )...