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.

Author
Message
shadey
16
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 16th Jun 2013 16:04
How does one hollow out a cube within native dark basic pro code, if it is possible that is!

Hail to the king, baby!

http://davidjohnwheeler.blogspot.co.uk
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Jun 2013 16:40
Why do you need a hollow cube? I ask because it is more likely that you can fake it.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 16th Jun 2013 22:03
I think it's possible with the CSG commands - there used to be a demo somewhere (but I found the commands awkward to use ).

Just checked: there's a demo in the Game FX section of the Help File. You might need to comment out this line to get it to work (there's an annoying bug in the current DBPro):



You can find the demo in various places - I found it in PERFORM CSG DIFFERENCE.

One of the things created is a hollowed out cube.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 17th Jun 2013 14:19 Edited at: 17th Jun 2013 14:21
Quote: "I think it's possible with the CSG commands"


Yes, this is the best way...take a look






I'm not a grumpy grandpa
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 17th Jun 2013 17:59 Edited at: 17th Jun 2013 18:00
I believe repeated CSGing on the same object will cause bloated objects, which will eventually slow the program down. (At least it did when I was testing it a few years back)

This is my current project, check it out! [href]forum.thegamecreators.com/?m=forum_view&t=204576&b=8[/href]
This is my website, check it out! [href]http:\\www.TeamDefiant.co.uk[/href]
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 17th Jun 2013 18:38
Yep, It needs to be used tidily, but these are seriously useful commands. FPSC uses them to create its door entries and windows. The more you perform, the more polygons are created the more complex the calculation becomes.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jun 2013 13:03
Quote: "Yep, It needs to be used tidily, but these are seriously useful commands."


I agree. When they work they can save a lot of time.

However I've always found the results rather unpredictable for the simple reason that there is no clear statement anywhere of exactly how they work or what they are supposed to do. Sometimes I get the same results using CSG DIFFERENCE, CSG INTERSECTION and CSG UNION with only minor changes to the object and/or brushes and/or order of doing things. Sometimes culling neds to be turned off sometimes not and so on. Also, looking at Chafari's example, what's the purpose of the initial plain object?

After checking through a few threads on the topic I noticed that in some cases people were saving a mesh and then reloading it as an object before using the CSG commands. When I tried to do the same thing without the intermediate save/load step the CSG commands failed. What's going on? Any ideas anyone?

Can someone point me to a comprehensive tutorial on the topic? Please.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 18th Jun 2013 14:58 Edited at: 18th Jun 2013 15:34
Quote: "I believe repeated CSGing on the same object will cause bloated objects"


That's half true.Perhaps the process to generate the final object take some time, but once created, will be load in the same way that any object, and all depends on the number of polygons that we want to create to our object.

Quote: " Also, looking at Chafari's example, what's the purpose of the initial plain object?"



It is really this object which generate the final object .After many many tests,I realized by chance trying to make a window to a plain object ,instead of creating a window in the plane the object was wrapped by the plain object like the skin of an ampty orange.I also realized that if the objects are touching each other the CSG was perfect and not overburden the object with too many polygons.

In this piece of code, there are so many polys before than after making CSG. Take a look and press spacekey to see the final object in wireframe...go inside the object and see that the union is perfect.




Quote: "Can someone point me to a comprehensive tutorial on the topic? Please. "


http://forum.thegamecreators.com/?m=forum_view&t=191335&b=1


I'm just trying to help...perhaps I look really like a grumpy grandpa

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Jun 2013 17:02
Thanks for that tutorial. I'll have a play around with it later.

I've just quickly read through it and it still doesn't explain what the various CSG commands actually do though. Also, you refer to the need for a plain object to finish the level. I'm not sure what you mean by that. I guess it'll come clear when I try the code.

Nevertheless it certainly looks like a neat way to build interesting objects from cubes, boxes and plains. Is there a way to get things like spheres working?
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 18th Jun 2013 18:01
Quote: "CSG DIFFERENCE"

This will cause the parts of the two objects which intersect to become the new object. For example, differencing a cube with a sphere in the middle of one face will result in a half sphere.
Quote: "CSG INTERSECTION"

This will cause the intersection of one object to be hollowed out of another object.
Quote: "CSG UNION"

This will cause the two objects to become one object, with all overlapping geometry removed.

I hope this is what you wanted.. lol


Quote: "That's half true.Perhaps the process to generate the final object take some time, but once created, will be load in the same way that any object, and all depends on the number of polygons that we want to create to our object."

