Skip to content

Add shaded outline to procedural tool textures#3366

Open
yel0h wants to merge 5 commits into
PixelGuys:masterfrom
yel0h:add-outline
Open

Add shaded outline to procedural tool textures#3366
yel0h wants to merge 5 commits into
PixelGuys:masterfrom
yel0h:add-outline

Conversation

@yel0h

@yel0h yel0h commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

This adds a shaded outline consistent with the item's existing lighting model, using 2 new colors per material, one for the side facing the light, one for the side away from it.

image

Material gains outlineColorLight and outlineColorShadow fields. They can be set via new optional outlineColorLight and outlineColorShadow hex keys in a material's .zig.zon data, and otherwise default to darkened versions of the material's existing colors palette extremes. TextureGenerator.generate now paints background pixels that border an occupied cell with the neighboring material's outline color, picking light vs shadow based on the same heightmap-derived light value already used for interior shading (this was factored out into a new calculateLight helper). The colorInt to Color conversion was also factored into colorFromInt and reused.

Closes #1062

@SpellDigger

Copy link
Copy Markdown
Contributor

not to be that guy but some picture examples when holding the tool would also be useful instead of just inventory screenshot

@ikabod-kee ikabod-kee moved this to In artistic review in PRs to review Jul 14, 2026
@ikabod-kee

Copy link
Copy Markdown
Collaborator

I like this.
I do have one criticism though:
I think that the outline should go inside of the texture rather than outside.
As this PR makes the tools look much too thick.

@careeoki

Copy link
Copy Markdown
Contributor

I like this. I do have one criticism though: I think that the outline should go inside of the texture rather than outside. As this PR makes the tools look much too thick.

Yes, but that wouldn't work with some of our tool textures, some areas are only 2 pixels wide, so the whole thing would be outlines. I think it would be best to just manually update the tool textures (i will do this)

@careeoki careeoki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An oversight: Outline pixels are not taken into account to determine if pixels are connected or not (if a tool is not fully connected it will have 0 durability)
Image

Despite being visually connected by the outlines, the game considers it unconnected.

@careeoki

Copy link
Copy Markdown
Contributor

There are certain situations where I would like to have "corner pixels" rather than just a pixel on each side. For the ends of handles or the tip of the pickaxe head, and such.

image

I don't really know how you would approach this though.

@yel0h

yel0h commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Okay, so connectivity check fixed, and I've managed to find a way to do the corners procedurally.

pickaxe

Basically, for every single-pixel tip it finds the angle of the segment ending in that tip, and then paints the diagonal pixel which best matches that angle.

@careeoki

Copy link
Copy Markdown
Contributor

Basically, for every single-pixel tip it finds the angle of the segment ending in that tip, and then paints the diagonal pixel which best matches that angle.

Awesome! That seems to work well.

Though there's something I didn't consider with using the outlines to define connections. In this situation, none of the interior pixels are actually connected, but the outlines are touching so it is considered connected. Maybe instead, we allow the interior pixels to check for diagonal neighbors?
That would allow the handle here to be connected, but the disconnected parts of the pick head would not be.

image

Also, I opened a PR on your branch with my pickaxe texture so you can test with it. I'll be working on the other tools as well.

@careeoki

Copy link
Copy Markdown
Contributor

I made another PR for the rest of the tools.

The only other thing I encountered is that our swords are no longer pointy:
image

Again, I don't have any ideas.

Otherwise, this seems to be good, I could move this into code review once you merge my PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In artistic review

Development

Successfully merging this pull request may close these issues.

Add an outline to the tool textures

4 participants