Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: 1 2 3 [4] 5
  Print  
Author Topic: TVSM  (Read 9435 times)
Raul
Customers
Community Member
*****
Posts: 394


« Reply #60 on: May 17, 2008, 04:44:27 AM »

today i recode and same result.

here is my code:

Code:
        ' create the scene
        MyadvancedScene = New TVSceneManager.AdvancedScene(New TV_3DVECTOR(-500, -5, -500), New TV_3DVECTOR(500, 200, 500))
        MyadvancedScene.SetSceneTree(8, 40)
        MyadvancedScene.OcclusionResolution = New TV_2DVECTOR(1024 / 2, 768 / 2) '512 384 (300, 225)
        MyadvancedScene.OcclusionActiveOccluders = 15
        MyadvancedScene.OcclusionMaxDistance = 250
        MyadvancedScene.OcclusionMaxQueries = 2000

after that I laod my Mesh (a grass model):

Code:
        Mesh(1) = New TVMesh
        Mesh(1) = Scene.CreateMeshBuilder("GrassMesh")
        Mesh(1).LoadTVM("..\..\data\grass.tvm", True, True)
        Mesh(1).SetScale(0.2, 0.2, 0.2)
        Mesh(1).SetBlendingMode(CONST_TV_BLENDINGMODE.TV_BLEND_ALPHA, -1)
        Mesh(1).SetAlphaTest(True, 128, True, -1)
        Mesh(1).SetCullMode(CONST_TV_CULLING.TV_DOUBLESIDED)
        Mesh(1).EnableFrustumCulling(True)

and then I make a Loop to duplicate this mesh:

Code:
        Do While I < 8000
            x = RndInterval(-500, 500)
            z = RndInterval(-500, 500)

                Mesh(2) = Mesh(1).Duplicate("", True)
                Mesh(2).Enable(True)
                Mesh(2).EnableFrustumCulling(True, True)
                Mesh(2).SetPosition(x, 0, z)
                Mesh(2).SetRotation(0, RndInterval(0, 360), 0)

                Dim obj2 As MeshObject = New MeshObject(Mesh(2))
                MyadvancedScene.AddObject(obj2)
                obj2.OccluderData = Mesh(1)
                obj2.OcclusionEnabled = True

                I = I + 1
        Loop

My BIG problem is that when using CullingMode.FrustumCull I have 60 FPS. If I use CullingMode.OcclusionCull  I hev only 15 or 20 and if I use TVEngine.Scene.RendelAllScene I have almost 100 FPS.

I am pretty sure there is a bug in my code, but I cannot understand where..

By the way can someone explain to me what mens FrustumCull and what mens OcclusionCull  ?

Please help me Smiley

thanks
Logged
GD
Customers
Community Member
*****
Posts: 367


« Reply #61 on: May 17, 2008, 06:20:43 AM »

So... Occlusion properties are static members. http://msdn.microsoft.com/en-us/library/z2cty7t8(VS.80).aspx

Code:
MyadvancedScene.OcclusionActiveOccluders = 15
The above must be changed in:
Code:
AdvancedScene.OcclusionActiveOccluders = 15
But your MyadvancedScene variable stays.

Grass (or any transparent objects) must not be used in occlusion cull, so object.OcclusionEnabled should be false (as it is by default).
About occlusion culling:
http://www.gamedev.net/reference/programming/features/occlusionculling/

If your camera is looking the whole (or most of the) scene, what's the point of culling. Of course it will be slow(er).

You can find some help in intellisense, try using Object Browser in Visual Studio.

edit:
Also, you cannot compare performance of minimesh and lots of meshes (one draw call vs lots of draw calls). Minimesh always win.
« Last Edit: May 17, 2008, 06:22:52 AM by GD » Logged

tvsm.co.cc - TVSceneManager
Raul
Customers
Community Member
*****
Posts: 394


« Reply #62 on: May 17, 2008, 08:19:11 AM »

Thanks for the MSDN link. this is very useful.

