[0.15.3] Cloak back drawn under character paperdoll instead of over it [CLASSIC VARIANCE]

Locked
User avatar
MrFlibble
Posts: 411
Joined: Sat Jan 27, 2018 10:43 am

[0.15.3] Cloak back drawn under character paperdoll instead of over it [CLASSIC VARIANCE]

Post by MrFlibble »

I've noticed that the character screen draws the cloak back layer not in the same order as vanilla DF:
2023_09_04_20_03_58.jpg
2023_09_04_20_03_58.jpg (191.77 KiB) Viewed 4664 times
Compare this to the DOS version:
cloak-vanilla.png
cloak-vanilla.png (196.54 KiB) Viewed 4664 times
While it may seem that the DFU version is correct, because the tail is fully visible, I still think that the DOS version is the intended look. You can notice that there is a vertical slit in the back of the cloak -- a feature unique to female Argonian and Khajiit characters, and only to casual cloaks -- which I believe is not a drawing error; the idea was that casual cloaks for these two races indeed have a slit to allow the tail to stick out of the cloak, so indeed only its tip is visible at the legs.

You can also notice that for some races, the cloak back conceals certain dark pixels around the edge of the paperdoll sprite as well, which does not work if the paperdoll is drawn over the cloak back as in DFU.

User avatar
Interkarma
Posts: 7247
Joined: Sun Mar 22, 2015 1:51 am

Re: [0.15.3] Cloak back drawn under character paperdoll instead of over it

Post by Interkarma »

Hey, that's really interesting! Not sure how classic is executing that, as the Khajiit figure and tail are not separate images. The cloak background is either drawn behind the figure or in front of it (and you definitely don't want it drawn in front of the figure). There's no in-between. The way Daggerfall generally does this kind of rendering on paper dolls is using masks, but I'm not aware of any tail masking for the cloak background.

Classic would need to be using something hardcoded or a masking process I'm not aware of at this time. In any case, it's a minor variance. The DFU method works uniformly across all paper dolls and still looks perfectly fine even if it isn't pixel perfect compared to classic here. It's not something I'll be making any changes to at this stage in my relationship to DFU.

I'll still move to issues however, in case some future steward wants to take a crack at it post-1.0. :)

User avatar
MrFlibble
Posts: 411
Joined: Sat Jan 27, 2018 10:43 am

Re: [0.15.3] Cloak back drawn under character paperdoll instead of over it

Post by MrFlibble »

Interkarma wrote: Tue Sep 05, 2023 11:18 pm Hey, that's really interesting! Not sure how classic is executing that, as the Khajiit figure and tail are not separate images. The cloak background is either drawn behind the figure or in front of it (and you definitely don't want it drawn in front of the figure). There's no in-between. The way Daggerfall generally does this kind of rendering on paper dolls is using masks, but I'm not aware of any tail masking for the cloak background.
That's actually very simple. The paperdoll items are apparently drawn in several layers that have a priority order of what is drawn over what. The items also have transparent areas through which lower layers can "show through" (like when you see the hands and/or arms of the character when wearing pants, shirts, greaves, dresses, etc.).

Here's what the Argonian version of the cloak back looks like:
argonian-cloak.png
argonian-cloak.png (1.95 KiB) Viewed 4573 times
argonian-formal-cloak.png
argonian-formal-cloak.png (1.87 KiB) Viewed 4573 times
Above is the Casual cloak back, below is the Formal cloak back. Both are from my fix, but they are virtually unmodified compared to the original Bethesda version, as I only added the missing parts to the Casual cloak, strictly based on the human female version, to fix these errors).

As you can see, the transparent parts of the Casual cloak only match the body shape without the tail, whereas the Formal cloak has the shape of the entire body, including the tail. Since in vanilla DF, the cloak back is drawn over the paperdoll, the tail becomes invisible when a Casual cloak is worn. So I'm not sure why you'd say you don't want the cloak back to be drawn over the paperdoll, because this is how the original game does that.

You can also notice, on my screenshot from DFU in the first post, that the neck line of the Khajiit suit very obviously covers a part of the character's chin -- which is also more noticeable with Khajiit characters and human/elf ones (where the Khajiit suit has a different shape but also a high neck line). I believe that the developers might have intended the Khajiit suit to be drawn in a different order of layers, so that it would be covered by the character face (and helmets), and not over the face instead. But this is just my suspicion.

User avatar
Interkarma
Posts: 7247
Joined: Sun Mar 22, 2015 1:51 am

Re: [0.15.3] Cloak back drawn under character paperdoll instead of over it

Post by Interkarma »

Thank you MrFibble. :) I can see what you're getting at, and it would be trivial to reorder cloak background and draw over the figure instead - provided the cutouts are reliably drawn as they seem. I'll see if this is something I can patch in next release. Cheers!

User avatar
MrFlibble
Posts: 411
Joined: Sat Jan 27, 2018 10:43 am

Re: [0.15.3] Cloak back drawn under character paperdoll instead of over it

Post by MrFlibble »

