Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
- Magicono43
- Posts: 1141
- Joined: Tue Nov 06, 2018 7:06 am
Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
While adding items and specifically their textures to my current project, I noticed something that I had not before. It seems that textures that are replacing already existing textures seem to inherit the original textures attributes, such as the set size parameters, instead of setting those parameters to the replacing textures size specifications.
For example, the Sapphire item has a size of 7 by 9 pixels, but the texture i'm replacing the original Sapphire texture with is 22 by 32 pixels in size. However, when you actually go in-game you will notice that the texture has been replaced, but the size attributes (and presumably others) are still the same as the old texture, so it renders smaller than one would expect it to.
I seem to have confirmed this using the debug function of Visual Studio, and even though the replacement texture is loaded, it still keeps the old textures parameters, and i'm really not sure why or how to change this. I tried to make a .xml file for said replacement texture as well and include that, but it seemed to have no effect, unlike how it would for something being put on the paper-doll such as a newly added armor or weapon texture.
From my observation I doubt this is the intended behavior, but I don't think I have heard anyone mention or talk about this, is this known or am I the first to bring this up? Thanks.
For example, the Sapphire item has a size of 7 by 9 pixels, but the texture i'm replacing the original Sapphire texture with is 22 by 32 pixels in size. However, when you actually go in-game you will notice that the texture has been replaced, but the size attributes (and presumably others) are still the same as the old texture, so it renders smaller than one would expect it to.
I seem to have confirmed this using the debug function of Visual Studio, and even though the replacement texture is loaded, it still keeps the old textures parameters, and i'm really not sure why or how to change this. I tried to make a .xml file for said replacement texture as well and include that, but it seemed to have no effect, unlike how it would for something being put on the paper-doll such as a newly added armor or weapon texture.
From my observation I doubt this is the intended behavior, but I don't think I have heard anyone mention or talk about this, is this known or am I the first to bring this up? Thanks.
- King of Worms
- Posts: 4753
- Joined: Mon Oct 17, 2016 11:18 pm
- Location: Scourg Barrow (CZ)
- Contact:
Re: Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
Well if original dimension is 10x10 and you create a HD version of let say 100x100 than you definitely do NOT want the ingame result to be 10x the size of original. You want same size but with 10x the pixel density.
Not sure I understand you corectly tho.
Not sure I understand you corectly tho.
DREAM Nexus https://www.nexusmods.com/users/73250038?tab=user+files
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
DREAM Forums viewtopic.php?f=27&t=1168
DISCORD: king_of_worms_cz
- Hazelnut
- Posts: 3016
- Joined: Sat Aug 26, 2017 2:46 pm
- Contact:
Re: Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
Seems like intended behaviour to me, unless you have an xml file with the new size/position data for your image it will use the vanilla data. This is convenient for replacements of the same resolution and size.
So are you using xml files with these images?
So are you using xml files with these images?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods
- Magicono43
- Posts: 1141
- Joined: Tue Nov 06, 2018 7:06 am
Re: Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
"I tried to make a .xml file for said replacement texture as well and include that, but it seemed to have no effect, unlike how it would for something being put on the paper-doll such as a newly added armor or weapon texture."
I tried to add an .xml file with the replacement texture but it did not appear to change anything with the inventory icons, nor do I think it changed any of the "imagedata" properties in the section of code that I was looking at, it still inherited the original image size properties. This was also appeared to be the case with the completely custom textures that had no original texture properties to pull from. So I don't know if the paper-doll rendered image gets the imagedata in a different way than the inventory icon images? That seems to be the case at least from messing around with the wearable jewelry stuff.
- Magicono43
- Posts: 1141
- Joined: Tue Nov 06, 2018 7:06 am
Re: Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
Maybe this image will help explain.
The blue gem on the right is the exact same texture properties as the red one on the left, that being they are both 22 by 32 in size, just their color is different.
But the blue one is replacing the "254_2-0" texture for the sapphire, which as a size of 7 by 9. The red one is an entirely custom texture for an item in "4003_0-0" and as you can see, I would expect them both to have their native 22 by 32 texture sizes on the inventory screen, but that's not the case, the replacement inherits the size properties of the original texture. Also to note that giving either of these .xml files did not seem to change anything about them in the inventory icons.
The blue gem on the right is the exact same texture properties as the red one on the left, that being they are both 22 by 32 in size, just their color is different.
But the blue one is replacing the "254_2-0" texture for the sapphire, which as a size of 7 by 9. The red one is an entirely custom texture for an item in "4003_0-0" and as you can see, I would expect them both to have their native 22 by 32 texture sizes on the inventory screen, but that's not the case, the replacement inherits the size properties of the original texture. Also to note that giving either of these .xml files did not seem to change anything about them in the inventory icons.
- TheLacus
- Posts: 1305
- Joined: Wed Sep 14, 2016 6:22 pm
Re: Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
This is intended behaviour, it ensures custom textures are applied correctly on UI.
How do you provide this custom texture? If a mod affects inventory window, it's up to the mod to apply changes consistently.Magicono43 wrote: ↑Fri Feb 12, 2021 12:26 pm The red one is an entirely custom texture for an item in "4003_0-0"
- Magicono43
- Posts: 1141
- Joined: Tue Nov 06, 2018 7:06 am
Re: Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
I put the custom texture in the "streaming assets" folder as you would when replacing vanilla textures. The difference is that i'm directly adding in the new items item details in the main "itemtemplates" file. So i'm guessing that's the problem then? There is simply nothing in the code that is able to read what i'm giving it? That's what I was sort of thinking the problem was, but I was not really sure.TheLacus wrote: ↑Fri Feb 12, 2021 1:11 pm This is intended behaviour, it ensures custom textures are applied correctly on UI.
How do you provide this custom texture? If a mod affects inventory window, it's up to the mod to apply changes consistently.Magicono43 wrote: ↑Fri Feb 12, 2021 12:26 pm The red one is an entirely custom texture for an item in "4003_0-0"
- Magicono43
- Posts: 1141
- Joined: Tue Nov 06, 2018 7:06 am
Re: Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
Alright, I think I tracked the problem, and also why xml files don't seem to effect the inventory icons like the paper-doll rendered items. Simply put and probably obvious to some, the part of the code that renders the inventory icons does not have any code that actually checks or reads from any xml files, unlike the paper-doll renderer, which directly references the "XMLManager" when it draws the paper-doll items and such. So i'll have to add something similar to this for the inventory icon rendering and see if it works as I expect.
-
- Posts: 1409
- Joined: Mon Aug 12, 2019 4:32 pm
- Contact:
Re: Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
Glad found the solution. Yes, check the code and see if the import texture object adjusts the rect sizes automatically based on custom texture sizes being imported. If not, you will always have to use mod code to inject the custom rect properties to resize said texture to fit the original UI aspect ratio and rendering.
My Daggerfall Mod Github: l3lessed DFU Mod Github
My Beth Mods: l3lessed Nexus Page
Daggerfall Unity mods: Combat Overhaul Mod
Enjoy the free work I'm doing? Consider lending your support.
My Beth Mods: l3lessed Nexus Page
Daggerfall Unity mods: Combat Overhaul Mod
Enjoy the free work I'm doing? Consider lending your support.
- Magicono43
- Posts: 1141
- Joined: Tue Nov 06, 2018 7:06 am
Re: Are Loose Texture File Replacements Supposed To Inherit Aspects Of Original Texture?
Ok, I was able to get what I wanted to work with fully custom textures, so now the inventory icons will render the custom textures based on the parameters set by any corresponding xml files included with said texture, similar to the how the paper-doll renderer handles these things, just no scale or offset values, just width and height. I had to do a bit of hacky method adding and slight altering of some other methods to get this to work, but it does at least.
I still have to do this as well so that the same can be done with textures that are intending to replace an already existing texture, not as important for my purposes, but will probably add that function just for extra control of item icons that I may add later on.
I still have to do this as well so that the same can be done with textures that are intending to replace an already existing texture, not as important for my purposes, but will probably add that function just for extra control of item icons that I may add later on.