Simple explanation for mathematics behind slope things?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
ReX
Posts: 1584
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Simple explanation for mathematics behind slope things?

Post by ReX »

I have been working with slope things, particularly set_ceiling/floor_slopes, and it has been an ordeal of trial and error. In particular, I have been working in the context of 3D sectors in GZDooM, and have gotten down the simple slopes associated with pipes and tubes (i.e., cylindrical-horizontal constructs). However, it has not been intuitive, and when trying more complex objects such as "flared" shapes I have failed utterly. I thought that perhaps if the mathematics of this particular slope thing was presented to me I might be able to achieve my design without hours of trail and error.

I searched the forums, and came across this thread, which sheds no new light on this subject. Unfortunately, I cannot review the ZDooM source, and as a result I cannot see the math behind the logic. [I understand that it is trigonometry, but it's been a while since I was in college, and I have not had to work with trig or coordinate geometry since then. Still, I may be able to figure it out, given time - which is increasingly in short supply.] So here are my questions:
  • 1. Is there a simple verbal (non-mathematical) way to describe the relationship between the variables involved - width of sector, length of sector (relevant when slope is not just in one direction), angle of "ascent" of the slope, direction of slope, and height of the slope thing above or below the sector?
    2. If there is no simple verbal way to describe the relationship between the variables, is there a relatively simple mathematical way of describing it?
    3. In the absence of 1 & 2 above, is there an example wad that shows how the slope of a given sector changes with the adjustment of the different variables?
I recognize that slope things are powerful tools for the creation of complex shapes. However, they have limited utility to a user if they cannot be relatively easily understood, and require a great deal of trial and error.
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

I can't help you with the math on the 'set slope' things, but I may be able to help you with particular constructions. I suggest using the slope lines primarily. To achieve secondary effects, the 'slope-to-here' things and 'copy plane' things are much easier than the 'set slope angle' things. Set up dummy sectors if you need them and copy planes across into the map. I think you can still find a good demo of those items in the map attached to that thread you linked.
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

I can't help with the math either, but I can basically go over the how the set slope things operate. I would probably take some of Risen's advice, though, as I'm not much as far as efficient/pretty map construction goes and he probably knows better.

Anyway, there are three things important to how the set slope things work: the thing facing angle, the slope angle argument, and the thing's position within the sector (including Z height.)

1) The thing's facing angle determines the direction of the slope. If the set slope thing is facing to the east and the angle is set to 45 degrees upwards, than the slopes rises from west to east (lowest point on the west end, highest point on the east end).

2) The slope angle argument determines the steepness of the slope. A value of 90 is considered horizontal (no slope), and values above 90 slope upwards in the given direction while values below 90 slope downwards in the given direction. So, 135 is 45 degrees upwards, and 45 is 45 degrees downward. Note that taken with the thing's facing angle, there's more than one way to generate the same slope. For example, facing east + 135 (45 degrees upwards) is the same thing as facing west + 45 (45 degrees downwards).

3) The thing's position in 3D space is the final important piece. The slope of the sector will be adjusted so that it passes through the set slope thing itself. This means where you position the thing within the sector itself does matter, as well as the thing's Z height. As an example, let's take a room at floor height 0 with a small 32 x 32 square sector in the center, also at floor height 0. Now, let's say you want to make the sector's floor slope from 0 on its north edge to 32 on its south edge (so, set slope thing facing south, value of 135.) You start by placing the set floor slope thing in the dead center of the 32 x 32 sector, face the thing south, and give it a value of 135. If you were to test the map at this point, you would find the effect isn't complete yet, however. Instead of a slope from 0 to 32 going north to south, you would find your sector sloped from -16 to +16 going north to south. This is because the slope must pass through the slope thing's position in space. The slope thing, being a set floor slope thing, is located on the floor of the sector (with height 0). Hence, the result goes from -16 to +16 to pass through the slope thing (located at 0 in the middle). Given this, there's more than one way to fix it to achieve the desired effect of sloping from 0 to 32.
  • Set the thing's Z height to 16, which will raise the slope (since it must pass through the thing itself).
  • Raise the sector height to 16, which has the net effect of raising the thing itself to a Z height of 16, being place on the floor of the sector it is in (note that the set sector ceiling slope behaves like a "hanging from ceiling" object and is attached to the ceiling by default.)
  • Set the thing's Z height to 8, and then move it north from the center of the sector by 8 (placing it 1/4 of the way down from the top, instead of in the middle at 1/2). Again, the slope will pass through the thing itself, so moving its position in the X/Y plane does have an effect.
  • Numerous other possibilities (Z height: 24, 3/4 of the way down from the top), etc.
