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.

Sprite and Texture Offsets and Coordinates?

Postby Barry Burton » Thu Jun 18, 2020 12:31 pm

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
Barry Burton
 
Joined: 03 Sep 2019

Re: Sprite and Texture Offsets and Coordinates?

Postby RailedRobin » Mon Sep 07, 2020 2:24 pm

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.
User avatar
RailedRobin
 
Joined: 01 Aug 2019

Re: Sprite and Texture Offsets and Coordinates?

Postby SanyaWaffles » Mon Sep 07, 2020 3:52 pm

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.
User avatar
SanyaWaffles
Certified Heretic and Grill Champion
 
Joined: 25 Apr 2013
Location: Disappointment Island
Discord: SanyaWaffles#0950
Twitch ID: sanyawaffles
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: nVidia with Vulkan support

Re: Sprite and Texture Offsets and Coordinates?

Postby Gez » Tue Sep 08, 2020 3:03 am

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).
Gez
 
 
 
Joined: 06 Jul 2007


Return to Assets (and other stuff)

Who is online

Users browsing this forum: No registered users and 0 guests