Showing posts with label papervision3d. Show all posts
Showing posts with label papervision3d. Show all posts

Saturday, April 15, 2017

Papervision3D GreatWhite DAE Animation

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 PV3Ds 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 dont
try this one, noobs warning!




Demo
  1. its look old but its new http://sleepydesign.com/labs/as3/PaperVision3D/GreatWhite/DAEAnimation/
  2. MD2 its 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. dont 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 (thats must auto play fine in original package)
  4. Some mod/add below
How to?

1. add 2 SleepyController this in orgpapervision3dobjectsparsersDAE.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 orgpapervision3dcoreanimationcontrollersSimpleController.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? lets 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

Go to link Download

Read more »

Sunday, October 16, 2016

Papervision3D GreatWhite MD2 Animation

Papervision3D GreatWhite MD2 Animation


Happy new year! Lets 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);

Wheres to go next?


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

Go to link Download

Read more »

Thursday, September 29, 2016

Papervision3D GreatWhite Animated Particles

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 dont 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 its 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) its too dirty for now
and need to clean/add method for another case (more useful lol)

happy coding!

Go to link Download

Read more »