nice.
i've had the impression that your animations are dynamic
On 18 November 2010 01:45, masterkitano <[email protected]> wrote:
> finally!! I got it! eureka :P
>
> this is how I solved the problem, just in case anyone has gotten this
> problem too.
>
> the firs step is to load the avatar, to load the avatar I have my
> scripts to get all the clothes, hair style, skin color etc, from the
> DB,
> from that DB data, I build an away3d model (till here, everything is
> just like I had it before the techinque).
>
> now I apply the techinque:
>
> 0.- create an array, and create a Bitmap object, also make sure to set
> your view.session to a new BitmapSession(1);
>
> 1.-I add the avatar to a view3d and use a Rectangle clipping so It
> only renders the avatar area, and not the whole scenario.
> 2.- I create my avatar3d model, and call its own away3d method
> playAnimation("animation_name");
> 3.- instead of using the typicall way to render: adding a ENTER_FRAME
> event and inside calling the view.render();
> I use a for to render all of the frames, but there is a problem,
> animation does not advance, why? cause internally it uses an enter
> frame event, so the solution is calling
> myAvatar.gotoAndPlay(frameNumber) and just after that, I call the
> view.render() method.
>
> the lenght of the for is the number of frames in the animation you
> want to render.
> 4.- inside the for, and just after calling view.render(), you create a
> new BitmapData, and use the method view.getBitmapData().clone() to
> clone the data gotten from the render. assign this to the new created
> bitmapData, and then, push this bitmapData to the array created on
> step 0.
>
> at this point you can delete your 3d instance already.
>
> 5.- after the for, all renders from every animation's frames, should
> 've been saved on the array.
> 6.- add an ENTER_FRAME listener into your Bitmap created on step 0.
> and create a variable wich holds the current animating frame.
> inside on the event, set your bitmap.bitmapData to the bitmap data
> array, on the currentframe possition and then add ++ to your
> currentframe. and make sure to reset current frame to 0 when
> currentframe> array length.
>
> I repeat those steps for every diferent avatar I want to render.
> and that's it, I already tested with 100 avatars, eachone with 300
> polys, and it runs just like butter.
>
> here is a sample source code of the algorithm:
> hope it helps.
>
>
> this is for testing 100 avatars:
>
> var data:Array = renderAnimation("walk");
>
> for (var i:int = 0; i < 100; i++)
> {
> var obj:MovieClip = new MovieClip();
>
> var renderContainer:Bitmap = new Bitmap();
> obj.renderContainer = renderContainer;
> obj.current3dFrame = 1;
> renderContainer.x = (-200)+(i * 10);
> obj.addEventListener(Event.ENTER_FRAME,
> update);
> this.addChild(renderContainer);
> }
>
> function update(e:Event):void
> {
> if (e.currentTarget.current3dFrame > 59)
> { e.currentTarget.current3dFrame = 1; }
> e.currentTarget.renderContainer.bitmapData =
> data[e.currentTarget.current3dFrame];
> e.currentTarget.current3dFrame++;
> }
>
> function renderAnimation(animation:String):Array{
> var render:Array = new Array();
>
> avatar.playAnimation(animation);
> for (var i:int = 0; i < 60; i++) {
> avatar.getBodyPart(BodyPart.HAIR).gotoAndPlay(i);
> avatar.getBodyPart(BodyPart.HEAD).gotoAndPlay(i);
> avatar.getBodyPart(BodyPart.PANTS).gotoAndPlay(i);
> avatar.getBodyPart(BodyPart.SHIRT).gotoAndPlay(i);
> avatar.getBodyPart(BodyPart.SHOES).gotoAndPlay(i);
> view.render();
> render.push(view.getBitmapData().clone());
> }
> return render;
> }
>
>
>
>
>
> On 17 nov, 17:50, Páll Zoltán <[email protected]> wrote:
> > masterkitano, what does your solution look like?
> >
> > Z.
> >
> > On 18 November 2010 00:48, Darcey Lloyd <[email protected]> wrote:
> >
> > > for loop is instant, well almost, so you will only see the last render
> in
> > > the loop.
> >
> > > On 17 November 2010 23:33, masterkitano <[email protected]> wrote:
> >
> > >> I think I finally found the way, but im stucked in here:
> > >> I need to call the method render() from a view: view.render();
> > >> but not inside an enter frame event, but a for cycle.
> >
> > >> the problem is that when I do it inside a for, it doesnt updataes the
> > >> view, why :S?
> >
> > >> On 16 nov, 13:25, Darcey Lloyd <[email protected]> wrote:
> > >> > Away3D has it's animation values in models which you can set and
> then
> > >> > execute the animation by name at the points you want to create the
> > >> bitmap
> > >> > from and save each step as a jpg on the server or db and you will
> have
> > >> your
> > >> > sequence generated from the clients machine to serverside script.
> >
> > >> > Make more steps for render time which you dont use when user is
> > >> customising
> > >> > the model.
> >
> > >> > D
> >
> > >> > On 16 November 2010 18:59, Philip Harvey <[email protected]>
> wrote:
> >
> > >> > > I did something like this on an iPhone / Facebook game and it now
> has
> > >> a
> > >> > > middleware solution which is to be released. We set up a Render
> server
> > >> on a
> > >> > > couple of Amazon EC2 machines, stored the images on S3 and
> Cloudfront.
> > >> The
> > >> > > render server ran a windows exe with a software renderer to create
> the
> > >> > > images. Not quite what you are doing, but the whole process is
> > >> similar.
> >
> > >> > > The game would just down load the 8 directional sprites for the
> > >> different
> > >> > > animations. The view was isometric, so the game worked nicely.
> >
> > >> > > Phil
> >
> > >> > > On Tue, Nov 16, 2010 at 10:55 AM, masterkitano <[email protected]>
> > >> wrote:
> >
> > >> > >> thats really a good idea, and in fact I already kind of tought
> about
> > >> > >> it, but I just got stucked on the saving part, since it must save
> not
> > >> > >> just a single bitmap, but a complete set of animations. is there
> a
> > >> way
> > >> > >> to save something like a persitent Sprite ?
> >
> > >> > >> On 16 nov, 11:56, Darcey Lloyd <[email protected]> wrote:
> > >> > >> > Not sure if this is what you want?
> >
> > >> > >> > At model configuration time (user avatar creation) - when they
> hit
> > >> save,
> > >> > >> > create a bitmap of their avatar and send that to the server to
> > >> upload or
> > >> > >> if
> > >> > >> > each user has a user profile, 2 options:
> >
> > >> > >> > 1. If each user has data and files associated with their user
> id, I
> > >> > >> usually
> > >> > >> > create a folder on the server for each user in this case and
> save
> > >> > >> relevant
> > >> > >> > files to their folder. So for you this would be save a jpg of
> their
> > >> > >> avatar
> > >> > >> > here then you can either store a db reference to the file or
> simply
> > >> use
> > >> > >> a
> > >> > >> > path using their user id and ensure that avatar.jpg is a fixed
> file
> > >> name
> > >> > >> so
> > >> > >> > it can be hardcoded or entered into a variables include.
> >
> > >> > >> > 2. If each user doesn't have data stored on the server and no
> > >> folders
> > >> > >> etc to
> > >> > >> > speak of to store data then you could just bump the data into
> the
> > >> db.
> > >> > >> (Blob
> > >> > >> > datatype for MySQL, cant remember SQL Servers datatype, may be
> the
> > >> same,
> > >> > >> but
> > >> > >> > I always go for a physical file).
> >
> > >> > >> > D
> >
> > >> > >> > On 16 November 2010 17:45, masterkitano <[email protected]>
> wrote:
> >
> > >> > >> > > @Liam Jones, the main problem on this, is that each model is
> > >> > >> > > customizable by the user, the user can set the model shirt,
> > >> shoes,
> > >> > >> > > hair etc. so each model is diferent. I cant figure out how to
> pre
> > >> > >> > > render them :S.
> >
> > >> > >> > > @Michael lv, what do yo mean by directional sprites? because
> I
> > >> thought
> > >> > >> > > for instance to render the models from 3dmax, in fact thats
> what
> > >> we do
> > >> > >> > > with furniture
> > >> > >> > > and static objects such as chairs, tables etc. the problem
> with
> > >> the
> > >> > >> > > avatar model is that is composed by body parts and each body
> part
> > >> can
> > >> > >> > > change, so I can't pre render since it is diferent for each
> user.
> >
> > >> > >> > > On 16 nov, 07:53, Michael Iv <[email protected]> wrote:
> > >> > >> > > > Make them directional sprites .This way they will look 3d
> but
> > >> fill
> > >> > >> not
> > >> > >> > > get
> > >> > >> > > > the performance down.
> >
> > >> > >> > > > On Tue, Nov 16, 2010 at 3:35 PM, Liam Jones <
> [email protected]>
> > >> > >> wrote:
> > >> > >> > > > > How are the models animated? I'm just thinking that, if
> you
> > >> want
> > >> > >> to
> > >> > >> > > > > send a 2D representation of their rendering to the other
> > >> clients,
> > >> > >> > > > > would it not be more efficacious to simply pre-render all
> of
> > >> the
> > >> > >> 3d
> > >> > >> > > > > models yourself and have them handled as bitmaps or
> movies
> > >> within
> > >> > >> the
> > >> > >> > > > > application? If the animations it performs are
> predictable,
> > >> you
> > >> > >> could
> > >> > >> > > > > pre-render the animations too.
> >
> > >> > >> > > > > However, I'm guessing that you have already thought of
> that.
> >
> > >> > >> > > > > Have you already created a method by which the 3d models
> are
> > >> > >> turned
> > >> > >> > > > > into bitmaps?
> >
> > >> > >> > > > --
> > >> > >> > > > Michael Ivanov ,Programmer
> > >> > >> > > > Neurotech Solutions Ltd.
> > >> > >> > > > Flex|Air
> >
> > >> |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.nethttp://
> > >> > >> > >www.meetup.com/GO3D-Games-Opensource-3D/
> > >> > >> > > > Tel:054-4962254
> > >> > >> > > > [email protected]
> > >> > >> > > > [email protected]
> >
> > >> > > --
> > >> > > Phil Harvey
> > >> > > [email protected]
> > >> > > AIM: filrv
> > >> > > ICQ: 354535
> > >> > > GTalk: [email protected]
>