Interkarma wrote: Wed Sep 06, 2023 11:36 pm I'll see if this is something I can patch in next release. Cheers!
Excellent, thanks!
MrFlibble wrote: Wed Sep 06, 2023 7:44 pm I believe that the developers might have intended the Khajiit suit to be drawn in a different order of layers, so that it would be covered by the character face (and helmets), and not over the face instead. But this is just my suspicion.
I rotated this in my head for a while so to speak, and I believe that I'm likely wrong, or at least it would not be an easy fix to make the face be drawn over the Khajiit suit after all, at least without substantially altering the entire system.

Purely from observation, it appears that the paperdoll is rendered with the following order of layers, from the lowest to the highest. Each layer is marked by a number. In most cases, the character can only wear one item from the same layer, however sometimes clothes belong to the same "class" of items (so when you equip one, any other from the same class will be taken off), but are drawn at different layers. For these cases, I have marked layers that belong to the same class with the same number and the letters a and b appended next to it. So, here goes:

0. character body
1. character face
2. cloak back 1*
3. cloak back 2*
4. helm**
5a. pants, breeches, loincloth, tights, Khajiit suit
6. boots, shoes, armour boots
7. greaves
5b. short skirt, long skirt, wrap
8a. short shirt, long shirt, eodoric, vest, dress, gown, kimono, tunic, toga, sash, straps
9. cuirass
10. pauldrons
11. gauntlets
8b. robes
12. cloak front 1*
13. cloak front 2*
14. right-handed weapon
15. left-handed weapon, shield

* for some reason, you're allowed to wear two cloaks, so these are drawn at different layers I guess
** helms have a mask that hides the hair; in the original Bethesda release, in some cases the mask is too large and it clips into paperdoll's shoulders and parts of the casual cloak's back, but I fixed that by editing the mask shape


So, as you can see, if you'd wanted to move the layer with the Khajiit suit beneath the face layer, it'd be covered by the cloak back -- which is probably about fine with most Khajiit suit variants, but not so much with the rest of the items on the same layer, like pants and loincloths. Should you move the face layer up, you'd need to move the helm as well, but helms have the mask part -- as far as I know, there's only one type of mask, colour 255, which essentially draws the background image, bypassing all the layers that might be below it. So the helm may only be positioned over the cloak back, max, because otherwise it will clip into whatever clothes the character has on the upper torso, like shirts or pauldrons.

User avatar
Interkarma
Posts: 7247
Joined: Sun Mar 22, 2015 1:51 am

Re: [0.15.3] Cloak back drawn under character paperdoll instead of over it

Post by Interkarma »

Item draw order is actually encoded into each item's template information, which is embedded in FALL.EXE. This data has been extracted for DFU and is found in ItemTemplates.txt (a JSON file). When rendering paper doll, items are sorted based on the "drawOrderOrEffect" field then drawn in that order. This field does double-duty and is also the effect index for ingredient items, which aren't rendered to paper doll. If you wanted to change the draw order of an item it's the template data that needs to be edited.

But I can't recall if I did something stupid with cloak backgrounds based on your comments though. I haven't touched the paper doll for many years now. I'm going to take another look at the cloak background setup. :)

Edit: Yeah, blitting the cloak background directly over the body before drawing the cloak itself is the correct move for classic items. I'll test this further and then decide if I put it in live or not.

cloak-background.jpg
cloak-background.jpg (62.44 KiB) Viewed 4482 times

The problem I'm likely to introduce with this change is breaking modded item images that were drawn expecting the cloak background to be rendered behind body as it is currently in live. So while this is a simple fix on my end, it might not be worth it to break any mods that haven't drawn the cloak background to be layered over body in this way. I'll check with mod community and see what they think.

User avatar
King of Worms
Posts: 4753
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: [0.15.3] Cloak back drawn under character paperdoll instead of over it

Post by King of Worms »

Yes I must unfortunately confirm the change of cloak backgrounds to be rendered over the body will mess with all cloaks in DREAM and it will be a nightmare to fix that. I described it a bit more in detail in the msg to Interkarma. Thanks a lot for contacting me in this matter! Only compromise I can currently see is, enabling this fix only for non-modded assets. But Im not sure such inconsistency is good and if its even possible :X

User avatar
Interkarma
Posts: 7247
Joined: Sun Mar 22, 2015 1:51 am

Re: [0.15.3] Cloak back drawn under character paperdoll instead of over it [CLOSED]

Post by Interkarma »

Thank you KoW, I appreciate the feedback.

The variation from classic here mainly affects part of the tail for Argonian casual cloaks. I'm not sure many people would notice or care. DFU still looks perfectly fine and works uniformly for classic and modded assets. It's a minor variance that changing would actually cause more problems. I've decided not to make this change for the sake of preserving mod compatibility.

MrFibble, thank you for your keen eye. I also appreciated your knowledge and discussion here. :)

If some future steward of a DFU fork wants to make this pixel perfect to classic, the required code changes are below. Please just keep in mind this will only work reliably with classic texture assets.

Spoiler!
In PaperDollRenderer.cs, remove these lines:
remove-lines.jpg
remove-lines.jpg (132.63 KiB) Viewed 4393 times

Then add these lines:
add-lines.jpg
add-lines.jpg (124.66 KiB) Viewed 4393 times

Locked