XNA Creators Club Online
Page 1 of 1 (4 items)
Sort Posts: Previous Next

World Space; How can one go about dynamically altering its size?

Last post 08-29-2008 12:50 AM by NightCreature. 3 replies.
  • 08-27-2008 11:14 PM

    World Space; How can one go about dynamically altering its size?

    Hello folks, somewhat of a newb here. My background's in Neuroscience and AI, and after 2 years intense labors and research I recently finished the pseudocode for an AI engine that will be able to edit neurons and synapses in 3D, and do anything imaginable to how they interact intracellularly, intercellularly, and extracellularly. So I'm trying to write a 3D engine, physics and all, that will hook up creatures with collision detecting sensors, and actuators that move their virtual musculature via signals to preset motor neurons. Also trying to write the 3D code so that the user can "swim" through a virtual brain and edit the nodes/links of the creature's neural network interactively, composing the brain architecture with the help of some of my personal templates for intelligent and "instinct" driven behaviors.

    The problem, my only obstacle at this point, is getting Direct3D to do what I want it to!

    I've read half a dozen intros on Direct3D, mentioning how to initialize the World/View/Projection Matrices, however not one of them mentioned anything at all about how to control the X/Y/Z bounds of the World Space. So I'm having trouble trying to load an object into specific areas of the world space, and loading/unloading world space zones between RAM and the hard drive based on the Camera's position in an arbitrarily large overall World. Logically, with large worlds (like a brain space, they could get HUGE, trust me) you only ought to keep the zone around the camera in RAM, and load space from the hard drive as necessary while the camera moves around.

    I'm thinking of writing the 3D engine so that it partitions Space into slices of Cubes. That way I could load Cubes from the hard drive as they're needed depending on the zFar (view distance) outer bounds that the Camera/ViewMatrix can see to. Also that way the entire World itself can be "swum" through up, down, left, right, etc. to observe neuron's as they're signaling in brain space, or how the creature is actually behaving in world space.

    But whenever I see code translating objects into World Space, it's like they're taking the coordinate numbers out of thin air! They never initialized World space as having set x/y/z boundaries.

    I think I know enough i/o to be able to save and load these cubes between ram and hard drive, but in order to start I really need a way to have complete control over every coordinate point inside of World Space. i.e. when the Camera object hits a Cube wall, it calls the new Cube the "center" and loads something like a 9x9 number of cubes around the Camera's new Cube as the new "World Space". Can anyone here suggest how to go about this?

    Also, I program in VB.NET rather than hardcore C++ like most everyone else seems to, but I am trying to better understand Shader language and effect files. If you're as itchy to write code as I am, feel free to use any language! If you like the idea of this program I'm working on, the more help I get now the sooner I'll have it finished and can hopefully share (if it turns out well enough)!

    OH, and one more related question. It seems that Coordinates are Single (i.e. 1.00etc.) values. How is it that vertices can be placed inbetween the actual x/y/z coordinates? Does that mean that you can have a World Space that's only 10x10x10 but still load in objects that could have 1000's of vertices just stuffed inbetween the points?

    I guess what I need most is some clear, understandable explanation of how to have complete control manipulating the on-screen 3D coordinates and what's inside of them.

    tnx,

    LunarSylph

  • 08-28-2008 12:47 AM In reply to

    Re: World Space; How can one go about dynamically altering its size?

    not one of them mentioned anything at all about how to control the X/Y/Z bounds of the World Space. So

    That's because world space is infinite (conceptually). As you note, world space is floating point numbers, which allows you a whole lot of precision close to the origin, but less precision far away. At Earth size, the smallest representable quantum is about 1.5 meters. At 1 meter from the origin, the smallest representable quantum is about 1 micron (assuming the absolute value of the coordinates is in meters -- it can be any unit you want of course).

    Regarding management of a large scene (which seems to be what you're interested in), that's a fairly advanced technique, and not something you'll find a quick tutorial about on the web. You'll need to scour the presentations from the Game Developer's Conference, look at application notes for various scene graph packages or game engines, etc, to get ideas about how to structure your code such that it will load/unload data in a streaming fashion.

     

     

    Jon Watte, Direct3D MVP kW X-port 3ds Max .X exporter kW Animation source code
  • 08-28-2008 1:13 AM In reply to

    Re: World Space; How can one go about dynamically altering its size?

    Hmm, yes I think I'm beginning to see what you mean. So when World space is converted to View space, the way the viewing frustum warps the objects to give a sense of distance pretty much requires a sort of logarithmic degree of coordinate scaling precision, with close stuff getting the most compacted in between the coords as it enter Projection and Screen space. I hope this wont make collision detection even harder :) It will probably give away some clipping the closer you get to scrutinize things as they bounce off each other, as with the View space conversion to frustum-warped view, it may unveil clips that wouldn't be so easily evidenced in World space. Might have to code collision detection so it's at higher detecting resolutions the closer a collision is to the zNear point.

    So I guess the way we define our World Space grid is by how much we choose to generally scale all the objects we're loading into it, and how much space they took up in Model space?

    Wow! I never thought generating virtual worlds was going to be quite this involved, I'm liking this kind of challenge.

    On an unrelated note, I wonder if there are ways to implement collision detection in a shader Effect file, to take some of the physics processing load off of the CPU...

  • 08-29-2008 12:50 AM In reply to

    Re: World Space; How can one go about dynamically altering its size?

    You should handle all your collision detection in world space, if you do this in view or projection space you lose a lot of  resolution, besides the actual collision happen in world space and nowhere else. If you don't want to write the full physics engine take a look at physx from Nvidia or anyother physics engine.

     The scale in world space is anything you define it to be, normally you define a scale for your application and take that scale into account when you make the models, not the other way around. If you would do it the other way around you run in to trouble that you weren't consistent in defining the sizes in the models and end up with all different scale factors.

Page 1 of 1 (4 items) Previous Next