I meant that if you have one object, for example the skeleton for a sky scraper. (Which is what I used) If I remove a sphere from the skyscraper, (As in an explosion) the resulting object is fine. If I remove another sphere from the skyscraper, it takes twice as long to perform, and the resulting frame-rate drops. If I intersect it again, longer to intersect and even lower resulting frame-rate,

It seems like it's good for an FPSC style program, where you're unlikely to intersect the same object (Or FPSC segment) multiple times, but poor for using it a a real-time building destruction system. (Which is what I originally wanted, after playing Earth Defence Force 2025)

This is my current project, check it out! [href]forum.thegamecreators.com/?m=forum_view&t=204576&b=8[/href]
This is my website, check it out! [href]http:\\www.TeamDefiant.co.uk[/href]
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 18th Jun 2013 20:16
Quote: "Is there a way to get things like spheres working? "


Yes...but with not so good results as we expect


Quote: "It seems like it's good for an FPSC style program"


Exactly...that is what I meant, and we could do our scenary with it. As I commented, spheres are not to good for SCG too many polys, and we have to convert first the sphere to mesh to get it works :-(

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jun 2013 01:21
Quote: "and we have to convert first the sphere to mesh to get it works "


It would be useful to know why.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 20th Jun 2013 01:34
Quote: "It would be useful to know why. "


No one know !!, I made lots of test with the native sphere of DBpro and not good results but if we load an sphere made with some other 3D programs works like a charme..

I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 20th Jun 2013 13:50
That's good to know. Lee posted some time back that objects need to be constructed as a tri-list for the CSG commands to work correctly. That may be the key point here too. It should be straightforward to write a function to create spheres using a tri-list. The downside is that the sphere won't be welded so that lots of vertices will be duplicated (that assumes I've understood correctly what a tri-list is).
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 20th Jun 2013 15:43 Edited at: 20th Jun 2013 16:09
Quote: " It should be straightforward to write a function to create spheres using a tri-list."


Yeah.. I've tried but my problem is how to apply correctly the texture to the final object.

An example using my lathe tool




I'm not a grumpy grandpa
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 20th Jun 2013 16:31 Edited at: 20th Jun 2013 16:31

This effect occurs on standard dbpro spheres too. In fact, all spheres I believe have difficulty in applying textures at the polar regions.

Now geospheres, they're a sphere and a half!


No polar distortions, but more complex to texture.

This is my current project, check it out! [href]forum.thegamecreators.com/?m=forum_view&t=204576&b=8[/href]
This is my website, check it out! [href]http:\\www.TeamDefiant.co.uk[/href]
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 20th Jun 2013 16:58
Somebody should just make a sphere texture generator. I would buy it for £5, and it would sell a lot.

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 20th Jun 2013 20:22
Quote: "Now geospheres, they're a sphere and a half"


Probably you are right , Mobiius !! but I really don't know how to start...looks like an object made with hexagons and pentagons but principally by equilateral triangles..someone gonna try??



Quote: "I would buy it for £5, and it would sell a lot."



I'm not a grumpy grandpa
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 20th Jun 2013 21:18
Quote: "That may be the key point here too. "

yes, dbpro sphere is made of triangle strips. Cylinder too.

But, there's a function that converts triangle strip to triangle list somewhere in dbpro source code because Lee uses it to detect if sphere is "picked" by a mouse. But, he doesn't use that function in csg part of the code. If he did, csg commands would work for spheres too. Someone should send him an email about that

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 20th Jun 2013 22:24
I've actually not seen anywhere in video game engines where it is recommended to perform CSG operations on spheres. I can see it being used in 3D modelling programs here and there, but what is the point of having the engine carve a sphere and not the modelling program? (Who knows maybe this is why Lee didn't bother correcting this)

I always see it being used to carve door or window openings, splitting up walls and floors into sections, making a whole through a wall.

Even performing such commands on spheres in Blender is CPU intensive.

Please bring me up to speed on this.

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 20th Jun 2013 23:35
Quote: "I always see it being used to carve door or window openings, splitting up walls and floors into sections, making a whole through a wall. "


You'r right ! Chris Tate, this is what I use for, but about spheres , it is just answering the GG question about working spheres for this purpose. It is somehow like a challenge of doing things with no other program but Dbpro.

I'm not a grumpy grandpa
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 21st Jun 2013 01:04
I see.

Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 21st Jun 2013 02:00
Quote: "Somebody should just make a sphere texture generator. I would buy it for £5, and it would sell a lot."


Food for thought.
chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 21st Jun 2013 02:30
Quote: "Food for thought"


Here we go !!!

I'm not a grumpy grandpa

Login to post a reply

Server time is: 2026-07-06 16:49:14
Your offset time is: 2026-07-06 16:49:14