Hole punch class

Software: Away3D 4.x

danielmcq, Newbie
Posted: 09 October 2013 03:27 AM   Total Posts: 5

Awhile back, Fabrice mentioned that he was working on a HolePunch class that would make it easy to create, for example, window openings in a wall.

Fabrice, just curious: did you ever complete that class and share it with the community? I couldn’t find anything on the forums after you mentioned it…




theMightyAtom, Sr. Member
Posted: 09 October 2013 06:41 AM   Total Posts: 669   [ # 1 ]

I’m pretty sure there isn’t one, however I have developed a couple of techniques for this.
First the quick and dirty, make a hole in the texture, rather than the geometry.

For windows and doors, I use a series of boxes or planes, depending on whether they have thickness or not. That the way I add windows and doors in this solution…


(danish only, but hopefully should be simple enough to build a room and preview in 3D smile

Good Luck!



theMightyAtom, Sr. Member
Posted: 09 October 2013 06:54 AM   Total Posts: 669   [ # 2 ]

Just saw this tutorial on Procedural geometry, which would be the best, most correct way to add holes.



SuperSam, Sr. Member
Posted: 12 October 2013 09:27 PM   Total Posts: 102   [ # 3 ]

Hi Mr. Atom, could you please elaborate a bit on how you use boxes/planes to cut holes inside a wall mesh ?

Thanks ^_^



danielmcq, Newbie
Posted: 14 October 2013 08:24 PM   Total Posts: 5   [ # 4 ]

Thanks theMightyAtom for your thoughts.

So you’re suggesting that ideally I should build up the vertices of the wall procedurally, and then I guess extrude that 2D mesh into a full wall? I’m not so versed in 3D, so my next question would be: is there a standard algorithm in the industry that’s used to break up a rectangle with various sized openings into a triangular mesh?

I’m with SuperSam…if you can to share any more thoughts on the technique you described, I’d be much obliged. The app you built is fantastic!

FYI, I’m investigating this as a way of visualizing energy and daylighting simulations for single-zone buildings.



theMightyAtom, Sr. Member
Posted: 15 October 2013 08:06 AM   Total Posts: 669   [ # 5 ]

OK, well the plane technique is the most simple, for windows and doors, and this is the technique I used in that application, after all why make things complicated?

See the attached image. The “wall” is a collection of planes.

I like using planes for walls as the automatically disappear when viewed from the “outside”, just as long as you DON*T have bothsides=true on your material.

Exactly the same technique can use boxes to give your wall thickness.
Using careful mapping of say, a brick texture, you can hide completely the fact that the wall is made up of lots of components.

OK, so now you just have to work out the distances along the wall, from the start to the first door, door to window, etc. Not too difficult, hopefully.

To punch holes in the texture, you need one large texture covering your entire wall to start with. That should contain a “draw” of a Sprite you keep off stage. You can use the ERASE blend mode to make holes in the texture. (Make sure it’s parent has blendMode “LAYER”).
Then copy your texture with added holes into the bitmapData of the BitmapTexture, and make sure it has transparent=true.
Then on your material, give an alphaThreshold of 0.5.

You could use 2 planes spaced apart with transparent textures, and fill the gap with some extra geometry, simple planes again would do the trick.

Daniel, if you use the procedural technique you can build the entire 3D shape, rather than 2D + extrude, but whatever is easier for you.

Good Luck!



SuperSam, Sr. Member
Posted: 15 October 2013 01:53 PM   Total Posts: 102   [ # 6 ]

Ha ha thanks for the reply, that’s a good demonstration of KISS smile

The way I understood your text about using planes and boxes, I thought you were using their geometry to cut inside the wall geometry without having to mess with individual vertices. I’d be curious to see such a technique at the ready within Away3D.

Your advice is what I tend to do as well except for the texture placement trick that hides how the wall is made of multiple blocks. I’ll keep that in mind, thanks smile



danielmcq, Newbie
Posted: 19 October 2013 03:36 PM   Total Posts: 5   [ # 7 ]


You are truly mighty! Thanks for the thoughtful response.





Away3D Forum

Member Login