Friday, July 18, 2008
Another day, another revision
Tonight's main revision is the reduction of the color pallets. The bots have gotten some actual eyes, and had their bodies simplified a lot to streamline both download times and ease the stress on the Papervision engine.
The eyes still have a few polygons showing up in places that they shouldn't. It's small, though, so I'm going to quit worrying with it and just get these critters swimming.
Monday, July 14, 2008
Closeup on a cute couple
Warning: This may take a while to load. The models are over half a meg combined, and parsing them takes a little bit of time when the flash file gets loaded.
Now, as you can see, we finally have textures on the models. Simone and I finally gave up on creating textures in Maya and trying to save them in Collada format, and just textured the Boids inside Papervision. Would you believe that it's as simple as
var warmBody:PhongMaterial;
var warmWings:PhongMaterial;
var warmGlow:PhongMaterial;
warmBody = new PhongMaterial(light, 0xCCCCCC, 0x886600, 64);
warmWings = new PhongMaterial(light, 0xCCCCCC, 0xCC7700, 32);
warmGlow = new PhongMaterial(light, 0xFFFFFF, 0x444466, 0);
var WarmList:MaterialsList = new MaterialsList();
WarmList.addMaterial(warmBody, "body");
WarmList.addMaterial(warmWings, "wings");
WarmList.addMaterial(warmGlow, "glow");
warmFish = new Collada("bot1.dae", WarmList);
The whole mess of trying to load textures from the Collada file just got to be too much of a hassle.
The models and textures both need a little more fine tuning. You can see some static where polygons overlap and the renderer has to pick which one to draw. Boolean difference operations should fix all of those. The textures just need a little more tuning, maybe we'll try out gouraud shading for the next batch.
Also of interest, tonights flash file is actually built with FlashDevelop. My copy of Flash is about to expire, being the trial version, and I wanted to make sure I could rebuild everything with the free IDE and SDK. While I'll miss the default tweener, I think I can migrate everything else to the completely free system.
Now, as you can see, we finally have textures on the models. Simone and I finally gave up on creating textures in Maya and trying to save them in Collada format, and just textured the Boids inside Papervision. Would you believe that it's as simple as
var warmBody:PhongMaterial;
var warmWings:PhongMaterial;
var warmGlow:PhongMaterial;
warmBody = new PhongMaterial(light, 0xCCCCCC, 0x886600, 64);
warmWings = new PhongMaterial(light, 0xCCCCCC, 0xCC7700, 32);
warmGlow = new PhongMaterial(light, 0xFFFFFF, 0x444466, 0);
var WarmList:MaterialsList = new MaterialsList();
WarmList.addMaterial(warmBody, "body");
WarmList.addMaterial(warmWings, "wings");
WarmList.addMaterial(warmGlow, "glow");
warmFish = new Collada("bot1.dae", WarmList);
The whole mess of trying to load textures from the Collada file just got to be too much of a hassle.
The models and textures both need a little more fine tuning. You can see some static where polygons overlap and the renderer has to pick which one to draw. Boolean difference operations should fix all of those. The textures just need a little more tuning, maybe we'll try out gouraud shading for the next batch.
Also of interest, tonights flash file is actually built with FlashDevelop. My copy of Flash is about to expire, being the trial version, and I wanted to make sure I could rebuild everything with the free IDE and SDK. While I'll miss the default tweener, I think I can migrate everything else to the completely free system.
Saturday, July 12, 2008
All is Normal . . .
and that's the problem.
The Boids are jumping just a bit too much for my liking, but it's taken me till now to figure out why. There is a hint in the title, but first, the most recent flock of Boids. Move the mouse, they should follow. But they do have minds of their own.
Why are they jumping like manic goldfish when they see a food jar? Well, to make the Boids flock, we have to figure out how to move them and to where. So, I create a somewhat weighted list of vectors for each Boid, to figure out a direction to travel that keeps it near the most friends. Each other Boid that it wants to be near gets the vector normalized to a unit vector, just 1 pixel long according to Flash. When it gets too near another Boid, the vector gets longer the other direction, to keep them apart.
So, when the Boids get too clustered, those 'panic' vectors really outweigh any sane value keeping the flock together. Working in 3 dimensions will help, because the Z value will let them move in ways that just don't appear here, and I hope will disguise the jumpiness. First option is to always re-check my math to see what I can change safely, to better weight the various vectors, because 7 units towards the flock gets swamped by a large value like 20 away.
Numbers above represent actual values of the vector lengths. 1 unit vector towards the flock for each other Boid it wants to join, but when one is too close, the crash warning tells it to swim the opposite direction very quickly, and 20 seems to be the value that keeps showing up.
Last resort, is to give these Boids something to quell their panicy flights away from the flock. I've looked at tuning the numbers to keep them sitting still when they don't need to move far, or just slowing their movements down to make the jumping less erratic. As always, if math fails, try something unusual.
The Boids are jumping just a bit too much for my liking, but it's taken me till now to figure out why. There is a hint in the title, but first, the most recent flock of Boids. Move the mouse, they should follow. But they do have minds of their own.
Why are they jumping like manic goldfish when they see a food jar? Well, to make the Boids flock, we have to figure out how to move them and to where. So, I create a somewhat weighted list of vectors for each Boid, to figure out a direction to travel that keeps it near the most friends. Each other Boid that it wants to be near gets the vector normalized to a unit vector, just 1 pixel long according to Flash. When it gets too near another Boid, the vector gets longer the other direction, to keep them apart.
So, when the Boids get too clustered, those 'panic' vectors really outweigh any sane value keeping the flock together. Working in 3 dimensions will help, because the Z value will let them move in ways that just don't appear here, and I hope will disguise the jumpiness. First option is to always re-check my math to see what I can change safely, to better weight the various vectors, because 7 units towards the flock gets swamped by a large value like 20 away.
Numbers above represent actual values of the vector lengths. 1 unit vector towards the flock for each other Boid it wants to join, but when one is too close, the crash warning tells it to swim the opposite direction very quickly, and 20 seems to be the value that keeps showing up.
Last resort, is to give these Boids something to quell their panicy flights away from the flock. I've looked at tuning the numbers to keep them sitting still when they don't need to move far, or just slowing their movements down to make the jumping less erratic. As always, if math fails, try something unusual.
Vector Mathmatics
After a while, working with 3 dimensional math, you get into the habit of just thinking in vectors. This only becomes a problem when, like me, you constantly confuse addition and subtractions.
Below is the simplest flocking I have available. 10 Boids are created and placed randomly across the screen, and they then decide to huddle together. The math is being done in 3 dimensions, though the Z direction is commented out because Flash Sprites don't have a .z property.
I'm tempted to make the Z value change the sphere's size, just to see what would happen. First, though, I need to get these little Boids to follow something, say, a mouse pointer.
Below is the simplest flocking I have available. 10 Boids are created and placed randomly across the screen, and they then decide to huddle together. The math is being done in 3 dimensions, though the Z direction is commented out because Flash Sprites don't have a .z property.
I'm tempted to make the Z value change the sphere's size, just to see what would happen. First, though, I need to get these little Boids to follow something, say, a mouse pointer.
Monday, July 7, 2008
monday monday
We still have not solved the texture problem between maya and papervision even after baking the textures.
However I feel confident that tomorrow we will get the answers we seek from the Great OZ (Dane)
Meanwhile Sabrina has worked on 2D flocking objects - very nice!
Her next objective is to get the updated 3D objects to flock.
more soon.
simpat
However I feel confident that tomorrow we will get the answers we seek from the Great OZ (Dane)
Meanwhile Sabrina has worked on 2D flocking objects - very nice!
Her next objective is to get the updated 3D objects to flock.
more soon.
simpat
Sunday, July 6, 2008
Bots in PaperVision3D
Note: When debugging, always assume that the problem you don't know how to fix is what is causing trouble. In this case, it's the Collada files exported by Maya3d. For what ever reason, Papervision3D parses them as invalid. Importing the file into Blender and then exporting back to *.dae works just fine, however.
And now, on with the show.
I haven't applied color or shaders to the object yet, so all we are getting is a wire frame with randomly colored connecting lines. I think the shaders from Maya3D are what is causing the 'invalid file' error, and the next step I'll attempt is using Maya to just bake the textures to image files, and load from those.
Finally, for those who are interested in how this actually works, this demo was constructed from the tutorial located at Papervision2. When the time it takes to get the .dae file corrected is greater then the time it takes to write the code, you know you've found some great resources.
Total time invested in this one demo: 3 hours.
1 hour to find no bugs in Papervision3d while wondering why the file doesn't load.
1 hour to edit .dae files by hand. At least XML is better then a binary file format.
1 hour to install Blender and associated scripts to fix the file, then tune the Flash file for internet distribution.
And now, on with the show.
I haven't applied color or shaders to the object yet, so all we are getting is a wire frame with randomly colored connecting lines. I think the shaders from Maya3D are what is causing the 'invalid file' error, and the next step I'll attempt is using Maya to just bake the textures to image files, and load from those.
Finally, for those who are interested in how this actually works, this demo was constructed from the tutorial located at Papervision2. When the time it takes to get the .dae file corrected is greater then the time it takes to write the code, you know you've found some great resources.
Total time invested in this one demo: 3 hours.
1 hour to find no bugs in Papervision3d while wondering why the file doesn't load.
1 hour to edit .dae files by hand. At least XML is better then a binary file format.
1 hour to install Blender and associated scripts to fix the file, then tune the Flash file for internet distribution.
Thursday, July 3, 2008
Subscribe to:
Posts (Atom)
