Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to set depth for head layer #2657

Open
probably-jodzie opened this issue May 23, 2024 · 6 comments
Open

Option to set depth for head layer #2657

probably-jodzie opened this issue May 23, 2024 · 6 comments

Comments

@probably-jodzie
Copy link

probably-jodzie commented May 23, 2024

Would it be possible to have an in-game setting to change the depth for the head sprites? And I suppose also the same for helmets

Alternatively, make it possible to set the depth for sprites in an xml file

@KABoissonneault
Copy link
Collaborator

Can you document here why you want the head specifically? Edit it into the original post to make it easier to read the issue.

Basically, what are you attempting to do, what issues are you hitting, why adding this feature would help. When it comes to making changes, it's best for us if we fix the larger problem, rather than address the specific roadblocks of the moment. Engineers might think of a better solution, and we might find something that helps more people. Knowing your intentions helps, overall.

From what my understanding, the entire paperdoll system could use a depth system, rather than force users to put gaps in their sprites. If we're going to fix heads, we might wanna think this through

@probably-jodzie
Copy link
Author

probably-jodzie commented May 23, 2024

Its to fix this:

image

If the modder wanted to have unique head sprites where the hair laid on top of the body, it wont work cuz the head sprites are underneath armour

@KABoissonneault
Copy link
Collaborator

KABoissonneault commented May 23, 2024

After offline discussion and some investigation on my end, I've determined the following.

The current PaperdollRenderer has these categories of paperdoll parts to render:

  • Cloak Interior
  • Body
  • Items

These are listed from "back" to "front", as drawing something last will make it be on top of what was previously drawn. "Cloak Interior" tries to draw the interior sprite of your Cloak 2 (or Cloak 1 if the player only has one cloak). "Body" draws the naked headless body first, draws the underwear headless body if Player Nudity is disabled, then draws the head. "Items" draws all the equipped items in "draw order" (a property of each item).

By this design, all heads are always drawn before all items, and therefore are behind all clothing and armor, but always above the body. Long hair on the left side looks "behind" the shoulder if the shoulder is clothed, and "in front" if the shoulder is naked.

image
image

Pretty sure this inconsistency is a classic issue. It does not require modded graphics to observe.

After my investigation, I've determined three approaches to fix this issue:
1a. Let mods specify the entire head as above most items, but below helmets and cloak exteriors
1b. Make all heads render above most items, but below helmets and cloak exteriors
2. Let mods provide a second texture associated with the head that renders above items

The first solution has the issue of extra complexity when it comes to sorting equipment, but I think it's not that bad. Version A is opt-in for mods that want to fix this, while Version B always fixes the inconsistency without mods, with the drawback that some clothes or armor might be more covered with some faces.
The second solution allows mods to have both parts that go behind and parts that go in front. It does require extra work from modders, to split their textures in two. I also think this approach might be more flexible for solving similar problems in the future. This solution is consistent with how classic handles cloaks, with an interior part underneath the body, and an exterior part above the body.

For solution two, the render order might look more like:

  • Item Back (includes classic cloak interior)
  • Body Back (nude body, underwear body, then head back)
  • Item Middle (all normal items, sorted by draw order)
  • Body Front (includes Head Front, and potentially the left hand in front of the armor)
  • Item Front (helmets, cloaks, gloves, sorted by draw order)

(We don't have to do the hand thing yet, it's just an idea for future proofing)

With this, modders would simply have to provide an extra texture with an annotation on the name (ex: FACE14l0_Front.jpg), and if available, DFU would pick it up and render it.

In addition, having a "_Helmet" variant for faces could be useful, as modders could make the face bald in order to avoid clipping through any helmet.

Anyway, some ideas for whoever wants to tackle this. I'd rather not do 1a, as I feel it's not fully flexible and requires special casing all future similar problems, but it's also the easier and least controversial solution, so I'll take whatever someone manages to achieve.

@probably-jodzie
Copy link
Author

probably-jodzie commented Jun 9, 2024

Untitled

New tall boots and a loincloth. At this point I dont know. Let the modder set the depth they want in an xml file?

@probably-jodzie
Copy link
Author

Capture

It seems different leg items have different depths. Skirts have a depth of 35 while loincloths have a depth of 10, but it should not be 35 as well since it needs to go over, not under?

@KABoissonneault
Copy link
Collaborator

KABoissonneault commented Jun 9, 2024

I'd rather not touch this value in DFU, it can probably be changed through code by either changing the base loincloth/long skirt, or by creating new item variants that have different draw orders. But that's not terribly accessible to artists.
I could conceive of a way for graphics mods to give their own texture a custom draw order though, probably in the XML file used for texture replacements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants