Blasting a hole thru a wall

Started by
23 comments, last by akn81 21 years, 4 months ago
Hi, I''ve been wrestling with this problem for weeks: Lets say I have a wall composed of triangles, if I shoot a cylinder (like a phaser blast from star trek) at it, how do I reshape the wall to leave a cylinder shaped hole, and create a cylinder inside it? Test scenario: a cube with 6 sides, 8 triangles per side gets shot by a cylinder with 8 triangles at its base. The cylinder touches the center of one of the cube''s sides. I now have to move the affected side''s triangles about, leaving a gap so I can move the cylinder inside. What''s the algo for that? I''m so frustrated and would appreciate any help. I''m not using CSG by the way, so there really is nothing inside my cube.
Advertisement
If that were easy, every FPS would do it. The problem is possible (read up on constructive solid geometry, ie. newmesh=cube-cylinder) however it''s very computationaly expensive and results in lots of little polygons. When used in a game it will probably wreak havoc on your level organization, so major slowdowns will occure when you have to recalculate the bsp tree or whatever else you use. Another major problem with this has to do with texturing. What texture do you use for the inside of a wall? if one side is a brick, and the other is plaster, your level editor would have to store information on "inside" textures also. Basically, it can be done but it''s not easy, luckly if you do a google search, you will find lots of info on this because it''s been around for a long time. Tron was actually rendered (raytraced) using constructive solid geometry because back then they didn''t have the storage for fully polygonal models.
exactly as Pseudo said, but thought I''d add you might want to look into the "Boolean" geometry operations - Boolean Subtraction, Addition, Intersection ... (sometimes OR/AND/NOT terminology is used)...

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

What about putting a decal on the wall with a bump map on it to look like it has a big dent in it? Would probably be much less hassle, and look better, assuming you can support bump mapping in your project.
I would think that generally you would only want that to be possible with certain walls, i.e. secret areas. So to actually do it in a game one option seems to be to use a model for that section of wall and have before/after models. Of course if you want to procedurally generate the after model then that leaves the original problem.
Keys to success: Ability, ambition and opportunity.
You could have som kind of anti-z decal that change the z-buffer, and then draw the polys behind the wall afterwards... and you could also have a mesh inside the wall that is seen. it could work. wouldn''t be a "real" hole that can be shot through unless you add some special code for that too though

/ Jolle
When I first saw this thread I thought of a decaling method, but it is possibly wandering away from what you are trying to achieve and dependant on the rendering api you are using. I''ll throw it in anyway...

Render the box with an alpha channel for each face. At the beginning each alpha channel would cause the faces to be rendered solid, then you''d have to cut "holes" in the alpha channels as they are hit.

The advantage would be that you can hit it as many times as you like with no complex mesh adjusting algorithms that will take time and increase the triangle count (increasing rendering time).

There''s still one oddity though... what happens if the user shoots a complete line of holes all around the perimeter of the face? - the middle section should fall to the ground!
quote:Original post by matibee
When I first saw this thread I thought of a decaling method, but it is possibly wandering away from what you are trying to achieve and dependant on the rendering api you are using. I''ll throw it in anyway...

Render the box with an alpha channel for each face. At the beginning each alpha channel would cause the faces to be rendered solid, then you''d have to cut "holes" in the alpha channels as they are hit.

The advantage would be that you can hit it as many times as you like with no complex mesh adjusting algorithms that will take time and increase the triangle count (increasing rendering time).

There''s still one oddity though... what happens if the user shoots a complete line of holes all around the perimeter of the face? - the middle section should fall to the ground!


Unless you''re using 3 dimensional textures(no, not cubemaps) then this suggested method would artefact horribly. Its not really viable, and if it were this easy, then it''d be common in nowadays games. Not trying to make you feel bad or anything though.....
*st0ned*
Red Faction did it rather good.
Arguing on the internet is like running in the Special Olympics: Even if you win, you're still retarded.[How To Ask Questions|STL Programmer's Guide|Bjarne FAQ|C++ FAQ Lite|C++ Reference|MSDN]
Unfortunately, deformable terrain was one of the few things Red Faction did well...

Peace,
ZE.

edit Sorry, had to remove the link because of bandwidth restrictions.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links


[edited by - zealouselixir on November 24, 2002 4:37:21 PM]

[twitter]warrenm[/twitter]

This topic is closed to new replies.

Advertisement