Now back to your library. I understand from Gamedev link what is Occlusion.

But I think I still have some problems because if I am using simple FrustumCull I still have 60 FPS with 8000 objects on map, but if I use Tv3D culling method I have almost 100 FPS on 50,000 objects on map.

In your sample FrustumCull is better than Tv3D internal cull but in my code is not. Thats way I think I still have a problem. Cheesy
Logged
GD
Customers
Community Member
*****
Posts: 367


« Reply #63 on: May 18, 2008, 07:25:21 AM »

Hmm I dunno, maybe the library sucks Tongue. Screenshots with profiler enabled would help me to figure it out.
Logged

tvsm.co.cc - TVSceneManager
Raul
Customers
Community Member
*****
Posts: 394


« Reply #64 on: May 18, 2008, 07:33:53 AM »

Hmm I dunno, maybe the library sucks Tongue. Screenshots with profiler enabled would help me to figure it out.

profiler? what do you mean?? Cheesy
Logged
GD
Customers
Community Member
*****
Posts: 367


« Reply #65 on: May 18, 2008, 08:07:33 AM »

TVEngine.EnableProfiler(true)
Logged

tvsm.co.cc - TVSceneManager
Raul
Customers
Community Member
*****
Posts: 394


« Reply #66 on: May 18, 2008, 11:40:51 AM »

I see..
Well using Mesh Clone to create my scene I have this results:

Here is using your scene management:
http://img381.imageshack.us/img381/1106/screen00cb2.jpg

Here using Scene.RenderAll
http://img147.imageshack.us/img147/8043/screen11vw5.jpg

and here rendering 16.000 meshes (double that in first 2 cases) But if I try rendering 16.000 meshes using your TVAdvacedScene my app crash Smiley
http://img381.imageshack.us/img381/7425/screen0xs5.jpg

If I use MiniMesh to crete my scene... well with Scene.renderall I can go up to 50.000 minimeshses with decent FPS but with yout DLL only 15 Sad and I have to wait very long..

Hope this helps.
« Last Edit: May 18, 2008, 11:50:19 AM by Raul » Logged
sybixsus
Customers
Community Member
*****
Posts: 1094


WWW
« Reply #67 on: May 18, 2008, 10:39:50 PM »

Correct me if I'm wrong, Raul, but you appear to have blending enabled for all your rendered items in that scene? So in fact nothing is occluded at all? I would indeed expect an occlusion method to be slower if it cannot occlude anything. Essentially it takes time to examine the objects and see what does not need to be drawn, and then you save time by not drawing it. As long as it finds a few things, the speed benefit from not drawing stuff should be faster than the speed loss for examining the scene. But if, as seems to be the case in your screens, nothing can be occluded, there is no speed benefit possible.
Logged
Raul
Customers
Community Member
*****
Posts: 394


« Reply #68 on: May 19, 2008, 01:15:18 AM »

yes i have blending enabled..

but FrustumCulling is working like OcclusionCulling? I thought that FC is different. I read about Occlusion from GD's links and I already understand that if in my case i use Occlusion it's useless. But now I was talking about Frustum. Aren't this 2 processes different ?
Logged
GD
Customers
Community Member
*****
Posts: 367


« Reply #69 on: May 19, 2008, 02:33:29 AM »

Yes, frustum cull is different. But sybixsus is correct about culling.
Email me the code raul and I'll see what's wrong if anything is.
Logged

tvsm.co.cc - TVSceneManager
Raul
Customers
Community Member
*****
Posts: 394


« Reply #70 on: May 19, 2008, 04:30:22 AM »

oke. i will do this as soon i go home..
Logged
Raul
Customers
Community Member
*****
Posts: 394


« Reply #71 on: May 19, 2008, 10:36:53 AM »

GD. I send you a PM with my app.

thnaks Smiley
Logged
GD
Customers
Community Member
*****
Posts: 367


« Reply #72 on: May 21, 2008, 11:42:45 AM »

