Increase RectangleClipping size beyond that of stage dimensions

Software: Away3D 3.x

Jos Yule, Newbie
Posted: 16 June 2011 07:04 PM   Total Posts: 6

Hello all.

I’ve been having no luck figuring this out. I’ve read all the docs i can find via Google, the google group, tried to find it in the code. No dice.

My polys are being clipped at the view-edge, and i really just want to increase the size of the clipping plane beyond the edges of the screen, so they don’t clip at screen-edge.

I’ve tried setting view.clipping = new RectangleClipping() with maxX etc props which are larger then the screen size with no luck.

I don’t want to use NearField or Frustrum clipping, as i’m not using the Broomstick version, and these kill my frame-rate. Basic Rendering is fine, if only i could change the max clipping plane.

Any help, pointers to where in the code the clipping actually happens, anything, would be great!

Thank you.

Peace
jos

   

Avatar
Jerome Maurey-Delaunay, Moderator
Posted: 21 June 2011 10:22 AM   Total Posts: 17   [ # 1 ]

Hi Jos,

Have you tried the frustum clipping class? This will subdivide geometry to avoid disappearing triangles in culling. 

Check out the Hotel Room demo from Rob: http://www.infiniteturtles.co.uk/blog/away3d-23-released

source: http://www.infiniteturtles.co.uk/projects/away3d/demos/FrustumHotelRoom/srcview/index.html

   

Jos Yule, Newbie
Posted: 21 June 2011 02:20 PM   Total Posts: 6   [ # 2 ]

I have looked at both the Frustum and NearField clipping options. However they both reduce my framerate to unacceptable levels.

This is why i’m looking to simply increase the clipping rect, while using the BasicRenderer, as my framerate with it is fine.

I’m sure i’ve looked at those demos, but i’ll check them out again!

Thanks for the reply!
Jos

   

William Grand, Newbie
Posted: 04 July 2011 06:39 PM   Total Posts: 3   [ # 3 ]

I’m looking to do the same thing, did you find any answers?

   

Jos Yule, Newbie
Posted: 04 July 2011 07:28 PM   Total Posts: 6   [ # 4 ]

Nope. Going to reach out to the individual contributors to the project next.

   

Jos Yule, Newbie
Posted: 04 July 2011 07:28 PM   Total Posts: 6   [ # 5 ]

Nope. Going to reach out to the individual project contributors next.

   

William Grand, Newbie
Posted: 04 July 2011 09:22 PM   Total Posts: 3   [ # 6 ]

I think I found a solution:

// stop rendering
removeEventListenerEvent.ENTER_FRAMEonEnterFrame );

// adjust clipping boundaries
view.clipping.minX = -999999;
view.clipping.maxX 999999;
view.clipping.minY = -999999;
view.clipping.maxY 999999;

// remove view
removeChildview );

// render one more time with new clipping boundaries
view.render();

// add view again
addChildview );

// perform operations here //

// restore clipping
view.clipping = new RectangleClipping();

// resume rendering
addEventListenerEvent.ENTER_FRAMEonEnterFrame ); 
   

Jos Yule, Newbie
Posted: 05 July 2011 02:55 PM   Total Posts: 6   [ # 7 ]

That is interesting - do you have to stop the enterframe handler for any specific reason? Like, why can’t you do this in-between a update() call? It seems like, from the code below, that is what is happening anyway.

I look forward to testing this out!

   

Jos Yule, Newbie
Posted: 07 July 2011 06:46 PM   Total Posts: 6   [ # 8 ]

Sadly, i have been unable to get this tweak to work for me.

Do you remove the view on each re-draw, and then re-add it? This hasn’t worked for me.

Any other details would be appreciated!

   

petermd, Newbie
Posted: 28 November 2011 12:18 PM   Total Posts: 1   [ # 9 ]

was trying to figure a way around this also, documented my solution here

http://lastorders.tumblr.com/post/13449983652/off-screen-rendering-in-away3d

basically requires a sub-class of RectangleClipping to ensure that the clipping rect is used as the screen clipping rect also (otherwise the stage dimensions are used regardless of the clip rect size)

-Peter

   

spoco2, Newbie
Posted: 12 January 2012 02:18 AM   Total Posts: 4   [ # 10 ]
petermd - 28 November 2011 12:18 PM

was trying to figure a way around this also, documented my solution here

http://lastorders.tumblr.com/post/13449983652/off-screen-rendering-in-away3d

basically requires a sub-class of RectangleClipping to ensure that the clipping rect is used as the screen clipping rect also (otherwise the stage dimensions are used regardless of the clip rect size)

-Peter

That’s awesome! It’s finally allowed me to create an offscreen render to print. (As I print at a resolution fixed to the print output rather than an individual’s screen resolution, also layout etc. is customized to a print view).


In case your tumblr ever goes away and we lose the solution:

// Use offscreen clipping to clip to viewport 
this.view.clipping=new OffscreenClipping({minX:-w/2,maxX:w/2,minY:-h/2,maxY:h/2});

OffscreenClipping.as

import flash.display.Sprite;
import away3d.core.clip.Clipping;
import away3d.core.clip.RectangleClipping;

/** Custom Clipping implementation for off-screen rendering */
class OffscreenClipping extends RectangleClipping
{
    
//
    // Public methods
    //
    
    /** Create new OffscreenClipping */
    
public function OffscreenClipping(init:Object)
    
{
        super
(init);
    
}
    
    
//
    // RectangleClipping implementation
    //
    
    /** Use the defined Rectangle to define the 'screen' clipping region also */
    
public override function screen(container:Sprite
                                    
_loaderWidth:Number
                                    
_loaderHeight:Number):Clipping
    {
        
// Over-ride default implementation that returns the stage dimensions
        
return this;
    
}
   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X