Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / How to shatter objects?

Author
Message
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 14th Apr 2016 13:46
Hello everybody.

I'm looking for ways to 'shatter' an object.
Imagine shooting a bullet to a glass object, and the glass object shatters, and the pieces fall on the ground.

I found a way to do this by memblock and mesh manipulation. https://www.thegamecreators.com/codebase/view/412962d3be0474af755c9c6f2f5ff68a
But the mesh doesn't seems to be affected by light, so I imagine it wont be affected by cubemapping shaders too. (or am I missing something? Can we do that somehow?)

Another thing that I dont understand is the command;
CHANGE MESH Object Number, Limb Number, Mesh Number
What does this command do exactly. Am I wrong to assume it changes the vertex of the specified object so that it mimics the vertex of the specified mesh?

And finally, it would be dandy if we can rearrange the faces to form 'shards' rather than 'flakes'.
Anybody knew of a good way to do this? Voronoi partitioning or something?

Thanks
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 14th Apr 2016 22:40
Stab In The Dark Software posted some demos of his plugin which does that sort of thing:

https://forum.thegamecreators.com/thread/214191


Powered by Free Banners
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 15th Apr 2016 07:53
Yep, that was sweet.
But the download link was dead. I was 1 year too late.
I asked StabInTheDark, but he didn't do them anymore
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 15th Apr 2016 16:01
That's a shame - they were good demos.


Powered by Free Banners
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 19th Apr 2016 11:20 Edited at: 19th Apr 2016 11:22
You may want to try this, Code Snippets / [DBP] Make any object explode
https://forum.thegamecreators.com/thread/173904
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 20th Apr 2016 17:44
Hey thanks, I was looking for that particular thread. I guess I missed the 'explode' keyword in my search
Morcilla
21
Years of Service
User Offline
Joined: 1st Dec 2002
Location: Spain
Posted: 21st Apr 2016 09:37
Glad to help
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 21st Apr 2016 14:26
I stopped development on the Fracture physics for DBPro awhile ago. Partly because of a lack of interest from the DBPro
users and I wanted to move on to multiplatform with AGK. I did want to get the Fracture and CSG added to AppGameKit for the community
to use but it looks like that will not happen now.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 23rd Apr 2016 02:11

Quote: "I stopped development on the Fracture physics for DBPro awhile ago. Partly because of a lack of interest from the DBPro users"


It's not our fault! The public education system is turning out dull minded people. LoL... Remember "The Wall"? Anyhoo...
I'm sad to see that DBP is the only thing being fractured around here. However, i think Blender can offer some hope for fracturing objects, although i have never tried this particular feature...

Chris Tate
DBPro Master
15
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 24th Apr 2016 23:18
Lol. Can't say I disagree with you Derek. Blender should do the trick.

Do not lose hope; I think DBP will come back in a big way when people start to get a little home sick.

That would have been a nice plugin Stab in the Dark... I hope you continue with it in future in anycase; we all have to pay the rent, but I am sure you could find a way to make it work with both AppGameKit and DBP.
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 25th Apr 2016 01:33
Quote: "That would have been a nice plugin Stab in the Dark... I hope you continue with it in future in any case; we all have to pay the rent, but I am sure you could find a way to make it work with both AppGameKit and DBP."


Sadly no there aren't any DBPro customers anymore. As for AppGameKit I could not get them to accept vehicle physics never mind destruction physics.
I will however be using all the nice physics I developed for my own projects in AppGameKit Tier2. I will be one step ahead of everyone else.
I could license the code to AppGameKit Tier 2 users but I think like DBPro it is fading away also.

Quote: " I think Blender can offer some hope for fracturing objects,"


Blender does use a fracture method close to mine. The down side is that it will only be animation in DBPro and not physics.
The coffee is lovely dark and deep,and I have code to write before I sleep.
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 25th Apr 2016 12:11
Stab In The Dark

Maybe we should keep an eye on Rudolpho and his DX11 Plugin for DBPro.
His DBPro version will probably became a hit, if we can use DX11 graphics in DBPro easy language.
Maybe you can collaborate with him to make a physic plugin for his DX11 plugins?
If his DX11 Ziggurat is advertised right, then DBPro will get resurrected in DX11, and they'll need your physics
Stab in the Dark software
Valued Member
21
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 25th Apr 2016 15:24
Quote: "His DBPro version will probably became a hit, if we can use DX11 graphics in DBPro easy language."


Sorry but I doubt that. No offense to Rudolpho but DBPro is too slow compared to C++. Even Lee converted GG to C++.
The coffee is lovely dark and deep,and I have code to write before I sleep.
Kevin Picone
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 25th Apr 2016 17:02

If the plug in does all the grunt work, then the speed of exectuion on the Dbpro code side isn't that much of a concern.

The distribution of work between command sets & the language core can sway the performance both ways. If users need to do too much mirco management in on their side, this can have very pronounced impact on end performance. Where as making the interface higher level can be easier for users but there’s the inevitable restrictions.