Haven't had much time to go through code but I found this:
Dim obj As MiniMeshObject = New MiniMeshObject(...) -> must go after minimesh creation (or before and then .Update at end), and not in loop where you position minimesh items. You were then creating 50000 minimeshes...

Otherwise I see no other errors. At the start I get same FPS as TV (maybe little better than TV), but position [0,0,0] is the bad case in kd-tree so it's ok. Walking farther FPS get higher. But yes, my transparency sort is slow Sad, I'll be optimizing it for next release.

EDIT:
Ahh! Yes yes I found something. Transparency sort is so damn slow with lots of meshes, and it's varying always which is not good. I'll change algorithm Wink, but anyhow - you will never have 5000 transparent meshes visible (if it's like grass it's gonna be minimesh).
Thanks for pointing me to find this.
« Last Edit: May 21, 2008, 11:52:11 AM by GD » Logged

tvsm.co.cc - TVSceneManager
Raul
Customers
Community Member
*****
Posts: 394


« Reply #73 on: May 21, 2008, 03:52:55 PM »

I am glad I can help you Tongue
Hope you will find quickly a solution and show us the new release when will be ready..
Logged
JohnB
Customers
Community Member
*****
Posts: 174


« Reply #74 on: June 12, 2008, 06:35:45 PM »

Hey GD - I was just wondering if you had any progress to report on version 9 or the alpha blending fix?

Thanks,

John B.
Logged
GD
Customers
Community Member
*****
Posts: 367


« Reply #75 on: June 13, 2008, 03:12:22 PM »

Sorry, haven't had any time to work on TVSM, million of activities currently... and Roberto is also busy...
Still, alpha sort is not a real bug, it's linear sort so that's why it's slow. I think nobody will have more than few hundreds alpha meshes visible in one frame (that are not minimesh) so it should be ok (for now Tongue).

I will keep you informed!
Logged

tvsm.co.cc - TVSceneManager
JohnB
Customers
Community Member
*****
Posts: 174


« Reply #76 on: June 13, 2008, 10:14:53 PM »

I probably should have said 'upgrade' instead of 'fix' about the alpha blending.

Thx for the udpate though & GL with your projects till you can get back to TVSM.

John B.



Logged
zajac
Customers
Community Member
*****
Posts: 6


« Reply #77 on: July 24, 2008, 02:46:00 AM »

Hi! Got a question - How to setup TVSM 0.85 to use with moving objects? I started with a cube registered  as a MeshObject, and I cannot update it - manual update() crashes with a null exception (SceneObject.cs at line 150) and automatic update doesn't seem to work at all (cube disappears as it starts to move around the scene)..

zajac

Edit:
Fortunately ActorObject seems to work just fine (manually updated) Smiley
« Last Edit: July 24, 2008, 03:58:48 AM by zajac » Logged
GD
Customers
Community Member
*****
Posts: 367


« Reply #78 on: July 24, 2008, 11:20:53 AM »

ActorObject and MeshObject have the same Update() function code so... Something must be going wrong when inserting object into scene. I'll look into it.

Pleasy try AdvancedScene.PrecomputeTree() before loop, it's supposed to slice scene and put objects in slices instantly so maybe it can help.

Btw auto-updating is actually semi-auto updating which works like this:
SceneObject.AutoUpdate = true;
in loop: AdvancedScene.PerformAutoUpdates();

when your object becomes static again: SceneObject.AutoUpdate = false;
Logged

tvsm.co.cc - TVSceneManager
zajac
Customers
Community Member
*****
Posts: 6


« Reply #79 on: July 25, 2008, 01:44:29 AM »

Thx for fast reply
Unfortunately i was bit too eager to say that ActorObject is ok - This null exception throws anyway when there are more objects on the scene - what's funny MeshObject throws it with only floor setup, while MeshActor requires sth beetween one cube and whole city to crash Wink
And PrecomputeTree() doesn't help Sad

btw i tried to setup occlusion to false for dynamic objects and it doesn't help also
Logged
Pages: 1 2 3 [4] 5
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks