XNA Game Development Forums
2012/05/18 05:23:48 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Search Calendar Login Register  
Pages: [1] 2
  Print  
Author Topic: Tutorial 10 :: Preparing for Object Culling, a Simple Octree  (Read 7357 times)
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« on: 2007/01/07 01:42:57 »

Tut 10 discussion
« Last Edit: 2007/01/07 03:34:04 by mikeschuld » Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #1 on: 2007/01/08 19:06:56 »

I am going to be updating the octree to simply use the static manager for everything instead of having a member object in the HMGame class. This makes things a bit easier to deal with later on (which you will see in the next tutorial that I am working on right now.) I'll update the original when I get it all sorted out.
Logged
letsrock
Newbie
*
Offline Offline

Posts: 6


View Profile
« Reply #2 on: 2007/01/10 01:43:14 »

Please use PDF Files for your tutorial documentation again...  Undecided
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #3 on: 2007/01/10 04:15:53 »

oops did i upload the wrong one? I'll go change it now Smiley
Logged
Iarus
Newbie
*
Offline Offline

Posts: 6


View Profile
« Reply #4 on: 2007/02/21 08:55:00 »

I haven't done tut 11 yet, so I don't know if it was changed, but when you add objects and distribute them, you look at each child node and see if the object could be contained in it. Once the node is found, there is no use in testing the other nodes, so we can break the foreach loop
Code: ( HMOctnode )
private void DistributeObjects()
      {
         foreach(HMObject obj in myObjects)
         {
            foreach(HMOctnode node in myNodes)
            {
               if(node.Contains(obj.Position))
               {
                  node.AddObject(obj);
                  break;                                                        // <--------------
               }
            }
         }

         myObjects.Clear();
      }

I know your tutorials are not optimisation one, but design tutorials
I thought I would share
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #5 on: 2007/02/21 12:00:20 »

Actually, the reason it keeps checking is just in case an object is on a boundary. This will allow us some special handling of boundary cases later on if we need to take advantage of them by making sure both nodes contain the object.
Logged
Iarus
Newbie
*
Offline Offline

Posts: 6


View Profile
« Reply #6 on: 2007/02/21 14:00:00 »

ok

what happens if I create 5 objects really close to each other?
it'll split the node until all 5 objects are not in the same node anymore.
it can do lots of splitting.

what if (for some really stupid reason) all 5 are at the exact same position? StackOverflowException? [edit]I just tried it, and yup! stack overflow![/edit]
would implementing some kind of security for that case be useful? does that really happen often?
something like limiting the recursion to 10-20 levels or so.

Damn I've just finished tut 11! I'm starting 12, then... Huh nothing  Grin

---

I tried to add lots of teapots in my scene, and only a handful of them are there.
Do you have a clue why it happen?
Code:
private static void SetupScene()
{
    //Existing code

     System.Random r = new System.Random();
     int q = 0;
     HMModel m;

     for(q = 0; q < 1000; q++)
    {
        m = new HMModel(@"Content/Models/teapot");
        m.SetShader("BS");
        m.Position = new Vector3((float)(r.NextDouble()*200 - 100), (float)(r.NextDouble()*200 - 100), (float)(r.NextDouble()*200 - 100));
        game.Scene.AddObject(m);
        HMOctreeManager.OctRoot.AddObject(m);
    }
}



[edit]
OK never mind I'm stupid!
It's not r.NextDouble()*200 - 100, but r.NextDouble()*100 - 50
most of the object were not really added to the octree
[/edit]
« Last Edit: 2007/02/21 14:49:20 by Iarus » Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #7 on: 2007/02/21 16:43:17 »

I actually updated my own code last night to only allow octnodes of a certain size or large, after that it just stops trying to split. This is only one of many solutions (probably a temporary one) for the problem
Logged
Neil_Knight
Newbie
*
Offline Offline

Posts: 8


View Profile WWW
« Reply #8 on: 2010/11/15 08:23:15 »

Does anyone have the tutorial PDF or ZIP files for any tutorials over 8?

I can't find them anywhere. Sad
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #9 on: 2010/11/15 12:00:22 »

The old tutorials do no work anymore. They were too complicated and the base engine was updated too much to allow for them to still function like they were and I have pulled them. The 8 on the blog list are the only ones currently used by myself and most others.

I still have the old pdfs of the deprecated tutorials if you would like to see them, but some of the renaming and refactoring may make them difficult to use. Let me know and I can email them to you.
Logged
Neil_Knight
Newbie
*
Offline Offline

Posts: 8


View Profile WWW
« Reply #10 on: 2010/11/15 22:59:50 »

Hi Mike,
I would love to see all of the old tutorials.  I'm really keen to see how you implemented your quad tree, so if you have tutorials 10 - 13 I be really interested in seeing these.

Also, are you going to convert Tutorial 8 to XNA 4?  I have been following your series and now I can't get the PostProcessing to work Sad
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #11 on: 2010/11/16 16:58:54 »

Working on the conversions still. They did some last minute changes to things in the RTM of 4 so I had to go through the refactoring all again. Working on it all at the same time as the book review so it will be a bit but hopefully not forever :p
Logged
Neil_Knight
Newbie
*
Offline Offline

Posts: 8


View Profile WWW
« Reply #12 on: 2010/11/16 22:35:33 »

Could you send me the old PDF files like you mentioned in your previous post?

I am hoping you still have 9-13 Wink
Logged
Neil_Knight
Newbie
*
Offline Offline

Posts: 8


View Profile WWW
« Reply #13 on: 2010/11/22 09:21:19 »

Hi Mike,
Just wondering if you have those old tutorial files?
Logged
mikeschuld
Administrator
Sr. Member
*****
Offline Offline

Posts: 389


View Profile WWW
« Reply #14 on: 2010/11/22 10:40:20 »

I found 9, 10, and 11 pdfs in the archives. Here's a zip containing them. These will not be directly compatible with the current base code in the engine so you may have to do some tweaking to get them functioning correctly. Good Luck! Smiley
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Tutorial 2 :: Scene Graph and Object Framework Tutorial Discussion « 1 2 » mikeschuld 18 10041 Last post 2008/07/31 22:50:22
by mikeschuld
Tutorial 4 :: Moving Cameras and a Simple Input Component Tutorial Discussion « 1 2 » mikeschuld 21 8457 Last post 2008/12/11 10:42:13
by mikeschuld
Tutorial 5 :: Building on what we've got, A Simple Skybox Tutorial Discussion mikeschuld 5 3793 Last post 2007/05/26 11:05:01
by Yubastard
Tutorial 11 :: Finishing our Culling, Complete Octree Funcionality Tutorial Discussion « 1 2 » mikeschuld 19 9015 Last post 2007/08/11 15:11:32
by mikeschuld
Check if an object is facing another object..? General Discussion DaphydTheBard 4 1899 Last post 2007/03/08 22:41:54
by mikeschuld
SceneGraph vs. Octree Hazy Mind XNA Engine Jonotron 7 4480 Last post 2007/08/14 06:22:27
by muchrejoicing
Powered by MySQL Powered by PHP Powered by SMF 1.1.12 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.244 seconds with 20 queries.