Page 1 of 3

A script to build custom shaped 3d floors

Posted: Sat Jan 15, 2022 7:46 am
by Sir Robin
I've been dinking around with 3d floors - is there any good tool for building those? I've been drawing them out on paper and then putting them in by hand. I wanted to write a script to help me do that faster and easier, so this is what I came up with.

Basically you start a new map, draw sector(s) in the shape that you want your 3d floor(s) to look like from the "front". Then run the script and it takes that XY drawing and flips it up to XZ and extrudes it into the Y axis and saves it as a 3d floor. You can then copy and paste that into your working map.

So for example you could draw a ring and have it extruded into a pipe:
Spoiler:
Or draw the DOOM logo:
Spoiler:
It applies the same textures that you drew the original sector with, and also uses the light level to set the opacity of the 3d floor, but I've notice that only seems to work on flat floors with no slopes, so I don't know how useful that is. Also that software mode can only see flat floors, but collision detection does still work even if you can't see them.

Anyway, is that useful for anyone? It's just a stand-alone script, I wrote it in PowerShell. But maybe if there's some interest in it I could slap an interface on it or put it as a plug-in for UDB or something?

EDIT: My script is posted here.
Here is the latest download link: 3dFloors_Extrude.zip
Important file in the package:
3dFloors_Extrude.ps1 - The main script file
3dFloors_Extrude.cfg - The configuration settings file
3dFloors_Extrude.txt - The readme file. Have a look at this if this is your first time using this script.

Last updated 2022/01/18
The script now handles 2-sided lines properly, and I fixed the texturing. I fixed and tweaked a bunch of small things, and added better error handling.
The control sectors are marked not to show on the textured automap and the lines are set not to show on the regular automap. Thanks Enjay for the suggestion.
The lightlevel property no longer controls floor translucency, I moved than functionality over to the flooralpha property.

Re: A script to build custom shaped 3d floors

Posted: Sat Jan 15, 2022 9:10 am
by Logan MTM
Holly Hell! :shock:

Re: A script to build custom shaped 3d floors

Posted: Sat Jan 15, 2022 9:38 am
by Enjay
Sir Robin wrote:Anyway, is that useful for anyone?
Is the pope a bear? Do Catholics poop in the woods? ;)

Seriously, that looks like an amazingly useful script and having it as a UDB plugin would be very welcome.

Re: A script to build custom shaped 3d floors

Posted: Sat Jan 15, 2022 11:44 am
by Nash
Hi, is it possible to have this be a UDBScript?

In case you are unfamiliar with UDBScript: https://biwa.github.io/udbscript-docs/

That said, UDBScript or not; what you made appears to be VERY useful. I'd certainly love to use it. :)

Re: A script to build custom shaped 3d floors

Posted: Sat Jan 15, 2022 12:31 pm
by SeventhSentinel
Now that SRB2 has rudimentary UDMF support, our development team would find that extremely useful as a UDB plugin.

Re: A script to build custom shaped 3d floors

Posted: Sat Jan 15, 2022 3:19 pm
by Sir Robin
@Logan MTM - now that's a reaction I like to get! :D

@Enjay - what's that? The pope shit on a bear in the woods? :lol:

@Nash - Thanks for the link. Looks like JavaScript. I'll see what it takes to port it over.

@SeventhSentinel - these floors need UDMF line type 160, sector moreids, floorplane_*, and ceilingplane_*, so if you're implementing all that then it should work for you.

So this script is working all well and good, but I'm thinking of what can be even better. I'm thinking I can break the input object into layers, and toggle those layers on and off along the extrusion path, to create more complex shapes.
Then you could cut a hole in the top of that pipe to jump down into:
Spoiler:
Put a fitting around that hole:
Spoiler:
(Yes I know that fitting is clunky looking, I just threw in it real quick as a proof-of-concept)
Cut a hole in the side of the pipe to jump out of:
Spoiler:
And I know I said sloped 3d floors can't be translucent, but if I split it to layers, can you make a layer without slopes and make that translucent and then merge it back in:
Spoiler:
None of this is in the script yet, it's just done by hand as a proof-of-concept. I'm pretty sure I can make it work though.

I'll polish it up and bit and then throw it into github and post a link here - Anyone who wants to try it out in native PowerShell can give it a go.

Re: A script to build custom shaped 3d floors

Posted: Sat Jan 15, 2022 4:17 pm
by boris
Sir Robin wrote:@Nash - Thanks for the link. Looks like JavaScript. I'll see what it takes to port it over.
That's because it is JS ;)

Re: A script to build custom shaped 3d floors

Posted: Sat Jan 15, 2022 5:02 pm
by Sir Robin
Here is some maps to play with

Re: A script to build custom shaped 3d floors

Posted: Sat Jan 15, 2022 9:14 pm
by Enjay
These are very cool indeed.

Re: A script to build custom shaped 3d floors

Posted: Sun Jan 16, 2022 1:59 am
by ramon.dexter
Brav brave sir robin!

..he created 3d floor script...
Brave sir robin
He showed us how to use it...
Brave sir robin...

Great work indeed!

Re: A script to build custom shaped 3d floors

Posted: Sun Jan 16, 2022 2:44 am
by Nash
Excellent work.

Not trying to be pushy or insistent, but I believe this is a perfect use-case for UDBScript, since this is considered an editing aid, and UDBScript was designed to allow this kind of power for users. :)

But of course, using it as an external tool is also fine. Thanks for doing this for the community. :)

Re: A script to build custom shaped 3d floors

Posted: Sun Jan 16, 2022 8:44 am
by Sir Robin
Nash wrote:Excellent work.

Not trying to be pushy or insistent, but I believe this is a perfect use-case for UDBScript, since this is considered an editing aid, and UDBScript was designed to allow this kind of power for users. :)

But of course, using it as an external tool is also fine. Thanks for doing this for the community. :)
I hear ya, and I agree, absolutely. But that is going to require me to learn javascript, learn the interface to UDB, and convert or rewrite my code. So "Get this thing into a UDB plug-in" is a "nice to have" goal, while my immediate goal is "get this thing into the hands of the community ASAP". The path to that goal is to polish up the PowerShell script, document it, and get it uploaded. I'm planning to get that done today.

Re: A script to build custom shaped 3d floors

Posted: Sun Jan 16, 2022 9:48 am
by Nash
Of course, you're right. :) Looking forward to test it!

Re: A script to build custom shaped 3d floors

Posted: Mon Jan 17, 2022 7:19 am
by Sir Robin
OK! Here it goes. Not perfect, but posting it up as is to see what you folks can come up with.

3dFloors_Extrude.zip

Re: A script to build custom shaped 3d floors

Posted: Mon Jan 17, 2022 8:38 am
by Sir Robin
gah, pretty obvious bug, I can't believe I didn't test for this. It seem if you have more than 2 heights, it breaks the texturing. So for example the ring has 2 heights, the bottom part and the top part. But for example a figure 8 would have 3 heights, and that seems to be what is breaking the texturing part of the script. The rest of it works, it creates the floors properly, just doesn't texture them.

You can still do that by hand for now - just select all the dummy sectors and make sure they have a floor and ceiling texture set.