Showing posts with label PaperVision3D. Show all posts
Showing posts with label PaperVision3D. Show all posts

Monday, February 11, 2008

Papervision3D GreatWhite : DAE Animation

Happy Chinese New Year, look like i always come up when new year eh? :P

actually i already post this to PV3D's mail archieve for a month
also PV3D team said that "soon" to release woking version
so i decide to leave my dae mod in trash, but many one keep asking me
for a guide, so...this is a quick/mod guide!
anyway if you not understand my MD2 last post yet, plz don't
try this one, noobs warning!




Demo
  1. it's look old but it's new http://sleepydesign.com/labs/as3/PaperVision3D/GreatWhite/DAEAnimation/
  2. MD2 it's left and right, DAE in middle, all in one to prove it work fine together
  3. try click on left/right plane to change animation (full loop/half loop)
  4. don't expect cleaner version
What for?
  1. learn to integrate MD2 mod -> DAE mod
  2. early use of DAE Animation
  3. money? sigh....i just got 0.01$ from google ads from my own click ... opps! sorry google just test :P
Required?
  1. last know good PaperVision3D rev 421
  2. AS Class in old MD2 guide : Papervision3D GreatWhite : MD2 Animation
  3. your animated DAE (that's must auto play fine in original package)
  4. Some mod/add below
How to?

1. add 2 SleepyController this in org\papervision3d\objects\parsers\DAE.as

//public lazy hack
public var SleepyController1
public var SleepyController2
private function buildAnimationController( joint:Node3D, keys:Array,
matrices:Array ):void
{
var mats:Array = new Array(matrices.length);
var ctl:SimpleController = new SimpleController(joint,
SimpleController.TRANSFORM);
if(!SleepyController1){
SleepyController1 = ctl
}else {
SleepyController2 = ctl
}

2. line #100 at \org\papervision3d\core\animation\controllers\SimpleController.as to fix weird animation (just over frame)

var endFrame:AnimationFrame = this.frames[ currentFrame ];
//proof it work
trace(firstFrame,currentFrame,nextFrame,lastFrame)

3. add controller after "controller complete" not just model complete in your "main.as"

dae.SleepyController1.gotoAndLoop(10, 20)
dae.SleepyController2.gotoAndLoop(10, 20)


4. mix up with MD2? let's see

if(mouse3D.x>0){
ctrl.gotoAndLoop(0, 16)
dae.SleepyController1.gotoAndLoop(10, 20)
dae.SleepyController2.gotoAndLoop(10, 20)
md2.setMaterial(new BitmapFileMaterial("pg.png"));
}else {
ctrl.gotoAndLoop(18, 31)
dae.SleepyController1.gotoAndLoop(0, 40)
dae.SleepyController2.gotoAndLoop(0, 40)
md2.setMaterial(new BitmapFileMaterial("pg_angry.png"));
}


Next?


  1. if you not mod addict or really need early use of DAE animation plz skip this ;)
  2. dig something else and wait for official release
  3. sigh.... ;P

Friday, January 4, 2008

Papervision3D GreatWhite : MD2 Animation

Happy new year! Let's start with some dirty/early coding, lol



Demo
  1. dirty one (internal use) : http://sleepydesign.com/labs/as3/PaperVision3D/GreatWhite/MD2Animation/
  2. try click on left/right plane to change animation (sit/stand)
  3. good/clean demo later (really later)

What for?
  1. Holy guide to take control MD2 animation.
  2. happy new year (eh?)
Required?
  1. PaperVision3D 2.0 GreatWhite rev 391
  2. modded : AbstractController.as
  3. modded : KeyFrameController.as
How to?
  1. merge modded/original package (1+2+3)
  2. add MorphController to MD2
  3. call "gotoAndLoop" function with begin/end frame parameters
  4. got error(s) and shutdown without save (kidding :P)
Hint?
  1. compare modded class with svn, see the diff
  2. call function like this

var ctrl = AnimationEngine.getControllers(md2)[0] as MorphController;
ctrl.gotoAndLoop(18, 31);

Where's to go next?


  1. home?
  2. bed?
  3. :P

Thursday, December 20, 2007

Papervision3D GreatWhite : Animated Particles



What for?
  1. learn to modify more complicate package
  2. x-mas fun/gift ;D

Required?
  1. PaperVision3D 2.0 GreatWhite rev 385
  2. John Grden Shader demo : http://www.rockonflash.com/blog/?p=92
  3. 2 brains
How to?
  1. i don't want to mess up original "Particle" , so just clone "all" packages that related to "Particle "
  2. hange "Particle" to "Clip" packages
  3. merge MovieMaterial to ClipMaterial then i got "MovieClipMaterial" (huh?)
  4. add "size" to "ParticleField" (call ClipField for now)
Hint?

MovieClipMaterial.as

package org.papervision3d.materials.special
{
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.Graphics;
import flash.geom.Matrix;
import org.papervision3d.materials.MovieMaterial;

import org.papervision3d.core.geom.renderables.Clip;
import org.papervision3d.core.render.data.RenderSessionData;
import org.papervision3d.core.render.draw.IClipDrawer;

public class MovieClipMaterial extends ClipMaterial implements IClipDrawer
{

private var scaleMatrix : Matrix;
private var movie : DisplayObject;
private var movieMaterial : MovieMaterial;

public function MovieClipMaterial( movieAsset:DisplayObject=null, transparent:Boolean=false, animated:Boolean=false )
{
super(0, 0);

this.movie = movieAsset;
this.movieMaterial = new MovieMaterial( movie, transparent, animated );

this.bitmap = movieMaterial.bitmap;
this.scaleMatrix = new Matrix();
}

override public function drawClip(clip:Clip, graphics:Graphics, renderSessionData:RenderSessionData):void
{
this.bitmap = movieMaterial.bitmap;

scaleMatrix.a = clip.renderScale;
scaleMatrix.d = clip.renderScale;
scaleMatrix.tx = clip.vertex3D.vertex3DInstance.x;
scaleMatrix.ty = clip.vertex3D.vertex3DInstance.y;

graphics.beginBitmapFill(this.bitmap, scaleMatrix, false, smooth);
graphics.drawRect(clip.vertex3D.vertex3DInstance.x, clip.vertex3D.vertex3DInstance.y,clip.renderScale*this.bitmap.width,clip.renderScale*this.bitmap.height);
graphics.endFill();
renderSessionData.renderStatistics.particles++;

}

}
}
after finish doing this, i found this thing useless in "snow" case lol,
maybe it's better to use 2d particles for "Environment effect" like rain, snow or wot ever
full source code 'll be release later (actually nothing just rename) it's too dirty for now
and need to clean/add method for another case (more useful lol)

happy coding!

Monday, November 12, 2007

Hello APE 'n PaperVision3D

It's time to go advance, Let's merge APE with PaperVision3D
Warning! this code is quick hack for 2.5D not actually 3D ;)



STEP #1 : Say "Hello" to APE
STEP #2 : Grab my code (Modified from HelloAPE+PaperVision3D HelloWorld)
STEP #3 : Compile and see the result
STEP #4 : Go advance!
  • actually something should be place here but maybe later ,lol
bye for now ;D

Friday, November 2, 2007

Benz C-Class The Game

Big Thx! for PaperVision3D community for all great advice! Finally I got it done right on time, I'm not good in explain, so let's the pictures say, LOL

Project : Benz C-Class Mini Game
  • Day version

  • Night version



Behind the scene
  • Scene
  • Map

FYI
  • Trees and Friends are randomize each game
  • It's 2D Bitmap hitTest
  • It's fake light cover, no shading as you can see
  • Environment scale it's not for real (keep it like that for you know who)
  • It's high quality so sorry for low spec computer (keep it like that for you know who)
  • It's mini game! Please don't expect more than that, LOL
  • I did only the engine, blame me in that part ;P
Hints
  • Press "*" : switch low/medium/high quality
  • Press "1" , "2" : switch camera

Related Links

Credits