I solved a similar problem (with my own kind of sprite) by hacking the
source code. It might be helpful to you:
in ProjectionTraverser.as, just after computing _viewTransform, add the
following lines:
if (node is Sprite3D)
{
_nodeClassification =
_cameraVarsStore.nodeClassificationDictionary[node] = Frustum.IN;
return true;
}
but since in my case I'm dealing with my own kind of sprite, I'm not sure if
it works for Sprite3D. Good luck!
- Rujia
On Wed, Jun 30, 2010 at 3:35 PM, Gleb Kobzar <[email protected]> wrote:
> The problem is not yet solved. If anybody had the same and got it
> solved please share your experience!
>
> On 10 июн, 15:57, Michael Iv <[email protected]> wrote:
> > Well ,although i am sure that there is easier solution (still did not
> look
> > for it) ,you can go into FrustrumClipping class and hack it. You should
> work
> > with Frustrum planes against which the distance to the objects that need
> to
> > be clipped is measured. But it is quite strange that minX maxX don't
> work.
> >
> >
> >
> > On Thu, Jun 10, 2010 at 3:48 PM, Gleb Kobzar <[email protected]>
> wrote:
> > > Hi Michael,
> >
> > > Thanks a lot for the reply. But I can't find properties minX and maxX
> > > for view3D object. Guess you mean according clipping props. Setting
> > > clipping properties even up to:
> > > clipping.minX = -10000;
> > > clipping.minY = -10000;
> > > clipping.maxX = 10000;
> > > clipping.maxY = 10000;
> >
> > > doesn't help - there is no effect at all. This is strange because
> > > smaller values do clip the view.
> >
> > > On 10 июн, 15:26, Michael Iv <[email protected]> wrote:
> > > > As far as I understand that , because Sprites have no meshes of
> triangles
> > > > ,so there can be no clipping on triangles level(So only triangles
> that
> > > > outside the frustrum are invisible). Therefore When your sprite
> passes
> > > the
> > > > clipping border it disappears completely . Try to push view.minX and
> maxX
> > > .
> > > > to broaden clipping area.
> >
> > > > On Thu, Jun 10, 2010 at 3:19 PM, Gleb Kobzar <[email protected]>
> > > wrote:
> > > > > Hello,
> >
> > > > > I have a problem with Sprite3D and FrustumClipping. When I use
> > > > > Rectangular or Nearfield clipping Sprite3D objects are displayed
> > > > > correctly. But FrustumClipping makes all Sprite3D objects disappear
> > > > > near screen borders. I noticed they disappear when Sprite3D center/
> > > > > pivot point moves out of view borders (moving over the surface with
> > > > > arrows):
> > > > >http://www.kollaps.com.ua/gb/SpriteFrustum/
> >
> > > > > Here are sources for Flash CS4:
> > > > >http://www.kollaps.com.ua/gb/SpriteFrustum/SpritePlants.zip
> >
> > > > > And AS3 code related to Sprites, view, scene and camera setup:
> >
> > > > > function initEngine():void
> > > > > {
> > > > > scene = new Scene3D();
> >
> > > > > scamera = new SpringCam();
> > > > > ...
> > > > > clipping= new FrustumClipping({minZ:50, maxZ:2000});
> >
> > > > > var basicrenderer:BasicRenderer = new BasicRenderer();
> >
> > > > > view = new View3D();
> > > > > view.renderer=basicrenderer;
> > > > > //view.renderer=Renderer.INTERSECTING_OBJECTS;
> > > > > view.x = stage.stageWidth / 2;
> > > > > view.y = stage.stageHeight / 2;
> >
> > > > > view.scene = scene;
> > > > > view.camera = scamera;
> > > > > view.clipping = clipping;
> >
> > > > > addChild(view);
> > > > > }
> > > > > function initMaterials():void
> > > > > {
> >
> > > > > floorMaterial = new
> > > TransformBitmapMaterial(Cast.bitmap(GrassOld), {
> > > > > scaleX:0.05, scaleY:0.05, repeat:true});
> > > > > treeMaterial = new BitmapMaterial(Cast.bitmap(OakTree));
> > > > > //treeMaterial = new BitmapMaterial(new OakTree(362,263*2));
> > > > > }
> > > > > function initObjects():void
> > > > > {
> >
> > > > > floor=new Plane();
> >
> > > > > floor.height=PLANE_LENGTH;
> > > > > floor.width=PLANE_LENGTH;
> > > > > floor.segmentsH=PLANE_SEGMENTS;
> > > > > floor.segmentsW=PLANE_SEGMENTS;
> > > > > floor.material=floorMaterial;
> >
> > > > > view.scene.addChild(floor);
> >
> > > > > Trees=new Array();
> > > > > var sprite:Sprite3D;
> > > > > var spriteMesh:Mesh;
> >
> > > > > for (var i:int = 0; i <100; i++) {
> > > > > spriteMesh=new Mesh();
> > > > > sprite = new Sprite3D(null,362,526);
> >
> > > > >
> spriteMesh.x=PLANE_LENGTH*Math.random()-PLANE_LENGTH/2;
> > > > >
> spriteMesh.z=PLANE_LENGTH*Math.random()-PLANE_LENGTH/2;
> > > > > spriteMesh.y=0;
> > > > > sprite.material=treeMaterial;
> >
> > > > > sprite.scaling=2.0+2.0*Math.random();
> >
> > > > > spriteMesh.addSprite(sprite);
> > > > > view.scene.addChild(spriteMesh);
> > > > > }
> >
> > > > > }
> >
> > > > > You may notice that I create a Mesh object for each sprite, because
> I
> > > > > would need to add interactivity and zDepth actions. By the way
> without
> > > > > this all sprites disappear under Frustum Clipping.
> >
> > > > > May be I'm doing something wrong?
> >
> > > > > Thanks beforehand for advice
> >
> > > > --
> > > > 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]
> >
> > --
> > 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]