Func_Msgboard: Mapping Help - Doom 3 Engine Edition

News | Forum | People | FAQ | Links | Register | Log in

|  | Mapping Help - Doom 3 Engine Edition

Posted by Kinn [86.128.238.47] on 2006/09/16 02:19:37
I thought it would be useful to have a mapping help thread dedicated to Doom 3 engine games only, as the regular thread seems to fill up very fast with Quake related posts. So, apply here for Doom 3, Quake 4, Prey and ETQW related queries :}

I'll Start
#1 posted by Kinn [86.128.238.47] on 2006/09/16 02:36:51
Glass sorting issues
I've been trying to create a glass material, or arrangement of different materials that will allow me to view multiple glass surfaces through each other with correct sorting.
I initially tried making several one-sided glass materials, all with vfp enabled but with different sort values in the hope that I could create a "window pane" by butting up two surfaces back-to-back, each with different sort values. In the case of a two-window setup, this window pane was duplicated, flipped and placed some distance away. The idea was that I would be able to view one window correctly through the other because the far window would always be showing a surface with a further sort value than the one facing me on the near window, regardless of which side of the window pane setup I was on.
Now this didn't work and with the help of Black Dog, I found that the problem was due to the vfp enabled surfaces stopping any other vfp surfaces behind them being drawn.
I can create an arrangement that does work, by having one of the materials vfp enabled and the other not. Now the funky thing is that the window surfaces always seem to sort correctly regardless of what sort values I set in my one-sided glass material as long as i can guarantee I can never be in a location where I'm looking through more than one vfp-enabled glass surface.
Why does this happen, does the additive alphablend of the glass surface make the arrangement always look the same regardless of whether the furthest surface is actually being drawn first?
Good Idea On The Thread
#2 posted by inertia [134.53.176.37] on 2006/09/16 18:59:10
And I think the answer, Kinn, is that Doom3 is achieving sentience!
Wow
#3 posted by scar3crow [151.141.78.76] on 2006/09/18 15:26:58
I read this, and I think "I thought mapping help was questions like 'how do I spawn in a monster when a door opens?'..." I obviously live in a simpler age =)
Heh
#4 posted by Kinn [86.128.40.143] on 2006/09/18 16:18:47
Well, game tech isn't growing any simpler that's for sure.
I had a brief spelunking expedition into some of the id maps to try to find areas where they might run into this problem. All the instances of seeing "glass-through-glass" I could find suffered from this problem, where the vfp glass in front would render the one behind invisible. However, you won't really notice this in game because the colour of the glass is set so dark that it becomes almost completely transparent, so a non-drawn glass surface becomes largely indistinguishable from an almost-transparent one, when viewed behind another glass surface.
This is fine when you want almost transparent glass, but what if (as in my case) you want a bit of texture to it? I guess I'll have to either be content with using the non-vfp versions, or I'll have to make use of the messy hack described in my earlier post. :/
Depth Testing
#5 posted by Lunaran [67.129.250.254] on 2006/09/19 12:11:01
I asked Rickmus. Here's the deal.
The scene is rendered without glass. This is stuffed in a buffer so it can be rendered as a texture later.
Special-sort transparency cases like glass then get rendered in reverse order so it overlaps properly, depth-buffer tested so it doesn't overlap what it's not supposed to, but the scene has already been captured. It's too expensive to recapture it after every transparent or VFP surface is rendered. So, through a pane of VFP glass you won't see another pane because that pane wasn't rendered yet when the scene was captured to the buffer used for distortion VFP's.
I feel all smart now, I should talk to RJ more often.
Lunaran
#6 posted by Kinn [195.92.144.188] on 2006/09/20 05:27:03
Awesome, thanks for asking - very useful info :)
#7 posted by Kinn [86.128.40.65] on 2006/11/16 12:39:11
I noticed I have "frame" "1" set on the worldspawn entity in my map, and I have no idea why.
Looking back through all the archived versions of my map, I see that this has been set for well over a year, right back to the oldest version I have saved.
Any idea why this might be there and what it does?
It's Supposed To Go On Animated Entities
#8 posted by Lunaran [67.129.250.254] on 2006/11/16 12:47:54
when you've got an imp or something spawned with an "anim" key because you want him to be in a certain anim right away, you can also have a "frame" key so it starts at a certain point in the anim.
you probably had a brush selected and clicked the little anim slider in the entity panel by mistake, so it automatically dropped that key onto worldspawn. it's harmless.
an 'origin' key on worldspawn, however, is not. avoid that at all costs, because it makes your map leak magically through nothing.
Don't Change It!
#9 posted by necros [74.111.254.57] on 2006/11/16 12:54:12
it will bring bad luck! ^_^;
Ah Yes
#10 posted by Kinn [86.141.142.8] on 2006/11/17 04:03:10
thanks Lunaran, I can see now how easy it would be to do that. I guess I can safely delete it
necros: on the other hand, it could be the source of the curse that's causing my map to take so long... ~_^
Curse??
#11 posted by necros [74.111.254.57] on 2006/11/18 00:12:41
you need... decursive!
http://www.curse-gaming.com/en/wow...
I Cast Thread Necromancy, Like The Daemons Of The Elder World.
#12 posted by Kinn [81.159.127.69] on 2008/04/05 16:48:08
Some quickies:
Doom 3
======
1) I've been making a lot of new materials lately. In the editor, I can quickly view changes to my existing images or materials with the commands "reloadimages" and "reloaddecls", but is there a way to load a brand new materal without having to exit and restart the editor?
2) Renderbumpflat. Lovely little command, but is there a way of using this without it exiting doom every single time? It's so annoying to have to restart doom to render out every single bloody normal map, especially when I'm constantly making changes.
Fun With Angles
#13 posted by Kinn [86.156.167.165] on 2008/06/10 23:21:56
Ugh. Anyone found this? To summarise - as part of a funky machine, i'm simply rotating a brush clockwise in the x-axis for a random amount of time. Then when it stops, I want to align it to one of 3 possible valves (corresponding to angular positions of (0,0,0), (90,0,0) and (270,0,0), depending on where it stopped, so that it rotates the least amount to reach a valve.
Should be simple. But I found that Doom stores angles in a funky way - e.g. when the rod *should* be at (180,0,0), its angles are actually stored as (0,180,180). In essence, the x-value of its angles field only ever has a range of 180 degrees (using anglemod360, that means the range is 0 <= x < 90, 270 <= x < 360), but the y and z will flip to 180 to compensate.
i've provided the relevant part of my script below in case anyone can spot if i'm doing anything particularly wrong. You'll have to excuse the formatting getting mullered...
void spinrod_spin(entity spinrod)
{
float rtime;
vector ang;
while(1)
{
rtime = 1 + sys.random(4);
spinrod.time(rtime);
spinrod.accelTime(0.5);
spinrod.decelTime(0.5);
spinrod.rotate('600 0 0');
sys.waitFor(spinrod);
sys.wait(0.5);
ang = anglemod360(spinrod.getAngles());
//sys.print(ang_x + "\n");
//sys.print(ang_y + "\n");
//sys.print(ang_z + "\n");
//sys.print("end\n");
//ok, the way angles are stored is a bit bollocksed up. in this case, a simple clockwise rotation in x does not result in what you'd expect...
//imagine dividing the rotation circle into 4 quadrants...
//from x = 0 to 90 (1st quadrant), everything is fine, but continuing clockwise past the 90 mark (into the 2nd quadrant), x decreases again to 0, whilst y and z are flipped to become 180..
//continuing clockwise into the 3rd quadrant, x becomes 360 and decreases towards 270. meanwhile y and z are still 180...
//continuing clockwise into the 4th quadrant, x now increases from 270 to 360, whilst y and z revert back to being 0.
//note that anglemod360 isn't mucking this up, because even without anglemod, the y and z 180-flip buggery still occurs.
//rotate the spinrod to the nearest valve, so as to avoid the minimum amount of rotation. FIXME - this is all bollocks because half the time it goes the bloody long way around (i.e. it spins in the opposite direction)
spinrod.time(1);
spinrod.accelTime(0.5);
spinrod.decelTime(0.5);
if (ang_x <= 90) //it's actually anywhere from 0 to 180
{
if (int(ang_y) == 0) //it's from 0 to 90
{
spinrod.rotateTo('90 0 0');
}
else //it's from 90 to 180, i.e. y and z are flipped to 180
{
//we don't have a valve in the 180 position; only at 0, 90 and 270
spinrod.rotateTo('90 0 0'); //uhh, just send it to 90 for the time being
}
}
else //it's actually anywhere from 180 to 360
{
if (int(ang_y) == 0) //it's from 270 to 360
{
spinrod.rotateTo('0 0 0');
}
else //it's from 180 to 270, i.e. y and z are flipped to 180
{
spinrod.rotateTo('270 0 0');
}
}
sys.waitFor(spinrod);
sys.wait(0.5);
}
}
I Had A Thought About This While Pooing.
#14 posted by czg [83.253.254.12] on 2008/06/11 00:35:08
Didn't come up with anything clever though, except maybe you could try using
rotateDownTo and/or rotateUpTo instead of rotateTo.
Angles
#15 posted by necros [99.227.108.217] on 2008/06/11 01:00:24
i never really understood the problem, but i had major problems with angles too for something i was working on. i ended up making an invisible entity that flew around whilst maintaining a constant distance from the main object and then using a lookat function instead of rotation.
you may want to look into alternative methods of accomplishing your goal instead of relying on the (apparently?) buggy rotation stuff.
Quirkiness
#16 posted by Kinn [86.156.167.165] on 2008/06/11 01:49:51
czg: I never tried rotateUpTo and rotateDownTo to be honest. I'd have to take into account the craziness of the way the x-value of the angle alternately increases and decreases even as it moves constantly clockwise round the circle (remember, y and z keep flipping between 0 and 180 - even if i'm simply rotating in x) Depending on where it starts, rotateUpTo for example could send it either clockwise or anticlockwise. The results would be predictable however, so if I wanted my rod to always rotate clockwise to the next nearest valve, then i'd just have to figure out whether x is increasing or decreasing at the point where I start the rotation.
The problem has gone beyond what actually matters for the movement of my rod in this example to be honest - all my rod needs to do is adjust itself to one of three fixed orientations after it does the random spin - which it already does, because rotateTo will guarantee that it gets there, even if it sometimes goes the long way round. (which doesn't matter).
I just got a little carried away with trying to figure out the quirkiness of how angle values are stored, because I know this behaviour will bite me in the arse in the future whenever I do rotation stuff.
necros - heh, that sounds like a funky workaround.
Kinn
#17 posted by bambuz [91.152.87.250] on 2008/06/11 02:44:57
Might have to do with this, or then might not....
http://en.wikipedia.org/wiki/Gimba...
Bambuz
#18 posted by Kinn [86.156.167.165] on 2008/06/11 21:17:45
funky - that Gimbal thing is interesting. In fact I was talking about this to a programmer at work and the first thing he said was "Gimbal lock" - but that might just have been his default comedy response to any poorly-explained problem with angles that a designer pesters him with.
I guess when getAngles() is called, it doesn't care about the history of how the entity has been rotating - it just calls the angles as it sees 'em.
Because a 180 degree rotation in x (and nothing else) results in the exact same end result as if you rotated 180 in y and then 180 in z (and nothing in x) - then Doom seems quite happy to return (0,180,180), instead of (180,0,0).
Yeah
#19 posted by bambuz [91.152.87.250] on 2008/06/12 02:12:01
it calculates the angles from the vectors or quaternions (how the stuff is really stored in the engine), so when there are multiple angle representations of a vector direction, you can get what you get... dunno.
Quaternions
#20 posted by necros [99.227.108.217] on 2008/06/12 09:17:34
are pure evil. T_T
Kinn
#21 posted by Lunaran [75.134.21.66] on 2008/06/12 12:32:53
sounds like rotation order isn't XYZ. you could build the valve thing in the editor facing down the z-axis, rotate it first into the position you want in your script's main() (0 90 0 I think?) and then do all your rotation on z instead of x. this might only work in my head.
Lunaran
#22 posted by Kinn [86.162.11.209] on 2008/06/12 21:30:33
after a quick test, it looks like that would work - if i do the same rotation in the y-axis only, or the x-axis, then the angle value goes smoothly from 0 to 360 as I move clockwise.
still don't really understand why the x-axis should be different tho :{
Correction:
#23 posted by Kinn [86.162.11.209] on 2008/06/12 21:32:01
if i do the same rotation in the y-axis only, or the x-axis
should read:
if i do the same rotation in the y-axis only, or the z-axis,
Poles And Gimbal Lock
#24 posted by Preach [131.111.213.35] on 2008/06/13 01:54:44
The reason is probably what's called Gimbal Lock, although the name isn't very illustrative of the problem. The easiest way I can think of describing it is through FPS view angles.
Imagine you're running quake with some engine that lets you look 90 degrees up and down, and think about the unit vector describing the direction you are facing. Most of the time, there is a unique correspondence between this unit vector and the angle at which you are facing, each pair of pitch and yaw correspond to a different vector.
The only way that this does not hold is when you look straight up or straight down. Then regardless of how much you turn left or right, the vector describing the direction you're facing is the same, '0 0 1' or '0 0 -1'. This loss of a degree of freedom is what's called Gumbal Lock.
I'm guessing that when Doom3 represents angles it does it round the x-axis rather than the z-axis, although I've not really checked that out in theory or in the engine. The problem is a bit more complex than the illustration, as rotations in 3D have three degrees of freedom, not two. Quaternions represent these three degrees of freedom with 4 variables and 1 constraint, just like the 3D unit vectors describe pitch and yaw as 3 variables with 1 constraint.
Arrgh
#25 posted by Preach [131.111.213.35] on 2008/06/13 01:57:05
That last bit is a little wonky, it's too late to be doing that kind of maths, probably best if you ignore it.
Gumball Lock!
#26 posted by Lunaran [75.134.21.66] on 2008/06/13 02:30:30
that sounds delicious!
Yeah
#27 posted by ijed [190.20.72.221] on 2008/06/13 04:43:03
I'm working with this now in another engine - it's a pain in the balls.
Basically the typical systems that use 0-360 are just so that stupid humans can understand what's happening.
Didn't post before because I hadn't got around to asking a programmer.
Any Links To These Kinds Of Informaton?
#28 posted by RickyT23 [90.211.135.162] on 2008/06/16 20:37:53
I remember when I was 14 asking my maths teacher if he knew how to plot a 3d image using maths, because I had made some simple scrolling doodles in BBC basic ! I figured out how to create a 3D effect, but were talking about black blocks with 16-colour lines, and you couldnt rotate the view... I never did get any further down that route (rabbit hole), as in "programming computers" TBH.

Post A Reply:

Name: |
Title: |
Body: |

Website copyright © 2002-2011 John Fitzgibbons. All posts are copyright their respective authors.