PlayBASIC To HTML5/WEB - Convert PlayBASIC To Machine Code
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 1st May 2016 10:08 Edited at: 1st May 2016 10:09
If I have a box, and I wanted to break it into 2, how do I do that while each halves retain their original shape? (suppose that the box is high poly enough)
How to regroup the vertex into 2 parts so that it appears as if it's been divided in the middle?
Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 3rd May 2016 17:03
Quote: "If I have a box, and I wanted to break it into 2, how do I do that while each halves retain their original shape? (suppose that the box is high poly enough)
How to regroup the vertex into 2 parts so that it appears as if it's been divided in the middle?"


Have you tried any of the CSG or VERTEXDATA commands?
CSG UNION, for example, can weld stuff together seamlessly.

A real modeling program like Blender will save you time in the long run, but I also like seeing what I can do in DBP first.
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 4th May 2016 16:23
Quote: "Have you tried any of the CSG or VERTEXDATA commands?
CSG UNION, for example, can weld stuff together seamlessly."


Do you have an example project demonstrating this that you can share?
The help files examples didn't work, probably they need some custom models or something?
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 4th May 2016 22:25
Perform csg union



perform csg difference

Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 4th May 2016 23:01

One piece of advice I'll add is that if your objects aren't responding to the CSG commands try changing their format with CONVERT OBJECT FVF n,338
Usually works for me, anyway!
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 5th May 2016 00:02 Edited at: 5th May 2016 00:04
Good advice, Derek. Also, the objects need to be made of triangle lists. Objects such as spheres and cylinders are made of triangle strips. You can convert objects made with triangle strips to triangle lists by creating a mesh from the object, saving it as an x file and loading it back. After using such object as a brush you may need to convert the original object to triangle lists.
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 5th May 2016 10:02
Thanks for the tips examples guys.

Just wanted to clear out what the commands means:
PERFORM CSG UNION = combine 2 objects

But what does the other commands actually means?

PERFORM CSG DIFFERENCE
PERFORM CSG INTERSECTION
PERFORM CSG CLIP

WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 5th May 2016 13:46
Difference will cut the object where the brush intersects leaving the difference. Intersection will cut the difference leaving the intersection. I will have to experiment with clip.
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 6th May 2016 17:15
Tests would indicate Perform Csg Clip will remove any surface from the object the brush object completely contacts.
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 6th May 2016 17:30
Thanks a lot for trying those commands out.

Just wanted to be sure. Correct me if I'm wrong:
PERFORM CSG UNION = combine 2 objects
PERFORM CSG DIFFERENCE = cut the object in the middle at where the brush object is
PERFORM CSG INTERSECTION = cut the object, only leaving the part contained in the brush object. Deletes faces outside the brush object
PERFORM CSG CLIP = remove the faces in contact with the brush

Now I know how they do that objects 'slicing' effect in Metal Gear Rising Revengeance

WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 6th May 2016 22:40 Edited at: 6th May 2016 22:41
Except for Perform Csg Clip, that sounds about right. With Perform Csg Clip the brush object will only remove surfaces it is in complete contact with. This snippet will remove the surface on the right side of the cube. Remove the remark to scale the brush making it shorter and with less depth and the surface remains.

hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 18th May 2016 03:59
How do we 'fuse' 2 objects into 1 model?

To my understanding PERFORM CSG UNION will physically 'fuse' 2 object together.

But what if we want to have 2 objects, for example, a CD and its case, which is 2 separate objects, to be 'grouped' together, to form 1 new model/mesh? So that in the end we have 1 model containing both the CD and the case, without 'fusing' the 2 mesh?
Derek Darkly
12
Years of Service
User Offline
Joined: 22nd Sep 2011
Location: Whats Our Vector, Victor?
Posted: 18th May 2016 16:52 Edited at: 18th May 2016 16:52
Quote: "But what if we want to have 2 objects, for example, a CD and its case, which is 2 separate objects, to be 'grouped' together, to form 1 new model/mesh? So that in the end we have 1 model containing both the CD and the case, without 'fusing' the 2 mesh?"


One could be a limb, or both could be limbs to a PLAIN object sized 0... or you could use GLUE OBJECT TO LIMB
Send your parents to noisy sprite demo hell... enter the D-Zone
hakimfullmetal
9
Years of Service
User Offline
Joined: 17th Feb 2015
Location:
Posted: 19th May 2016 16:43 Edited at: 20th May 2016 03:52
I wanted to arrange some sets of buildings programmatically, then save those objects as 1 single object.
I used to do this by turning the rest of the objects into meshes, then make them into a main object limbs. And then save the object.
But if I'm not mistaken, turning an object into a mesh would mess with its UV mapping, which results in the object not being textured correctly anymore.
Or am I wrong?
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 19th May 2016 22:01
An object can contain multiple limbs (meshes) each with its own flexible vertex format. On such an object, Make Mesh From Object either injects the FVF or uses the lowest flexible vertex format. If the object only has one limb then the mesh should be copied as is. Storing UV data and UV date for each texture stage, if available.

Login to post a reply

Server time is: 2024-04-26 12:08:51
Your offset time is: 2024-04-26 12:08:51