User avatar
ReX
Posts: 1584
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Post by ReX »

Thank you both for your help.

Risen: I looked carefully at the example wad you mentioned (i.e., the one in the thread I had referenced). Unfortunately, because of the absence of many of the textures and flats it was not easy to identify the true nature of the various slopes. Morover, I could not find a contruct similar to mine (even taking the 3D aspect out of the equation). Imagine a cone turned over onto its side so that the vertical axis is now horizontal. The walls of the cone are now sloped along all 3 axes. My construct is a little simpler - the cone, instead of having a circular base, has an octagonal base. Now if you were to cut off and discard the top you'd be left with the base with a flat-topped surface (this undiscarded piece is known as the frustum). Now turn this over onto its side, again so that the vertical axis is now horizontal. What you have are 8 planes, not counting the base and the top (which are not sloped). The two "side" planes are not sloped vertically, but are angled from the "top" to the base. The upper and lower planes are sloped vertically, the upper rising towards the base, the lower dropping towards the base. The four other planes are sloped along all 3 axes. I am having problems with sloping these 4 planes. I have attached a picture that shows what I'm going for.

Zippy: Your verbal explanation was very good, particularly the aspect relating to the slope thing's position. I had figured out most of what you explained, but there were a couple of points that I need to pay special attention to. I will try building my construct again.
Attachments
ionizatn.jpg
ionizatn.jpg (13.55 KiB) Viewed 865 times
User avatar
Tormentor667
Posts: 13554
Joined: Wed Jul 16, 2003 3:52 am
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia (Modern GZDoom)
Location: Germany
Contact:

Post by Tormentor667 »

*looks at the image*
...I feel - if you are working with GZDoom - using models for something like this might make more sense.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Also that's damn sexy.

It had to be said.
mikenet2007
Posts: 340
Joined: Wed Jan 24, 2007 8:54 pm

Post by mikenet2007 »

From what I understand a shape like that cannot be made in zdoom alone. Ive been mapping for duke3d for years and it really cant be made there either. I dont use gzdoom but im assuming the 3d shapes are typically made and imported from external utilities like 3dstudio max. They look much like static meshes to me.

If that image was made in gzdoom then there is obviously something that allows for sector over sector shapes to be made using slopes, I guess then the problem becomes having the proper tools to make them effeciently and these are the types of tools early fps editors lack. even UnrealEd 2.0 for Unreal Tournament has limits to what types of shapes can be made with the tools presented. Ironically the Unreal game engine can calculate and view much more complex shapes than its editor can make.

So in a situation like this, the best thing to do is use a 3d modeling program like 3ds Max or Maya where you have all these advanced editing tools

All this assuming models or static meshes can be imported into Gzdoom but I don't use it so I wouldn't know. What I do know is that the more complex the shape becomes the harder it will be to make it without help from another program. I tried making a complex cave level for UT2004 a few years back and thats when I learned of how limited urealEd 2.0, and 3.0 were at making shapes, and any limits in these programs no doubt exsist in any kind of classic doom editing. Thats when I learned about 3dsMax and static meshes.

