World Scale Confusion !!

Blitz3D Forums/Blitz3D Beginners Area/World Scale Confusion !!

Jamie(Posted 2004) [#1]
Greetings,

I have run into a problem that I have been ignoring and now is causing me some troubles.

First a little background:

I have a tiled mesh that I am using as a terrain and have enclosed it into a skybox. I am trying to allow the user to fly both close to the terrain and high above the terrain.

Now the problem:

To allow for the "greater viewing area" when flying high, I have increase my camera's range. With tiling 3 meshes plus the skybox plus other entities I have an obscene camera range!!! I know it is good practice to limit your camera range to something small (4 decimals or less) for position accuracy and to eliminate tearing. The quesiton I have is how do I go about scaling my whole world down to a mangageable size?

Here are a few "specs"

MeshWidth-> 121212 (according to Blitz's MeshWidth Command)
CameraRange-> 1 to 559000 (Ouch I know)


Additionally, each of the tiled meshs are CopyMesh'd from an original source mesh.I currently do not perform any ScaleMesh or ScaleEntity calls. Overall performance is decent but I have not achieved the viewing distance that I desire. Any help would be greatly appreciated!!

Thanks

Jamie


Rob Farley(Posted 2004) [#2]
You shouldn't need to increase the size of your skybox as that is just set to draw first.

With regards to your mesh widths, is there any reason why you can't just scale it down?


Jamie(Posted 2004) [#3]
Thanks for the reply Rob...

Maybe the code I am using for the skybox is not implemented correctly as I went back and do not see any entityorder commands. I assume this is the way to make it "draw first" and then I can draw everything else. FYI my "radius" of my sckybox is set to 440000 right now.

As far as the mesh widths, would I use scaleentity or scalemesh? One scale the entity while the other scales the meshes vertices. Not sure which one I would use. If I do scale the meshes appropriately then I assume I could turn down the camera range to an appropriate level.

Any additional help would be appreciated..
Thanks

Jamie


Rob Farley(Posted 2004) [#4]
Yep

Your skybox quite frankly only needs to be 1x1x1, put it in the same place as the camera, you've got 2 ways of doing this, either parent it to the camera or position it in the same place as the camera, both ways will need 1 line of code. If you position it, you need positionentity skybox,entityx(cam),entity(cam),entityz(cam) if you've parented it to the camera then in your main loop you need rotateentity skybox,0,0,0. Set the entity order so it draws first and forget about the skybox from there.

If your meshes haven't got bones in them youse the scalemesh command once before your main loop. If you're scaling thing in real time within in game loop use scaleentity. Also if your mesh has bones in it, then use scaleentity as scalemesh only scales verts and not the bones.


Jamie(Posted 2004) [#5]
If I make the skybox 1,1,1 then what happens to things that are larger than the skybox? Like my terrain, how will it appear? Additionally, do I need to set the entityorder for the skybox?

Thanks for all of your help, any additional help is greatly appreciated.


Thanks

Jamie


Rob Farley(Posted 2004) [#6]
You set the entityorder of your skybox using the entityorder command

entityorder skybox,100

Entityorder stops zbuffering being used so don't worry about things that are larger, the skybox will be drawn first then your terrain and stuff will draw normally over the top of it.

Imagine the skybox as the cls.

Speaking of which, you can switch the camera cls off if you've got a skybox.


Jamie(Posted 2004) [#7]
I am using skybox code from one of the B3D examples and it includes a FitMesh for the skybox. I assume I should remove that also. It appears that is where my radius was being used for sizing.

I will try the entityorder and cls off and post results.


Thanks,

Jamie


Rob Farley(Posted 2004) [#8]
Just look at the skybox in the castle demo.


Jamie(Posted 2004) [#9]
I have the skybox working now (I think at least). Now I just need to work on the scaling things. Additionally, since I am tiling meshes for terrain, I sometimes get some significant popin with the mesh tiles. I was considering fading them in or something along that lines to provide a more pleasing effect. Any thoughts?

Background:

I am using a 3 x 3 set of tiles and an infinite plane just beneth the tiles to provide a "look" of a larger terrain- like this.

pppppppppppppppppppppppppppp
pppppppppppppppppppppppppppp
ppppppppp T T T pppppppppppp
ppppppppp T C T pppppppppppp
ppppppppp T T T pppppppppppp
pppppppppppppppppppppppppppp
pppppppppppppppppppppppppppp

p=plane
T=Tile
C=Camera and Tile

I have the tiles replicating once I exceed in any direction a 1 tile buffer around the camera. But when I do this the tile "pops" onto the scene and it looks kida weird. I tried using fog but it obscured the infinite plane so that the terrain then appeared out of nowhere, with the plane it atleast gives the impression of a large area of land. Any thoughts would be greatly appreciated.


Thanks

Jamie


Rob Farley(Posted 2004) [#10]
Right...

if the centre of your mesh is in the centre of mass of your mesh what you can do is this...

Say your mesh goes from -10 to 10 with a middle of 0.

Your fog range goes from 20 to 30

Your camera range from 0 to 40..

Why 40?
Well, your mesh will pop into view when the middle of it is within the 40 of the camera range, this means that it will extend from 30 to 50 (-10 to +10 +40).

Because your fog range is 30 your mesh will be invisible when it pops in.


Jamie(Posted 2004) [#11]
I see, but I am controling when I show or hide the meshes. Whenever I crss a tile border, I show the 9 tiles that the tile you are on touch. Therefore I am not sure how to use fog when the tiles are mostly within the range of the camera to begin with. Another thought I had was to increase the number of tiles around the camera to 25 instead of 9, but that will probably add a huge amount of polys to the rendering process..

Jamie


Jamie(Posted 2004) [#12]
Looks like I have it all solved now... Thanks Rob!



Jamie