Here's a small bit of code I pasted into an as3 geom class to ave the option of inverting the mesh either x,y or z. the uvs work fine
replace function 'v' with:
but first create a mirror var:
public var mirror :String;
private function v(x:Number,y:Number,z:Number):void
{
switch (mirror){
case "x":
verts.push(new Vertex3D(-x,y,z));
break;
case "y":
verts.push(new Vertex3D(x,-y,z));
break;
case "z":
verts.push(new Vertex3D(x,y,-z));
break;
default:
verts.push(new Vertex3D(x,y,z));
break;
}
}
pass the var into the constructor
when you initiate your object
either "x","y","z"
public function coccyx( material:MaterialObject3D=null,mirror:String="", initObject:Object=null )
{
//--\\
//---\\
//---//
this.mirror = mirror
even better would be code for a combination of all three
download th as3 geom class exporter here
Showing posts with label flash. Show all posts
Showing posts with label flash. Show all posts
Wednesday, August 27, 2008
Monday, August 25, 2008
papervision 3d
Have loaded a complex model using the as3 geom exporter, which compiles the model information on export, embedding it with the flash swf, avoids parsing the file later on like collada.
Also coded 3d camera movement around the object. I had the object rotating, but want later on to rotate the parts of the object separately. Had trouble finding examples of even camera movement around the object.
It might take a moment to load, will build that in later
Here is the example with markers to show your how the sin() works
also learnt how to UVW unwrap on the way, this example is a box unwrap, hence the shadows. There are not lights in this scene so it needs baked on lights to show the form.
here is the code for the camera movement
sh = stage.stageWidth;
Pi = Math.PI/180;
mY = ((mouseY/sh)*180) * Pi;
mX = ((mouseX/(sh/2))*180) * Pi;
radY1 =mY+1.8;
radY2 =mY+3.2;
radX1 =mX+1.8;
radZ =mX+3.3;
closY1 = 100*Math.sin(radY1);
closY2 = 100*Math.sin(radY2);
closX1 = 100*Math.sin(radX1);
closZ = 100*Math.sin(radZ);
camX = (1*(closX1 * ((-closY2)/100)));
camZ = closZ* ((-closY2)/100);
///
default_camera.x=camX;
default_camera.y=closY1;
default_camera.z=camZ
default_camera.lookAt (objectArray[0]);
Also coded 3d camera movement around the object. I had the object rotating, but want later on to rotate the parts of the object separately. Had trouble finding examples of even camera movement around the object.
It might take a moment to load, will build that in later
Here is the example with markers to show your how the sin() works
also learnt how to UVW unwrap on the way, this example is a box unwrap, hence the shadows. There are not lights in this scene so it needs baked on lights to show the form.
here is the code for the camera movement
sh = stage.stageWidth;
Pi = Math.PI/180;
mY = ((mouseY/sh)*180) * Pi;
mX = ((mouseX/(sh/2))*180) * Pi;
radY1 =mY+1.8;
radY2 =mY+3.2;
radX1 =mX+1.8;
radZ =mX+3.3;
closY1 = 100*Math.sin(radY1);
closY2 = 100*Math.sin(radY2);
closX1 = 100*Math.sin(radX1);
closZ = 100*Math.sin(radZ);
camX = (1*(closX1 * ((-closY2)/100)));
camZ = closZ* ((-closY2)/100);
///
default_camera.x=camX;
default_camera.y=closY1;
default_camera.z=camZ
default_camera.lookAt (objectArray[0]);
Tuesday, July 8, 2008
New project
Having completed my first DIL goal in PHP, I've decided to tackle the apparently more visually rewarding job of exporting a simple polygon model from 3dsMax with Collada or some other conversion plugin which will be read by Papervision 2.0. Import it into a papervision class file, the skeleton for which can be seen <here>, with imported plane with transparent PNG texture.
Then export this with a pre-loader if neccessary for access from BlackBoard.
After I've done that I'll attempt to make the model interactive, so you can click on parts and change there orientation, or pull up information pertaining to them.
Ultimately, if funding becomes available, the scanning of anatomical models kept for the purposes of hands on teaching would enable students to explore objects in cyberspace. The 3d laser scanner here is designed just for that purpose.
The raw mesh will have to be optimized and mapped, even if just baked with a light map for shading, but with the potential for interactive maps - flash movies/animations as textures.
here's a link to some examples(on the right)
Then export this with a pre-loader if neccessary for access from BlackBoard.
After I've done that I'll attempt to make the model interactive, so you can click on parts and change there orientation, or pull up information pertaining to them.
Ultimately, if funding becomes available, the scanning of anatomical models kept for the purposes of hands on teaching would enable students to explore objects in cyberspace. The 3d laser scanner here is designed just for that purpose.
The raw mesh will have to be optimized and mapped, even if just baked with a light map for shading, but with the potential for interactive maps - flash movies/animations as textures.
here's a link to some examples(on the right)
Monday, June 16, 2008
swf Projectors transparency capabilities
In the effort to customize my windows XP workstation I have discovered that flash projector applications proclaiming to allow transparent, shaped, applications, are not all they're cracked up to be.
MDM zinc 2.5 loads a transparent flash 8 swf projector after about 5 mintues, and is so slow that proves impossible to use. Flash 9 it won't take at all.
Northcodes swfStudio 3.5 will work but is sticky.
Old flash Ants IceProjector 1.5 flows like sugar compared to these, and supports AS3. Unfortunatley these programms application/system manipulating capabilities run inverse to there graphical prowess. Iceprojector is limited to fsCommands.
Cacheing the moving images as bitmaps seems to have no effect.
Perhaps there is a workaround or MDM 3 is better.
go here to have a look at comparisons
and here for the flash mag review
MDM said...
You should REALLY use MDM Zinc 3.0 - the transparency is flawless, optimized and works perfectly across Windows and Mac OSX now. The transparency in 2.5 is ancient and not worth mentioning. Definately give Zinc 3.0 a go. :)
Too right MDM, version 3 is very nice and smooth, too bad about the watermark;>
MDM zinc 2.5 loads a transparent flash 8 swf projector after about 5 mintues, and is so slow that proves impossible to use. Flash 9 it won't take at all.
Northcodes swfStudio 3.5 will work but is sticky.
Old flash Ants IceProjector 1.5 flows like sugar compared to these, and supports AS3. Unfortunatley these programms application/system manipulating capabilities run inverse to there graphical prowess. Iceprojector is limited to fsCommands.
Cacheing the moving images as bitmaps seems to have no effect.
Perhaps there is a workaround or MDM 3 is better.
go here to have a look at comparisons
and here for the flash mag review
MDM said...
You should REALLY use MDM Zinc 3.0 - the transparency is flawless, optimized and works perfectly across Windows and Mac OSX now. The transparency in 2.5 is ancient and not worth mentioning. Definately give Zinc 3.0 a go. :)
Too right MDM, version 3 is very nice and smooth, too bad about the watermark;>
Subscribe to:
Posts (Atom)