You can go here to find out more, this is about the largest video game/ 3dmodeling community I know of, although most of the video game forums are for modern fps shooters :(

http://www.3dbuzz.com/vbforum/sv_home.php
skadoomer
Posts: 1026
Joined: Fri Sep 05, 2003 12:49 pm

Post by skadoomer »

I think torm has it right here. Models would work better in this case because in the end, the nature of what it is you are trying to accomplish seems to almost be the limit of 3d architecture in gzdoom. While i don't want to discourage you from attempting to push the envelope here, know that models are the perfect fall back to this shape.
User avatar
Zippy
Posts: 3302
Joined: Wed Mar 23, 2005 5:31 pm
Location: New Jersey

Post by Zippy »

The image is just a construct from one of the introductory levels of Half-Life.

I somewhat agree with the others... this is the kind of thing that would be made into a model nowadays, particularly if the player isn't required to be climbing all over it.
mikenet2007
Posts: 340
Joined: Wed Jan 24, 2007 8:54 pm

Post by mikenet2007 »

The image is just a construct from one of the introductory levels of Half-Life.
I knew that looked familiar, that was in the first level at the Black Mesa Research facility, I think. good luck trying to make that but I would really consider importing a model rather than using a slopes.
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Post by Risen »

Rex, the construct for this type of shape is pretty ridiculous, but it can be done. (See attached proof-of-concept.) I did not use the 'set slope' things at all, because as I mentioned, the other methods are easier and more precise. Note, though, that it does not matter what method you use to set the slopes; the construct will still be just as large and elaborate if you want to generate this effect. You also have very limited control on texturing.

If you plan on doing only a few of these and want the player to be able to run around on them, maybe this is the way to go. If you want many of them for decorations, such as the example you posted, then a model will save you much effort.

Heh, this is actually the first time I've used a GZDoom 3D floor.

One look at this map should give you an idea of just how ridiculous it would need to get in order to replicate the object in your screenshot... but I do believe it would be possible.
Attachments
horzcone.wad
Proof of concept.
GZDoom only, MAP01
(8.26 KiB) Downloaded 50 times
User avatar
solarsnowfall
Posts: 1581
Joined: Thu Jun 30, 2005 1:44 am

Post by solarsnowfall »

I made a test map shortly after GZDoom released featuring bobbing spheres (to test the limits of 3d floors in GZDoom) that was similar to this. It truely was a pain to get everyting alligned right. This is definately the sort of thing that a model would work best for, but what's needed now is advice from people who have successfully added models to GZDoom before. We can tell him "use models" all we want, but that doesn't really do him any good unless somebody can say how...

Any road, I'm impressed by your first 3d floor use Risen. :)
User avatar
Nash
 
 
Posts: 17484
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Post by Nash »

If you search the GZDoom forum for my posts, you'll see that I have posted things like MODELDEF documentation and even various example files (like the smiley cacodemon and the player model example) which should be more than enough to get you started.
User avatar
ReX
Posts: 1584
Joined: Tue Aug 05, 2003 10:01 am
Location: Quatto's Palace
Contact:

Post by ReX »

Risen: That is indeed an elaborate build. And yes, I too am impressed that you put this together during your first attempt at GZDooM 3D floors.

Nash: I will check out your documentation on models in the GZDooM forums. Until now I have resisted using models, mainly because the scope of my project is already very large (and growing), and learning something new will simply slow things down even more.

Meanwhile, last night I mentally formulated an alternative to the exact shape shown in the picture. Instead of the 4 planes that are sloped in all 3 axes, I will use fins (sort of like heat sink fins on equipment). It will make the shape much more interesting and will be simpler to do. It will not look exactly like the original, but I don't think that is necessarily a bad thing.

Thanks to everyone for the suggestions, ideas, and examples.
User avatar
Phobus
Posts: 5984
Joined: Thu May 05, 2005 10:56 am
Location: London
Contact:

Post by Phobus »

With a bit of imagination, and rather a lot of patience, it is easy to create a shape like the one shown in that screenshot. Even I've done that, and i'm not a GZDoom mapper (although mine was MUCH bigger)
Locked

Return to “Editing (Archive)”