Crystal Space
Welcome, Guest. Please login or register.
October 24, 2014, 02:27:17 pm

Login with username, password and session length
Search:     Advanced search
9011 Posts in 2044 Topics by 8814 Members
Latest Member: Chicachi
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Projects
| |-+  Project Discussion
| | |-+  Visibility Culling
« previous next »
Pages: [1] 2 Print
Author Topic: Visibility Culling  (Read 14331 times)
mik
Newbie
*
Posts: 36


View Profile Email
« on: November 06, 2008, 12:40:07 pm »

Hi again,

i'm now starting myself with the culling process, but i am not understanding very well how to use it programing the world and meshes. Could you tell me how to use the methods that i need to insert the culling while programming objects (not reading them from a file)? I'm a bit lost in the API about this.

Thanks!
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #1 on: November 06, 2008, 12:41:49 pm »

You don't do culling. That's something the engine does. You don't have to worry about it at all. It is automatic.

Greetings,
Logged
mik
Newbie
*
Posts: 36


View Profile Email
« Reply #2 on: November 06, 2008, 01:18:11 pm »

Thanks, thats good news XD How can i improve the performance of my world? I supose that i have to use the event handler system, isn't it? What is automatic in the engine in order to obtain better performance?
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #3 on: November 06, 2008, 01:27:18 pm »

The event handler system has nothing at all to do with performance. That's just a way to handle events like keyboard presses and frame events (i.e. when to start rendering your frame).

As to performance. There are a number of tutorials on the CS site that might be useful for you. Especially http://www.crystalspace3d.org/main/ArtistBestPractices_Tutorial and http://www.crystalspace3d.org/main/EfficientTextures_Tutorial. Also in the main manual you can find a section on how to create optimal maps: http://www.crystalspace3d.org/docs/online/manual-1.2/Map-Creation.html#0.

If you still have questions after reading all that then please ask them here.

Greetings,
Logged
mik
Newbie
*
Posts: 36


View Profile Email
« Reply #4 on: November 10, 2008, 11:28:26 am »

Hi Jorrit,

i have done a test creating an object bigger enough in order to hide all the objects behind, but the culling are not doing anything (i have problems with the speed). Should i load any plugin or something similar? How can i activate or make sure that is activate the culling plugin?
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #5 on: November 10, 2008, 11:31:34 am »

Well the default culler (frustvis) doesn't do occlusion testing. So putting big objects in front will not help. Typically that is also not the good way to handle this problem. Most of the times it is better to work with sectors (if possible).

If you really want occlusion testing you can switch to dynavis culler. That is however rather expensive on its own so it is not always a good choice.

Greetings,
Logged
mik
Newbie
*
Posts: 36


View Profile Email
« Reply #6 on: November 10, 2008, 12:24:37 pm »

I had been reading about dynavis and i think that i have to use it because i'm using complex worlds. I don't know how it works, may be using a iVisibilityCuller for the sector and then including in it objects with iVisibilityObject? But how can i obtain the iVisibilityObject from a general mesh object? How can i load the plugin, with csLoadPluginCheck?

If you have some example it could be a good way to start.

Thank!
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #7 on: November 10, 2008, 12:39:39 pm »

You specify dynavis in your level. Do you create your levels with blender? In that case it is an option in b2cs.

Greetings,
Logged
mik
Newbie
*
Posts: 36


View Profile Email
« Reply #8 on: November 10, 2008, 01:57:56 pm »

No, i'm using a data structure, so i have points asociated to an object and i'm creating everything programming, no loading from a file. For example, in one type of objects i set the points of that object:

...
for (int j=0; j<(vertex_size); j++, count++)
   {
      P3D_Vertex* vert = polygon->Get_Vertex_List()->at(j);
      factstate->GetVertices ()[count].Set
         (vert->Get_Coord_X(),vert->Get_Coord_Y(),vert->Get_Coord_Z());
   }
...

So i need use the dynavis culling programming too.
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #9 on: November 10, 2008, 02:00:06 pm »

In that case look at iSector->SetVisibilityCullerPlugin(). That function expects a name which should be something like 'crystalspace.culling.dynavis'.

Greetings,
Logged
mik
Newbie
*
Posts: 36


View Profile Email
« Reply #10 on: November 11, 2008, 10:58:19 am »

Thank you very much, that was what i needed.
Logged
mik
Newbie
*
Posts: 36


View Profile Email
« Reply #11 on: December 01, 2008, 11:15:34 am »

Hi again,

i have been working with the culling but with some of my objects i have this problem:

WARNING! Object 'MySprite2' is not closed!

I have been trying the methods csPolygonMeshTools::IsMeshClosed, csTriangleMeshTools::IsMeshClosed, csPolygonMeshTools::CloseMesh and csTriangleMeshTools::CloseMesh, but i couldn't find a solution.

What could be the problem? How can i resolve it?
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #12 on: December 01, 2008, 11:19:49 am »

Don't worry about it. It is only a warning and doesn't cause any problems.

Greetings,
Logged
mik
Newbie
*
Posts: 36


View Profile Email
« Reply #13 on: December 01, 2008, 11:52:56 am »

But depending on where i put the camera i see polygons behind nearest and in some places while moving the camera i see changes about what polygon i see. Polygons are too close, but i thought that the problem was about that warning. Any idea?
Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #14 on: December 01, 2008, 12:27:23 pm »

Do you use transparent (or semi-transparent) objects? i.e. objects with keycolor textures or alpha textures.

And what do you mean exactly by 'polygons are too close'?

Greetings,
Logged
Pages: [1] 2 Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.229 seconds with 19 queries.