Occlude Big Mesh Parts

Blitz3D Forums/Blitz3D Programming/Occlude Big Mesh Parts

KuRiX(Posted 2005) [#1]
Well, i have been testing the auto hide system that B3D has. All of us know that if you load several objects, those behind the camera are not rendered.

Then i tried to make two separate spheres in only one mesh in 3dsmax. Then export it to .b3d with b3d pipeline. I thought that if i rotate the mesh so only one sphere is in front the camera, only that should be rendered, but don't. If one is rendered, then the whole mesh is rendered.

This, for creating big maps is very undesirable. The only solution should be to export "one by one" every separate mesh. ( i am not that crazy).

What is the solution then?

EDITED: LoadAnimMesh seems to do the job...


Neochrome(Posted 2005) [#2]
break up the levels in to smaller peaces... basically i had the same problem, I got around it by just using an array (uses lots of ram though)

imagine a cube, and your in the middle of that cube, the sector your in has 1 room, you show that where as you wont need to show the others around you as you move around the cube space the world hides and shows the objects closest to you in that cube

dim worldcube(255,255,255) holds the point to each mesh
this takes time to do though, but the result is a very fast level (only use alpha 0 and alpha 1 for hiding a showing cos this is faster AND objects on the other "cubes" will still need to check their positions and posible collisions


PHEW! i hope this helps?


KuRiX(Posted 2005) [#3]
Well, when loading using animmesh i get a surface occlusion system, which is very good. But i have 2 questions:

- How can i apply a lightmap when loading with animmesh? (i think i can't, perhaps with prerrendered textures...)

- Any other slowdown or problem relative to loadanimmesh?


jfk EO-11110(Posted 2005) [#4]
You have to do linepicks to all children etc. You need to use recursive access for all kinds of mesh commands (see my code snippet in the archive about how to use EntityAlpha etc. with animated Meshes). I'd suggest to put all children, no matter what generation, into a simple 2 dimensional array container, so you don't have to call recursive stuff to check linepicks on the map geometry, instead simply go trough an array (or type list).

I still have a plan to write a VIS compiler, using the clusterize Code I wrote some time ago (archives too). But I still need to make it work with all kinds of mesh attributes, like alpha textured parts etc. If somebody would help me to make it capable of clusterizing ANY mesh correctly, I would implement a new version of my ICU VIS Compiler for just this Map Clusterizer. It would be much more efficient since it would hide all clusters that cannot be seen from the players current cluster, not only the ones behind the camera. Huge Levels would be possible.


KuRiX(Posted 2005) [#5]
The mesh has 15.000 polys, and when loaded with loadanimmesh only 2000 are drawn at a time! This is a gain of 5ms of execution when calling renderworld, what it amazing!

I don't need too much access to those sub-meshes. They are for the map. Although i was using linepick for the lens flare effect.

Then the most important question, what about lightmapping the level?. Can i use gile[s] (i have bought a license)?.


jfk EO-11110(Posted 2005) [#6]
AFAIK Giles Meshes handle both, LoadMEsh and LoadAnimMesh correctly. If you assign a lightmap manually, you may have to assign it to all children, recursively, as I explained before. Make sure to assign them only to Mesh Children, not to EG. Pivot Children. What you basicly have is Camera Range Culling and Fustrum Culling.

But how about to load a Level with 400'000 Tris and have full 60 FPS? It's possible with true Occlusion. (Tho there's a 16 Bit max of tris and vertices for each surface / child)


KuRiX(Posted 2005) [#7]
Thanks jfk.

I know that i am doing culling. But how to do true occlusion? I have seen your code, but i think is not working 100%?.

Anyway my main problem is i have 200 256x256 textures, so not drawing 10.000 polys gives me a very big speed increase!.

This are really good news because my Full racing game with ode, lens flare, multiplayer, and full map of my country is running at 100 FPS! (too much optimizations, hehe)


John Blackledge(Posted 2005) [#8]
Hold on, before you guys get to discussing culling (which always gives me a headache), can I just understand - are you saying that a large mesh, such as a mesh terrain is automatically culled by Blitz if it is loaded with LoadAnimMesh()?


KuRiX(Posted 2005) [#9]
Well not exactly, John. I have a large map, created from lot of cubes, spheres, etc...

Then If you export it without creating one only big mesh (joining all the meshes), then blitz makes the culling when loaded with loadanimmesh, which is great!.


Ross C(Posted 2005) [#10]
If you are using linepick, use a lower poly mesh, rendering with alpha = 0 for the linepicks and collsions. It will be faster :o)


KuRiX(Posted 2005) [#11]
Yep, i thought to create some kind of bounding box for the map. Thanks for the tip!


AdrianT(Posted 2005) [#12]
anyone tried the occluder obscurer part of the b3d pipeline extensions? havent gotten round to using them yet myself, and was just curious as to how well it worked?


John Blackledge(Posted 2005) [#13]
"If you export it without creating one only big mesh (joining all the meshes), then blitz makes the culling when loaded with loadanimmesh,"

Don't understand this.
How can you export without first using Addmesh on all the individual meshes? - Then loading back one mesh with LoadAnimMesh.

Can you explain how you are doing this, please.


KuRiX(Posted 2005) [#14]
Sorry i didn't answer before John.

You export without adding all the meshes into one single mesh. This is no difficult, because you just don't do it :D

Suppose you use 3dsmax. You create 5 cubes, like buildings. You export then the file with b3d pipeline. Then in b3d you do:

map = loadanimmesh("buildings.b3d")

And B3D will load all the meshes as parented entities to the "map entity", so you will have automatic occlusion for your map.

P.D: I have tested gile[s] with this method, and works perfectly!. I have reduced the 11ms of RenderWorld of my map to 3 (the middle value of course)!!!

Cheers, KuRi!


John Blackledge(Posted 2005) [#15]
Well I don't use 3DSMax, but I do intend using very big mesh terrains.

I'd always thought that I would have to create and load each mesh separately (to achieve Blitz's occlusion) but from what you are saying it seems that if they are each a child of a parent node then occlusion will happen anyway.

This opens up possibilities...... Thanks.


Matty(Posted 2005) [#16]
Without wanting to sound too pedantic: Isn't culling what you are talking about, not occlusion - I thought culling is where triangles not facing the camera or in the camera frustrum are hidden, while occlusion is where say a monster behind a door that you are looking at is not rendered (which you have to get it to do with code because blitz doesn't automatically do that).


KuRiX(Posted 2005) [#17]
Of Course Matty is right. I tend to use the word occlusion for every triangle hide method, but the correct definition is what Matty Says!

Anyway, if the frustum is making that hard work for us, God saves the Frustum!

Occlusion can be done with linepicks...


big10p(Posted 2005) [#18]
Frustum, damn it, FRUSTUM! :)

Why does everybody spell that wrong?! :P


John Blackledge(Posted 2005) [#19]
Go on Matty, go for it -
Tell us the meaning of both words (seriously).


KuRiX(Posted 2005) [#20]
Right Again. Post edited :D


Mustang(Posted 2005) [#21]
Culling

This is where vertices, primitives, or surfaces are removed from the rendering process on the basis that they are not visible from the camera's point of view. Culling can be performed by the graphics adapter (after vertex processing and before rasterisation) or it can be done by the software creating the graphics.



Occlusion (Graphics)

This is where a visible object blocks (occludes) one or more other objects from the view of the camera; the occluded objects should not be rendered (unless the front one blocking the others is slightly transparent) as they are not visible. To avoid wasting valuable resources rendering occluded primitives, some form of occlusion culling needs to be employed. Most 3D games do this before sending anything to the graphics adapter, which then handles the rest.



http://www.futuremark.com/community/hardwarevocabulary/

'Nuff said! :)


AdrianT(Posted 2005) [#22]
yeah, pipeline lets you place occluder obscurer primitives in max which occlude everything who's bounding box is hiden by the obscurer.

At one time I was thinking of using the Xrefs pipeline extension for streaming scenes and objects off of the HD. Blitz3D is too slow, but might be possible with blitzmax if a bmax port of the extensions is ever made.