Destruction in Irrlicht

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Destruction in Irrlicht

Post by jaworekplay »

Hi I'm quite new to the Irrlicht :mrgreen:
I am using PhysX 3.2.1 with Irrlicht and
I was wondering is it possible to display destruction in Irrlicht ? <And if it is possible would that include a lot of work>(whether it's woth it or not*)
i.e like custom shader etc... ?
Thanks :mrgreen:
MrGuy
Posts: 18
Joined: Mon Oct 29, 2012 11:05 pm

Re: Destruction in Irrlicht

Post by MrGuy »

Oh boy, thats a big topic.

What kind of "destruction" do you want? If it is for smaller objects like boxes etc: Sure, thats quite easy. There are different approaches to that like a Box composed of smaller parts which are handles as one box until a force great enough is applied to the box. The smaller parts are handled as seperate objects after that therefore: The box seems to be breaking.
One of many approaches to that.


When it comes to destroyable terrain:
That includes a LOT of work. I speak with experience here, since im working on something like that.
I recommend taking a look at PolyVox here. Its a nice framework which offers both, cubic and smooth terrain. Smooth terrain is extracted by the margin cubes algorithm which produces quite dense Triangle meshes. Therefore: Be carefull with PhysX, i would use a simpler per-Voxel approach here.




Back to topic: What kind of destruction?
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

Destruction of objects like doors, walls etc
Here is the problem
I have physx lab and apex installed on my pc, I can destroy the model in physx lab but it exportes the destruction data in a file format which can be used by udk not irrlicht though :( is there a way to use that file like prefab with all position and bounding boxes? I forgot the extension of the file but when i get back home I'll update my post. Thanks for quick reply :)
EDIT:
the file extensions are .apx and .apb. From what I understand one of them is suppose to be in an xml format. So would it be possible to read the data from that so called xml (.apx) file ?
I'll try it when I'll have more time on my hands and post the results on the forum.
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Destruction in Irrlicht

Post by christianclavet »

You would have to have the source or a library that can parse this in Irrlicht. Parsing is the first problem, you need to use the integrate the "APEX Destruction" APi and make it work with Irrlicht. And that is not a simple task!
Dareltibus
Posts: 115
Joined: Mon May 17, 2010 7:42 am

Re: Destruction in Irrlicht

Post by Dareltibus »

isn't physix limited to a object count of 65536 items? havin separated voxels can be quite limiting
MrGuy
Posts: 18
Joined: Mon Oct 29, 2012 11:05 pm

Re: Destruction in Irrlicht

Post by MrGuy »

I dont think that he is talking about a voxel based approach here. More an object-based.
I dont beliefe Physx has builtin Voxel support. ;)

For the Voxel approach entirely different designs should be used than for the one-object based approaches.
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

So basically if the APEX API can create mesh from that file, then all I have to do is to transform it to the Irrlicht equivalent along with the textures info. :mrgreen:
Anyways thanks for replies, very help full.
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

I thought I would bring some news on how are things going. Well the news is I overestimated how much time I had and had to abandon the project for a while. Before that I did try to make the XML reader to read the destruction data. While at it I figured out that I need to load the mesh in both PhysX and Irrlicht, that probably will cause some performance cost. After that I thought that it would be good idea to explore the mesh creation process, so off I went on irrlicht API searched and searched and read and read. And quite frankly it is complicated to get the data ready for the mesh creation. I understand that I need to implement custom meshLoader to handle APEX xml files.
Question:
Should I create class which derives from IMeshLoader for example

Code: Select all

class newMeshCreator : public IMeshLoader
{
public:
 // read the mesh from file
};
and then implement the

Code: Select all

ISceneManager::addExternalMeshLoader( &newMeshCreatorInstance )
? Am I going in the right direction ?
Thanks.
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Destruction in Irrlicht

Post by Abraxas) »

You want to blow up a door?

Here are the steps I would follow:

Model the door.

Save a new copy of the model. Tesselate and break into 10~20 pieces (without changing orientation)

Save each piece in it's own file.

In Irrlicht:

Define a mesh for your object, and a piecemesh array.

When the object is destroyed, create n objects from the piecemesh. Give each object a certain velocity and rotational velocity.

Every frame, update position with the collisionmanager function and update velocity/position with desired acceleration/elapsed time.

Advantage to this approach: You can predefine behaviors for different destruction behaviors.

An example of this can be seen in counter strike, with the glass.
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

Hi Abraxas)!
Yes I want to destroy door, column or a wall. All these shapes are already defined in the APEX xml file. Reason why I want the Irrlicht to work with these files is because, PhysX is compatible with these files and the simulation should be realistic i.e. pieces are equally represented in both engines. I was thinking about this approach, but then I would have to think of a way to translate the shapes of pieces in to PhysX equivalent to achieve satysfying results.
Second reason why I want to get this to work in this way is because I would like to contribute to the Irrlicht functionality, in my personal opinion it would bring a lot of fun into games created regardless to the genre.
Anyway thanks for the input though, very appreciated. ;)
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Destruction in Irrlicht

Post by Abraxas) »

I've never used PhysX. Maybe it's more optimized for collision detection but there were huge improvements in 1.8.0. getCollisionPosition is MUCH faster than before.

There isn't a way to load 3ds or equivalent files in physX?
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

Do you mean to try the opposite way?
Try to get PhysX to load the files I'm going to use in Irrlicht?
I think it would be more complicated than it is in Irrlicht cause I don't know how PhysX loads custom meshes and don't know whether it has support for such things? I don't know how Irrlicht does it either, ha ha.
Anyways I will look into it.
Thanks.
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Destruction in Irrlicht

Post by Abraxas) »

The point I was trying to make was, why use physx for this? What are you specifically trying to do? Like. What exactly do you want to happen?
jaworekplay
Posts: 36
Joined: Mon Jan 23, 2012 11:14 pm
Location: Lancs, UK

Re: Destruction in Irrlicht

Post by jaworekplay »

Basically I'm working on a college project. In this project me and the rest of the team have to create a game which would be our final year project. Up to this point we have set up the PhysX and Irrlicht engine working parrallel and communicating. Next step I wanted to take it to was to implement destruction of some of the objects in the scene. If it's going to be too hard then I will have to cheat with the destruction, nevertheless I want to avoid this and as I mentioned before would like to add a bit of functionality to the Irrlicht engine.
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Destruction in Irrlicht

Post by Abraxas) »

I was referring to your destruction algorithm. I think the functionality you are looking for does already exist in irrlicht.
Post Reply