Page 1 of 1

Sloped 3d floor planes

Posted: Thu Feb 02, 2012 18:37
by printz
I'm in the process of writing a program that converts Quake maps into GZDoom 3d floor structures. Among other things, the program will place all the control sectors on a grid at the side of the playable area. The program should accept sloped 3d floors, and therefore the corresponding control sectors will be triangles having vertex zfloor and zceiling values belonging to the 3d floor planes.

Here's what I'd like to be sure about: if a 3d floor is too steep, its planes' Z coordinates might mathematically go beyond the 16-bit limit by the time they reach the control sector's XY coordinates [the program won't place them optimally to be at the same elevation]. Do they actually wrap around in GZDoom? If they do, then it means that the zfloor and zceiling values of the controller sector can stay within the 16-bit limit too, and fit with the planes, which will wrap back around nicely until they meet with the 3d floor map sector(s), and render them where they're expected to be.

Re: Sloped 3d floor planes

Posted: Fri Feb 03, 2012 0:42
by Graf Zahl
Planes are represented by plane equations and one equation will represent precisely one plane. Although values wrap around at some time this won't result in the plane being duplicated. In some calculations it may appear to work but there will be unpredictable overflows in others if a plane's absolute z value is too large. What you want to do here won't work.

Especially the GL renderer will fail to handle this because it performs many slope calculations with floating point to prevent such overflows from happening. So even at best your wrapped around plane will not be rendered correctly.

Re: Sloped 3d floor planes

Posted: Fri Feb 03, 2012 10:06
by printz
Thanks for the detailed explanation. And I think I can easily make the program place the control sectors in a safe XY location after all. There will be a location around the playable area, with equal elevation with the rendered 3d floor.