Static Geometry settings in Ofusion? [SOLVED]

Evak

23-07-2007 00:51:32

Hi, I was wondering if the static geometry settings could be explained. I'm currently getting unpredictable results. Here's the steps I tried:


1) I set a group name for similar terrain meshes that share the same materials. This is in the Ofusion Object settings menu.

2) I check the export static geometry groups in the export dialogues.

3)make sure all the items in my scene I want to export are checked, and press the export button.

The problem is that on loading the scene in my app, all the static geometry meshes have disappeared. I have kept the default region dimensions, and tried ranges of 0, 500, 1000

If I hide all of my scene other than a light and a mesh, and assign the single mesh to a static geometry group, sometimes it does seem to draw in my app. Multiple meshes in the scene usualy result in the staticgeometried not working.

The docs are very brief and do not explain what the settings are and how they work with one another. So at the moment I'm uncertain whether I am doing static geometry incorrectly, or whether static geometry is broken.

The Ofusion Help file contains the following information:

Static Geometry


Export Static Geom Groups

If active, objects that are part of Static Geometry groups will be exported as Static Geometry.

Rendering Distance

Cast Shadows

If active, Static Geometry will cast shadows on the scene.

Region Dimensions

Defines the size of each Static Geometry region, values will depend on the type of scene and objects that are part of the Static Geometry groups



My understanding is that with static geometry, static meshes in your scenery that are put in the same static geometry group are split into batches that share the same material, and all triangles sharing the same material are grouped together into one batch to increase efficiency.

I'm uncertain what the distance range is for, and think that maybe the region size determines the largest area of the scene that the batches can be split into.

My main concern at the moment is that the meshes are not displaying in my app when the export static geometry groups is checked. I would like to know what the correct function of the other settings too.

I'm not sure if this is a PRO only feature, but since the docs do not cover the subject well, I think this post would be a usefull resource for others too.

Thanks :)

Lioric

24-07-2007 02:37:23

The static geom creation process you are doing is correct, you can add other objects with different materials if needed (they will create a different internal bucket in the static geom group)

The 'Rendering Distance' value sets the distance at which static geom batches are no longer rendered, this might be your problem if you are using a small value (it seems you use a 1 unit == 10,000cm in your scenes, you need to use a sensible 'rendering distance' value here)

The region dimensions are used to partitionate the static geom in 'regions' of the specified size (this sets the physical world size of each region), used to cull segments when they are not in the frustum of the camera (this can be fine tuned later as you optimize your scenes)
Entities will be fitted within the batch they most closely fit, regions are allowed to overlap if needed

About the meshes not being displayed in your applciation, have you tested with multiple simple objects assigned to the same SG group?
Create some objects (10 or 20) with a simple material, and add them to the SG, do they get displayed in your application?

Evak

24-07-2007 05:08:52

Hi I tried as you suggested and I do get to see the simple boxes for an instant on load. I made a quick video to show what happens.

http://www.kineticrealities.com/static.wmv

Is there anything you can think of that would cause the static geometry to disappear suddenly on load?

Evak

24-07-2007 20:29:54

Our lead coder thinks they found the problem. were using a custom Bmax wrapper, and she added static geometry early on when first learning Ogre. Was Blitzmax automatic garbage collection throwing out the static geometry after the meshes were loaded.

Evak

25-07-2007 21:39:54

OK static geometry works, but now we found we have a new problem. Our Terrain has shader materials with normal maps and shinyness values.

When exported as static geometry, the lighting on the terrain becomes static too so no specular shinyness as the camera moves around the scene. Is this normal behaviour?

Lioric

25-07-2007 22:13:50

It might be because the static geometry generator (in Ogre) dont uses any other vertex buffer than pos and normals (and you need the tangents) when creating the SG, i will review if this is the case

Evak

25-07-2007 23:14:27

thanks lioric, hope it can be made to work.

Evak

09-08-2007 21:14:36

I have been looking into this problem some more today, and posted in the main forum...

http://www.ogre3d.org/phpBB2/viewtopic. ... 193#242193

Sinbad did his own quick test with his own media and didn't seem to have the same problem. I was wondering if this could possibly be related to the normal smoothing issues were having with shaders in Ofusion? or something else.

I put a 5mb zip together with an app and two OSM files. One that has static geometry and the other does not.

Lioric

10-08-2007 02:49:02

If the objects shows correct results when they are entities but not when added to the SG, then you might need to test what the SG is generating, probably it changes the tangents to another buffer when constructing the static geometry, and your shader might need a specific buffer stream

Evak

10-08-2007 17:35:12

Ok, Sinbad had a look and said

I've had a quick look, and your shaders are rather inefficient because they're passing camera position and light position in world space then inverse transforming it, instead of using the object space positions in the first place (camera_position_object_space / light_position_object_space). I tweaked that and it seemed to work.

Going to see if we can figure out what it is exactly that he is saying, but thought it worth posting here incase someone else has similar problems.

UPDATE:

Sinbads suggestion worked and now we have materials displaying correctly on static geomatry :). We removed the parameters that are commented out, and edited the shader code to support a couple of new parameters and all is good now. The shader itself is simpler and hopefully a little better optimized now.

{
//param_named_auto lightPosition LIGHT_POSITION 0
param_named_auto wvp WORLDVIEWPROJ_MATRIX
//param_named_auto worldI INVERSE_WORLD_MATRIX
//param_named_auto viewInv INVERSE_VIEW_MATRIX
//param_named_auto camPos CAMERA_POSITION
param_named_auto camPosObj CAMERA_POSITION_OBJECT_SPACE
param_named_auto lightPosObj LIGHT_POSITION_OBJECT_SPACE 0


}

katzenjoghurt

18-09-2007 23:45:15

Wanted to play around with the static geometry option today .... yet, it's greyed out ... is it a pro-only feature or did I do something wrong?