Yes of course,
SpriteRenderSession z-sorting is based on the pivot position.
So il you want z-sorting well ordered you will move the pivot of each
object the nearest from the camera.
So yes it's very important for z-sorting issue.

On 8 oct, 11:04, Michael Iv <[email protected]> wrote:
> Can I receive a liitle explanation about the effect of usage of
> SrpiteRenderSession and why is moving of the Pivot contributes to correct z
> sorting  . Is the upgrading Z sorting is important part of performance
> improvement?.
>
>
>
> On Thu, Oct 8, 2009 at 10:28 AM, enguer <[email protected]> wrote:
>
> > Hi Michael,
> > In order to optimize textures of town, i use a custom clipping script.
> > I figured out that away3d do clipping but when a lot of objects are
> > "added" to the scene, performance goes down.
> > So I put a script that remove object when they are far or behind the
> > camera.
> > I used a lot of SrpiteRenderSession and movePivot to correct the Z-
> > sorting.
> > For texture i put in array 3 kind of bitmap for each texture: High/
> > Medium/Low. The textures switches depends on the distance from the
> > camera.
>
> > And the 100 first frame calculate the average fps of the project and
> > switch automatically this parameters:
> > -Max Distance Clippin
> > -Medium Texture Distance
> > -High Texture Distance
> > -Quality of flash player
> > -Resolution of the frustum clipping thing.
>
> > It's a sample of tick :
> >                public function update(cam:Camera3D,Conf:Object):void{
> >                        if (!reset){
> >                                //Distance processing
> >                                //DISTANCE
> >                                var c:Number3D = new
> > Number3D(cam.x,cam.y,cam.z);
> >                                //ANGLE
> >                                var mc = cam.viewMatrix;
> >                                for (var o in Objects) {
> >                                        //TRANFORM CENTER TO THE CAMERA
> >                                        var ct:Number3D = new Number3D();
> >                                        ct.clone(Objects[o].extra.center);
> >                                        ct.transform(ct,mc);
> >                                        if
> > (c.distance(Objects[o].extra.center)<Conf.Clipping.MaxDist&&
> > (ct.z>-200)){
> >                                                if (!Objects[o].extra.set){
> >                                                        if
> > (Objects[o].extra.container){
>
> >  Objects[o].extra.container.addChild(Objects[o]);
> >                                                        }else
> > addChild(Objects[o]);
> >                                                        Objects[o].extra.set
> > = true;
> >                                                }
> >                                                if
> > (!Objects[o].extra.noswitch){
> >                                                        //Quality selection
> >                                                        if
> > (c.distance(Objects[o].extra.center)<Conf.Clipping.High){var
> > Q = 2;
> >                                                        }else{
> >                                                                if
> > (c.distance(Objects[o].extra.center)<Conf.Clipping.Medium)
> > var Q = 1;
> >                                                                else Q = 0;
> >                                                        }
>
> >                                                        if
> > ((Objects[o].extra.Quality!=Q||Objects[o].extra.Blur)){
> >                                                                //Texture
> > loading and switching
> >                                                                var
> > faceMat:BitmapMaterial = Objects[o].extra.Materials
> > ["Front"][Q];
> >                                                                var
> > nullMat:ColorMaterial = new ColorMaterial(0x000000,{alpha:
> > 0});
>
> >  faceMat.smooth=true;
> >                                                                var
> > sideMat:BitmapMaterial = (Objects[o].extra.Materials
> > ["Side"]!=undefined)?Objects[o].extra.Materials["Side"][Q]:Objects
> > [o].extra.Materials["Front"][Q];
>
> >  sideMat.smooth=true;
> >                                                                if
> > (Objects[o].extra.dim.ry==90){
>
> >  Objects[o].cubeMaterials.left = faceMat;
>
> >  Objects[o].cubeMaterials.right = faceMat;
>
> >  Objects[o].cubeMaterials.front = sideMat;
>
> >  Objects[o].cubeMaterials.back = sideMat;
> >                                                                }else{
>
> >  Objects[o].cubeMaterials.front = faceMat;
>
> >  Objects[o].cubeMaterials.back = faceMat;
>
> >  Objects[o].cubeMaterials.left = sideMat;
>
> >  Objects[o].cubeMaterials.right = sideMat;
> >                                                                }
>
> >  Objects[o].cubeMaterials.top = nullMat;
>
> >  Objects[o].cubeMaterials.bottom = nullMat;
>
> >  Objects[o].extra.Quality=Q;
>
> >  Objects[o].extra.Blur=false;
> >                                                        }
> >                                                }
> >                                        }else{
> >                                                if (Objects[o].extra.set){
> >                                                        Objects[o].extra.set
> > = false;
> >                                                        if
> > (Objects[o].extra.container)Objects
> > [o].extra.container.removeChild(Objects[o]);
> >                                                        else
> > removeChild(Objects[o]);
> >                                                }
> >                                        }
> >                                }
> >                                if (time>=ticktime){
> >                                        for (var Co in Conts) {
> >                                                //Processing of pivot
> > displacment in order to fight z-sorting
> >                                                var Ca = new
> > Number3D(cam.x,cam.y,cam.z);
>
> >  Ca.transform(Ca,Conts[Co].inverseSceneTransform);
> >                                                var Y = Ca.y;
> >                                                var X = Ca.x;
> >                                                var Z = Ca.z;
> >                                                if (Ca.x>Conts[Co].maxX) X =
> > Conts[Co].maxX;
> >                                                if (Ca.x<Conts[Co].minX) X =
> > Conts[Co].minX;
> >                                                if (Ca.z<Conts[Co].minZ) Z =
> > Conts[Co].minZ;
> >                                                if (Ca.z>Conts[Co].maxZ) Z =
> > Conts[Co].maxZ;
> >                                                var Piv = new
> > Number3D(X,Y,Z);
>
> >  Piv.transform(Piv,Conts[Co].sceneTransform);
> >                                                if
> > (Conts[Co].pivotPoint!=Piv){
>
> >  Conts[Co].movePivot(X,Y,Z);
>
> >  Conts[Co].moveTo(Piv.x,Piv.y,Piv.z);
> >                                                        if
> > (DEBUG_PIVOT)Conts[Co].extra.pivot.moveTo
> > (Piv.x,Piv.y,Piv.z);
> >                                                }
> >                                        }
> >                                        time=0;
> >                                }else time++;
> >                        }
> >                }
>
> > Hoping this will help
>
> > Cheers
>
> > On 8 oct, 09:16, Michael Iv <[email protected]> wrote:
> > > Enguer Hello , I am in shock of the preformance of your website.Can you
> > > share a few tips about texture optimization that you have done
> > there.Because
> > > i am finishing a game project right now that involves a lot of different
> > > textures and I am struggling to encrease performance by optimizing
> > different
> > > parts . But so far I am not succeeding much .
> > > I will very appreciate any tip.
>
> > > On Thu, Oct 8, 2009 at 12:36 AM, enguer <[email protected]> wrote:
>
> > > > Hi,
> > > > I finally release this project; you can find it athttp://
> >www.bandit3.com
> > > > I will be glad to know your opinion about this project.
>
> > > > cheers
>
> > > > Enguer
>
> > > > On 28 sep, 14:42, Rob Bateman <[email protected]> wrote:
> > > > > Hey Enguer
>
> > > > > please see my previous response to this. it may not be the answer you
> > > > were
> > > > > looking for, but it should at least explain why you see what you do
>
> > > > > the site demo look simply amazing - be sure to let us know when it is
> > > > live!
>
> > > > > cheers
>
> > > > > Rob
>
> > > > > On Wed, Sep 23, 2009 at 5:52 PM, enguer <[email protected]>
> > wrote:
>
> > > > > > Oups
> > > > > >http://bandit3.kob-eye.com/TestBB2.swf
>
> > > > > > On 23 sep, 18:52, enguer <[email protected]> wrote:
> > > > > > > And again with 2 box in a objectContainer3D :
> > > > > >http://bandit3.kob-eye.com/TestBB.swf
>
> > > > > > > On 23 sep, 18:43, enguer <[email protected]> wrote:
>
> > > > > > > > I know why my script doesnt work well... There is a bug in
> > > > maxX/minX
> > > > > > > > etc.... values.
>
> > > > > > > > I've create a simple example with debugbb = true and debugbs =
> > > > true;
> > > > > > > > I've supposed minX,maxX,minZ,maxZ... would be the bouding box
> > > > > > > > geometry.
>
> > > > > > > >http://bandit3.kob-eye.com/TestBB.swf
>
> > > > > > > > But in this example we see that the boudingbox is containing
> > the
> > > > > > > > bounding sphere, and that's why minX,maxX.... doesnt represent
> > the
> > > > > > > > real geometry but the geometry of the bouding sphere ....
> > That's
> > > > not
> > > > > > > > the same.
>
> > > > > > > > So how can i get the real minX/maxX.... values ?
>
> > > > > > > > On 23 sep, 16:10, enguer <[email protected]> wrote:
>
> > > > > > > > > I've placed this inside the tick method (processed at each
> > frame)
> > > > of
> > > > > > > > > each objectContainer3D (one for each block of buildings).Each
> > > > > > > > > objectContainer contain a spriterendersession.
> > > > > > > > > cam => is the camera on the scene
> > > > > > > > >                                 var Ca = new
> > > > > > Number3D(cam.x,cam.y,cam.z);
> > > > > > > > >                                 Ca.transform(Ca,);
> > > > > > > > >                                 var Y = Ca.y;
> > > > > > > > >                                 var X = Ca.x;
> > > > > > > > >                                 var Z = Ca.z;
> > > > > > > > >                                 if (Ca.x>maxX) X = maxX;
>
> ...
>
> plus de détails »

Reply via email to