Page 1 of 1

A little mod for taking screenshots

Posted: Mon Jan 17, 2011 2:05 pm
by Eraser
I've made a really small mod that I just needed myself. I thought I'd share, because it could be useful to others as well.

Here's the little blurb I included as readme:
SetViewPos is a tiny mod that can be used to teleport yourself through a Quake III Arena map. This can be useful for taking comparison screenshots from the exact same location twice.

The mod only changes a few small things:

The existing \setviewpos command is expanded to also include pitch and roll values. It moves the player to the specified location using the specified viewing angles.
Usage: \setviewpos X Y Z YAW PITCH ROLL
Where X, Y and Z refer to the position in the map and YAW, PITCH and ROLL control the viewing angles. All values are required. Note that the default "straight" roll angle is 0.

The \setviewpos command no longer gives you a little nudge forward after using it. The position you specify to teleport to is the exact position you'll end up in.

The mod also adds the \position command, which echoes out your current X, Y, Z and YAW PITCH and ROLL values.

Note that cheats must be enabled to use the \setviewpos command. The command is usable while using \noclip.
The use-case here is that I wanted to compare certain -light settings of q3map2 with other -light settings, but to really see the difference, I actually needed to exactly identical screenshots, only of different builds of the map.

So I wrote this mod with which I can find the position values of a position where I wanted to take the screenshot, write those down, take the screenshot, do another build, teleport back to that position and take the screenshot again.

The result is a great way to compare two builds of the same map. Maybe people have other uses for it as well, dunno. Enjoy.

Download here.

Re: A little mod for taking screenshots

Posted: Mon Jan 17, 2011 5:37 pm
by Hipshot
Thanks. When I did that before, I used to go alt-enter, switch the bsp and then go alt-enter again. The I would get the exact same pos.

This is probably a lot easier.

Re: A little mod for taking screenshots

Posted: Mon Jan 17, 2011 5:47 pm
by Hipshot
Yea, this was great. Thanks. So simple, since the console stores what you typed, you can just keep switching level version and redo the command...

Re: A little mod for taking screenshots

Posted: Tue Jan 18, 2011 1:36 am
by Silicone_Milk
I dig this. Wondering why it's taken a decade for somebody to come up with this.

:up:

Re: A little mod for taking screenshots

Posted: Tue Jan 18, 2011 8:28 am
by Eraser
I did notice that the "roll" value isn't as useful as I'd like it to be. Because they're floating point numbers, they aren't exact. For instance, if you specify a roll of 30, you'll actually end up with a roll of 29,998169, which is seeminly rounded differently by Q3 every time. I took two screenshots using identical values (and a roll of 30) and one was slightly more rolled than the other. But it's still useful as a neat effect for levelshots :)

Re: A little mod for taking screenshots

Posted: Tue Jan 18, 2011 11:46 am
by VolumetricSteve
What if you specify an arbitrary floating point number just to keep quake3 from playing numberies-funzies by rounding? In other words, if you give it 20.414214 will it hold true to that value?

Re: A little mod for taking screenshots

Posted: Tue Jan 18, 2011 12:27 pm
by ^misantropia^
Q3A performs vector math on the yaw/pitch/roll and that causes the rounding errors.

@Eraser: Try clamping down the player's view angles. The dirty hack approach:

Code: Select all

client->ent->s.angles[0] = atof(va("%.4f", client->ent->s.angles[0]));
client->ent->s.angles[1] = atof(va("%.4f", client->ent->s.angles[1]));
client->ent->s.angles[2] = atof(va("%.4f", client->ent->s.angles[2]));

Re: A little mod for taking screenshots

Posted: Tue Jan 18, 2011 12:51 pm
by Eraser
Awesome, that appears to work.
I've made a new build and uploaded to the same location. So download the new version if you already have it downloaded before.

Re: A little mod for taking screenshots

Posted: Tue Jan 18, 2011 12:56 pm
by monaster
Nice useful tool, thanks!

Re: A little mod for taking screenshots

Posted: Wed Jan 19, 2011 7:54 am
by stevec
Very cool, I had done something similar for a project I'm working on but with a couple of additions that were inspired from a similar feature the source engine has :

I added a new map entity called misc_devshot that can be given a targetname and pitch/yaw/roll values (or optionally a info_target to point at).
This is combined with a new console command \devscreenshot.
Naked, it will loop through all found 'misc_devshot' entities, position the camera and then save a screenshot with a filename based on the current misc_devshot's targetname (i.e capturearea_01_0002.jpg).
You can also call it using the format \devscreenshot target_name. This only takes a screenshot at the specified misc_devshot entity.

Adding this command to the batch/shortcut you perhaps compile + run maps with allows you to create rather cool animated shorts of different areas in your levels progressing through development. Valve has some excellent examples with Team Fortress 2.