Kicker, Member Posted: 27 December 2012 03:36 PM Total Posts: 52
Hi,
I’d like to create a portal (yep, like in Valve’s game), except that it would be floating in mid-air.
So what goes through the portal shouldn’t be visible behind it.
And that’s why I need a mask.
Any idea how (or if) I can do that ? I’ve been searching for a while, now, but can’t find anything.
Thanks in advance.
I’m using Away 3D 4.1.0 Alpha
Kicker, Member Posted: 29 December 2012 01:33 AM Total Posts: 52
[ # 1 ]
Hi !
Still stuck with this… help ? ... Anyone ? Even if it’s to tell me that it’s just impossible…
Kicker, Member Posted: 30 December 2012 01:12 PM Total Posts: 52
[ # 2 ]
By searching really hard, I found this :
Make sure the front (occluding) object is in it’s own contains
(ownCanvas = true in Away3D, layer = someSprite in Away3D Lite) and
then set the blend mode of that container to BlendMode.ERASE. That
will make it into a negative mask for any display objects that are
beneath it provided that they have blend mode BlendMode.LAYER. I can’t
remember exactly what I did, but something similar to this should
work:
var view : View3D = new View3D; view.blendMode = BlendMode.LAYER; this.addChild(view);
var mySprite : Sprite = new Sprite; mySprite.blendMode = BlendMode.ERASE; this.addChild(mySprite);
myOccludingObject.layer = mySprite;
But it doesn’t work.
The “ownCanvas” property doesn’t exist (or not anymore), and nor does the “layer” property.
I can’t believe this used to be possible but isn’t anymore, it doesn’t make any sense.
And why won’t anyone answer this ? I mean, I’ve been looking into this for quite a while, now, and each time I find a question about this mask thing on a forum, it always remains unanswered.
It’s almost creepy… as if every one browsing this thread was thinking to themselves “Oh, my God ! He asked the forbidden question ! He’s crazy !”
80prozent, Sr. Member Posted: 30 December 2012 11:46 PM Total Posts: 430
[ # 3 ]
Hi
in older version of away3d this was possible because the whole rendering process was done by the away3d engine.
since version 4 the gpu handles a big part of the rendering.
afaik what you are looking for is not possible yet.
Kicker, Member Posted: 01 January 2013 12:25 PM Total Posts: 52
[ # 4 ]
Thank you for your reply
I guess this is going in the requests section, now…
theMightyAtom, Sr. Member Posted: 02 January 2013 08:25 AM Total Posts: 669
[ # 5 ]
There is a way of doing this, but by using masks on the material rather than on the geometry, or rendered object.
I made this experiment when Broomstick first came out… http://www.videometry.net/broomstick/RealtimeDeformation.html
(click the plate to add a bullet hole)
You simply manipulate the BitmapData and apply it to your object.
In the particular example I was altering the normals, and the diffuse bitmapDatas, and adding some extra geometry when a hole is made.
The exact same approach can make holes in walls, Portal style.
Good Luck!
Kicker, Member Posted: 02 January 2013 08:10 PM Total Posts: 52
[ # 6 ]
What I’m trying to acheive is slightly different…
Implementing your idea is possible, but incredibly hard.
Since my objects are quite complex, applying transparency just on the part of the texture which is beyond the portal is a calculation I don’t know how to make, even of it’s technically possible.
theMightyAtom, Sr. Member Posted: 03 January 2013 10:27 AM Total Posts: 669
[ # 7 ]
In which case it’s simple The obejct dosn’t dissappear, or get masked. It simply get’s obscured by a plane. That plane could be black, or showing some other graphic to make it look as if the object is swallowed up.
Where there’s a will there’s a workaround, I always say.
I hope this could work for you, otherwise try and explain more how the effect should look.
Good Luck!
80prozent, Sr. Member Posted: 03 January 2013 04:05 PM Total Posts: 430
[ # 8 ]
jeah
i think mightyatoms workarround is performancewise the best solution for your problem.
the only drawback is that you only can use it on a one-colored background like the black one in his example.
another method could be to loop trough all polygons of you mesh and just delete any polygon that is located in a specified area.
if you need to keep your polygons for later (if they will reappear) you could work with a secound mesh that is 100% transparent with no specular, and move any polygon that is located in a specified area over to this transparent mesh.
this way will definitiv be much heavier on the performance, and you will not get a clean cut (since you remove polygon by polygon)
theMightyAtom, Sr. Member Posted: 03 January 2013 05:12 PM Total Posts: 669
[ # 9 ]
80prozent, Sr. Member Posted: 03 January 2013 06:27 PM Total Posts: 430
[ # 10 ]
hi mighty atom
your experiments with the depthMask in fp10 are cool, and very usefull.
is there a way to do this in stage3d?
theMightyAtom, Sr. Member Posted: 03 January 2013 07:07 PM Total Posts: 669
[ # 11 ]
I know there is a depth mask availble from Stage3D, haven’t researched how to get hold of it through away3D.
David Lenaerts would be the guy to ask
Kicker, Member Posted: 03 January 2013 08:32 PM Total Posts: 52
[ # 12 ]
Hi mighty atom,
As 80porzent guessed, what I’m trying to do is not that simple
His solution is interesting, but I really need a clean cut.
Anyway, it gave me an idea :
Let’s say my portal is perpendicular to the X/Z plane. What I can do is constraining the X and Z values to be lower (or higher) than the line traced by the portal on the X/Z plane…
Thus, the mesh would be “squished” against the portal.
80prozent, Sr. Member Posted: 03 January 2013 08:59 PM Total Posts: 430
[ # 13 ]
morphing the mesh against a plane seams like a very good workarround as long as the performance doesnt suffer to much.
good idea
theMightyAtom, Sr. Member Posted: 03 January 2013 09:22 PM Total Posts: 669
[ # 14 ]
I’m sure a screendump on a plane would be cleaner and way more efficient (isn’t it an animated mesh??), not to mention easier. But hey, it’s your party
80prozent, Sr. Member Posted: 03 January 2013 09:46 PM Total Posts: 430
[ # 15 ]
but a screendump would only work easy with a still standing camera.
or do you talk about capturing the screen and apply it to a plane in every renderloop ?