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 / Minimalist spaceship 3D builder using CSG and no external media

Starshyne Emir
Years of Service
User Offline
Joined: 27th Nov 2016
Location: Porto Alegre, southern Brazil
Posted: 14th Feb 2018 14:45
This is my 3D minimalist spaceship modeller I built this morning in DBPro.

It is really simple, but it was designed for a very simple purpose: build low-poly spaceships that I am planning to use in a future game.


ENTER KEY - cycle between the pre-made 3D "brushes"
ARROW KEYS - move cursor along X and Y axis
SHIFT + UP/DOWN - moves along Z axis
SHIFT + LEFT/RIGHT - rolls the 3D part
CTRL+UP/DOWN - pitch the 3D part
CTRL+LEFT/RIGHT - turns the 3D part
CTRL+SHIFT+UP/DOWN - changes zoom
CTRL+SHIFT+LEFT/RIGHT - rotates the camera around the current cursor position
CTRL+ENTER - Adds the 3D part to the model via CSG union
CTRL+SHIFT+ENTER - carves into the 3D model via CSG difference

I didn't code the SAVE OBJECT part yet, but the goal here is to show the modeller, not a basic DBPro function in action.


1. Sometimes it crashes when adding some parts in certain ways (usually if it the part is too thin or somewhat alike).

2. Couldn't find a way to effectively mark the cursor position in 3D space to help the user to easily know where the brush is

3. HELP NEEDED: how to simplify the model to remove redundant vertexes and make it cleaner after editing

Dedicated to WickedX, Mage, Ortu, Rudolpho and all the folks of this lovely community, whose help was very motivating and empowered very much my programming skills. You rock, folks!
[size=+2]Forever and one[/size]
Starshyne Emir
Years of Service
User Offline
Joined: 27th Nov 2016
Location: Porto Alegre, southern Brazil
Posted: 14th Feb 2018 19:29
New version of my code, now almost something you can call a software.


SPACE KEY - resets cursor position and rotation
SHIFT+SPACE - save model

ISSUES: it count vertexes after every CSG operation, but strangely after some insertions the number simply skyrocket and eceeds the limit of 65535 and the program crash. Why? No idea.

The camera is still buggy, but I am working on a better one.

[size=+2]Forever and one[/size]
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 17th Feb 2018 02:53
I love it. This has so much potential. Not just to build space ships, but any kind of object.

To reduce vertices after each union you need to remove identical faces. You can do this by using the vertex data commands to find the identical faces and create an object from the memblock and mesh functions without these faces.
FPSC Developer
Years of Service
User Offline
Joined: 3rd Jul 2009
Location: pittsburgh, pa.
Posted: 17th Feb 2018 13:57
Sounds like a cool idea. can't wait to see this up and running.
gamer, lover, filmmaker
Starshyne Emir
Years of Service
User Offline
Joined: 27th Nov 2016
Location: Porto Alegre, southern Brazil
Posted: 21st Feb 2018 00:48
In face, it could be useable to build anything, not just spaceships. It was my first idea, so I added symmetry to make it easier to produce spaceships - that normally have symmetrical geometry - but yes, I know it has potential to do anything.
Sad CSG doesn't work with spheres, cylinders or cones, because with them I could produce better results.

I am thinking about using it to produce a set of "pieces" - like LEGO blocks - and add them to be useable by the program itself to further objects, since boxes are not very versatile for making complex structures.

The part of removing identical faces is beyond my actual skills. I am still scratching the surface of vertexdata stuff...

This is something that someone with a deeper knowledge could put into a plugin to make it easy - a snippet would be good, but a dll would be far better.

It would be great to just call a REMOVE REDUNDANT FACES(object number) and see it done without being bothered by the technical stuff.

Another dodgy part of it is that the UV data is impossible (for me, at least) to manipulate properly. The idea was that the final object could behave as a sphere (with the texture being seamlessly wrapped around it), but all I've got are boxes and pieces of boxes. And, since it is just a helping app to make objects for my simple games, I will probably never try to learn UV data manipulation to fix it in the way I want to.

Ah, you'll probably laugh on that: I found why did my vertex count was so high! Well, always when I performed a CSG union or difference, I didn't delete the objects and, since the keypresses were longer than the time required to perform the operation, it was performed various times in the same object, producing really high vertex counts and - due a bug in rotation - some bizarre results sometimes. I solved it just deleting the objects after the union and resetting the brush data to zero, telling the software that there was nothing to be merged with the object and this reduced vertex count dramatically.

This is the current version, a bit better than the previous one.

By the way, can anyone tell me why it is not compiling properly (no EXE created) but works fine in debug mode?

[size=+2]Forever and one[/size]

Login to post a reply

Server time is: 2023-06-08 13:12:28
Your offset time is: 2023-06-08 13:12:28