Sprite and Texture Offsets and Coordinates?

Ask about editing graphics, sounds, models, music, etc here!
Shaders (GLSL) and SNDINFO questions also go here!

Moderators: GZDoom Developers, Raze Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Post Reply
User avatar
Barry Burton
Posts: 87
Joined: Tue Sep 03, 2019 2:20 pm

Sprite and Texture Offsets and Coordinates?

Post by Barry Burton »

I've only just started dipping my toe into modding making sprite and texture replacements with a little Decorate here and there.

My question is where does one find the offsets for sprites and decorations? Does everyone just copy them from a Doom WAD or is there a way to work them out?

Also, how do you know where to place things on animated stuff. As an example, here's a thread relating to adding a plasma shot to an Arachnotron:

viewtopic.php?f=122&t=69035

How does Jarewill know the coordinates ("ArachnotronPlasma",32,-16)?




BONUS QUESTION: Are there quick access cheat sheets for such things like colour values used for text?

EDIT: I'm already aware of the wiki but I find it only really helpful if I know what I'm looking for in which case I don't usually need it! For example, a while back I tried to find the four letter names for the key sprites and it took me ages trawling through the Sprites pages and Items pages. I ended up giving up and looking through someone else's mod!
User avatar
RailedRobin
Posts: 37
Joined: Thu Aug 01, 2019 5:00 pm

Re: Sprite and Texture Offsets and Coordinates?

Post by RailedRobin »

SLADE3 has the option to work with texture offset.

Other than that, I use trial and error. Been doing a lot of 3d models with different offsets, and every time I change the offset I just load the map and check if it's correct.
SanyaWaffles
Posts: 805
Joined: Thu Apr 25, 2013 12:21 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11 for the Motorola Powerstack II
Graphics Processor: nVidia with Vulkan support
Location: The Corn Fields
Contact:

Re: Sprite and Texture Offsets and Coordinates?

Post by SanyaWaffles »

Those coordinates are offsets for the plasma that's fired from the Arachnotron, it might be different from the actual sprite offsets.

I do what RailedRobin said. I use SLADE3 to do my best to get it down pat, but I just check it in engine as often as possible until it looks right.
Gez
 
 
Posts: 17835
Joined: Fri Jul 06, 2007 3:22 pm

Re: Sprite and Texture Offsets and Coordinates?

Post by Gez »

The offset of a sprite is the coordinate of its pivot point, relative to the origin of the sprite image. As you know, the origin is the reference point for coordinates, and in computer graphics it is typically the upper left corner. The pivot point is the point of the sprite image that is positioned at the exact coordinates of the in-game actor. For example, if you have an imp at map coordinates 512, -128, 32, this is the coordinates of a single point, and the imp's collision box is obviously larger than that. It has a radius and a height. But these are projected from this single coordinate. The coordinate +/- the radius to give the horizontal limits of the collision box, and the coordinate + height for the upper vertical limit, while the lower vertical limit is at the coordinate. (I simplify a bit here, because there are special cases where the behavior differs, but we'll ignore them to keep things simple.)

So from this you should be able to guess that the pivot point of the sprite should correspond to a place that is in the center of the sprite horizontally, and at the bottom vertically, if you want the graphics of the sprite to more-or-less match the physicality of the actor's collision box.

Now the default value for offset positions, like most default values, are 0. And, well, 0, 0 is the origin point, by definition. Which means the upper left corner. And that really doesn't match the collision box since we want the bottom middle instead.

When you look at sprites in SLADE 3, you can see their offset values, and change them. They're in little boxes below the image display.

Now when we're talking not about sprites, but about shooting projectiles, the offsets are an entirely different thing. It's now the coordinates at which to spawn the projectile, relative to the default projectile spawning point, which is IIRC the center of the shooter's collision box. As in, same horizontal coordinates, and vertical coordinate + half the actor height. This is why, for example, a cyberdemon appears to shoot rockets from its crotch instead of from its rocket launcher arm. Or why a mancubus' fireballs both come from its fat belly instead of its arm-cannons. You can adjust the position left and right and up and down (but not fore and aft). This can allow to get the projectiles to spawn more visibly from where they're supposed to spawn, and it was used mostly in Hexen (look at Korax's six-armed spell attacks) and Doom 64, but not in the original PC Doom (hence the issues with cybies and mancs).
Post Reply

Return to “Assets (and other stuff)”