Hey WIlliam it is possible to group objects into the same sprite container using rendersessions. each 3d object has a property 'ownSession', and if you set objects in your scene to have the same session for ownSession, they will all render in teh same sprite. the default session to use is SpriteRenderSession:
objectA = new Sphere(); objectB = new Sphere(); containerA = new ObjectContainer3D(objectA); scene.addChild(containerA); containerB = new ObjectContainer3D(objectB); scene.addChild(containerB); mySession = new SpriteRenderSession(); containerA.ownSession = mySession; containerB.ownSession = mySession; and then you can access the sprite being used to render objectA and objectB like this: mySprite = mySession.getContainer(view); however.... this is not the whole story, becasue you also want to control the z-depth of this session container, and currently that is not possible, sorting is currently done automatically based on the registration point of the object in the scene. if you do what i've done above, the session depth will sort to the point of the nearest object in the scene (the last one to set the depth of the session), with ownSession set. however, you can try and move the registration point of objects you want to always render behind by doing this: objectA.movePivot(0, 0, 1000); objectA.moveTo(0, 0, -1000); objectB.movePivot(0, 0, 1000); objectB.moveTo(0, 0, -1000); this will ensure that whatever object z-depth the rendersession decides to grab, it will always be behind other objects, assuming your camera is not going to rotate. this is all a bit clumsy i know, so i'll look at creating a patch that allows you to overrride the z-depth on a rendersession, to create layers with exactly the same characteristics as in pv3d cheers! Rob On Wed, Feb 18, 2009 at 9:42 AM, Fabrice <[email protected]> wrote: > > Why do you need a containers for this in the first place? > Its all overhead for nothing. I understand from your mail it's the PV way > of doing things... > Looks like a hamburger construction to me... and as you know hamburgers are > not that healthy :)) > > A simple class being a custom primitive like the Plane object, top half > being the image information as is. > down part being the reflection illusion. The reflection part is a simple > gradient your merge with the image info. > A simple redraw or MovieMaterial is enough here. > > If you need to fade the reflection, its just a matter of updating a > gradient before you merge if you use draw. > or just update your movieclip source if you use MovieMaterial. > > The mapping info of the custom plane just needs to look like this: > > U info: 0/1 > V info: 1/0 0/1 > > The class just needs to autocenter on y if the image may vary on size. > addOnMouseDown, Over etc and you are done... > > 2 or 3 hours work max. Will run faster, reusable for other projects. Simple > & Clean. > > If you need help for the build, just drop a mail, I'll help you. > > Fab > > > On Feb 18, 2009, at 3:42 AM, [email protected] wrote: > > >> Let take this photoflow as example. >> >> http://www.flashloaded.com/flashcomponents/photoflow/ >> >> Each item is a ObjectContainer with photo and reflection. >> >> I need to do fading on the reflection. So, i put all reflection object >> in one layer and apply a mask. >> >> Hope this more clear. >> >> On Feb 18, 12:56 am, Fabrice <[email protected]> wrote: >> >>> Any visuals would certainly help... >>> >>> Fabrice >>> On Feb 17, 2009, at 5:46 PM, Li wrote: >>> >>> Mmmm... I dont know, perhaps someone else on the list can throw you >>>> a clue... >>>> >>> >>> On Tue, Feb 17, 2009 at 1:01 PM, [email protected] < >>>> [email protected] >>>> >>>>> wrote: >>>>> >>>> >>> Thanks Li. >>>> >>> >>> I have think of this idea. But seem not work in my case. >>>> >>> >>> My object is in hierarchical structure. >>>> >>> >>> e.g. >>>> >>> >>> I have object structure >>>> >>> >>> ObjectContainerA have ObjectA and ObjectB (fake shadow) >>>> ObjectContainerB have ObjectC and ObjectD (fake shadow) >>>> >>> >>> But i want to render Object B and ObjectD in the same layer. In order >>>> i can do some copypixel and effect on the layer. >>>> >>> >>> Since papervision layer system is independent to object structure. i >>>> can put any object in the same layer for render. >>>> >>> >>> I dig in the code of away3d. I find something called render session. >>>> Do this stuff help on my case? >>>> >>> >>> On Feb 17, 2:15 pm, Li <[email protected]> wrote: >>>> >>>>> Hey William, >>>>> >>>> >>> If you set ownCanvas = true to any 3d object, it will be rendered >>>>> >>>> in its own >>>> >>>>> Sprite container. Once this is done you can apply any effects/ >>>>> >>>> filters to it >>>> >>>>> as if it was a normal sprite. Furthermore, you can use an >>>>> >>>> ObjectContainer3D >>>> >>>>> to place other objects within it, set ownCanvas = true for the >>>>> >>>> container and >>>> >>>>> apply a filter to all, for instance: >>>>> >>>> >>> var container:ObjectContainer3D = new ObjectContainer3D(); >>>>> scene.addChild(container); >>>>> >>>> >>> var obj1:Cube = new Cube(); >>>>> obj1.x = 1000; >>>>> container.addChild(obj1); >>>>> >>>> >>> var obj2:Sphere = new Sphere(); >>>>> obj2.x = -1000; >>>>> container.addChild(obj2); >>>>> >>>> >>> container.ownCanvas = true; >>>>> container.filters = [new BlurFilter()]; >>>>> >>>> >>> Haven't tested it, but it should work... >>>>> Hope it helps, and welcome to Away =) >>>>> >>>> >>> On Tue, Feb 17, 2009 at 1:37 AM, [email protected] < >>>>> >>>> >>> [email protected]> wrote: >>>>> >>>> >>> Hi, >>>>>> >>>>> >>> I am new to away3d. I try papervision 3d before. Now, I want to >>>>>> >>>>> switch >>>> >>>>> the work to away3d. >>>>>> But I find a function missing in away3d which stop me for using >>>>>> >>>>> it - >>>> >>>>> Render Layer. >>>>>> >>>>> >>> I have a scene with several object. In papaervision3d, I can >>>>>> >>>>> render >>>> >>>>> each object in different layer. >>>>>> More, I can place different object in the same render layer and do >>>>>> effect on all object as once in that layer. >>>>>> >>>>> >>> I search though the api and code. I can't figure out how can I >>>>>> >>>>> do it >>>> >>>>> with away3d. >>>>>> From the achieve of this mail group, I learn a method which >>>>>> >>>>> separate >>>> >>>>> the object in different view and render. >>>>>> >>>>> >>> But, I find it is not practical in my case. Since the objects have >>>>>> hierarchical structure, I don't want to break the structure. >>>>>> >>>>> >>> Anyone have experience to deal with this issue? >>>>>> >>>>> >>> William >>>>>> >>>>> > -- Rob Bateman Flash Development & Consultancy [email protected] www.infiniteturtles.co.uk www.away3d.com
