AI Upscaled Textures

Show off your mod creations or just a work in progress.
Post Reply
User avatar
MasonFace
Posts: 543
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: AI Upscaled Textures

Post by MasonFace »

Yeah sry, what I meant was - will you make it so you can tick out (if there's going to be in form of MOD /modScreen), if you want to use heightmaps or not. Thats all. :P
I think I can handle this since Lypyl wrote a very good tutorial on how to do it.

https://forums.dfworkshop.net/viewtopic ... 2381#p2381

I think I can make it work; I'll do some testing soon, but I may not have it ready before I release the demo though. :?

hurleybird
Posts: 17
Joined: Mon Dec 10, 2018 12:00 am

Re: AI Upscaled Textures

Post by hurleybird »

Simply amazing. The one downside I can see in the last shot is that texture repetition is more obvious, but that's more the fault of the source material, and I don't imagine it will be too difficult to create a few variations eventually.

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: AI Upscaled Textures

Post by TheLacus »

MasonFace wrote: Wed Feb 06, 2019 7:44 pm
Yeah sry, what I meant was - will you make it so you can tick out (if there's going to be in form of MOD /modScreen), if you want to use heightmaps or not. Thats all. :P
I think I can handle this since Lypyl wrote a very good tutorial on how to do it.

https://forums.dfworkshop.net/viewtopic ... 2381#p2381

I think I can make it work; I'll do some testing soon, but I may not have it ready before I release the demo though. :?
I wrote that tutorial a long time ago and is now outdated. I'll send LypyL a new version, in the meanwhile you can refer to the informations here. Said that, i suggest that what you're trying to achieve is not trivial and the optimal and most performant way would be to release two separate versions of the mod.

User avatar
MasonFace
Posts: 543
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: AI Upscaled Textures

Post by MasonFace »

Said that, i suggest that what you're trying to achieve is not trivial and the optimal and most performant way would be to release two separate versions of the mod.
TL;DR: I assume since we're able to override material settings using XML files, then it must be possible to alter the material settings before DFU initiates. However, even if the heightmap value is set to its minimum, there will likely be no increase in performance, so you're probably right.

I didn't want to say no until I've tried (and probably failed). What I was going to try to do is use a boolean enableHeight in the menu, and if the boolean is false, then it will either set the heightmap value to 0.005 or set the heightmap texture to some tiny 4x4 black texture. The obvious drawback is that the shader will still do calculations on the heightmap so there is no appreciable performance advantage, if any at all. I believe if I were to try to set the heightmap texture to null (if I even can), it would not behave like a material whose heightmap was not initially set since all the shader variants have already been compiled. Basically, I think it would have the same outcome as setting the height value to its min value, but I don't know that for sure; it might just throw an error instead.

As an alternative, I was thinking that I could use scaling factors for the smoothness, normals, and heightmaps so users could amplify or diminish these effects. The drawback there is that it will apply to all the materials with no ability to fine tune them individually, although I guess an .xml file for each material in the StreamingAssets/Textures folder would work if the user really wanted to fine tune the settings. Also, if the scaling factor is set to 0, then it will essentially mute the effect entirely, but again without any performance advantage.

And all this is predicated on the assumption that I can read the materials contained in the .DFMOD file and isolate my edits to only those materials, AND that these edits persist only for one session. That is to say, the next time you run DFU, it pulls in the default values for each material from the .DFMOD file. If I can't programmatically read the contents of the .DFMOD, then I would have to read from some other file that contains all the materials in the scope of the mod, which means I would have to manually populate that file, which means I'm not fooling with it.

So in summary: you're almost definitely right. It would be much simpler to have two separate mods, but I'm an engineer and I just can't help myself from tinkering!

Edit: The first time I tried your link, it didn't work (I was viewing on my phone). I'll look it over. Thanks!

User avatar
MasonFace
Posts: 543
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: AI Upscaled Textures

Post by MasonFace »

hurleybird wrote: Thu Feb 07, 2019 12:59 am Simply amazing. The one downside I can see in the last shot is that texture repetition is more obvious, but that's more the fault of the source material, and I don't imagine it will be too difficult to create a few variations eventually.
You're certainly right about the repetition being more apparent with the upscaled textures. I suppose when we see low resolution textures, they always repeat their pattern a lot to save memory, but with a higher memory budget, artists can usually increase the resolution while also packing in additional variations so the repetition is less noticeable. Since we so often see less repetition with higher resolution textures, we've created the expectation through association, so it's no wonder that it stands out the way it does when you think about it.

Unfortunately, I believe it actually would take quite a bit of effort to create variations. However, I will release all of this mod's source material so others can tackle the problem if they feel compelled to do so.

User avatar
pango
Posts: 3347
Joined: Wed Jul 18, 2018 6:14 pm
Location: France
Contact:

Re: AI Upscaled Textures

Post by pango »

MasonFace wrote: Thu Feb 07, 2019 3:59 pm Unfortunately, I believe it actually would take quite a bit of effort to create variations. However, I will release all of this mod's source material so others can tackle the problem if they feel compelled to do so.
Maybe algorithms like texturize can help by "patching" pieces of the original texture together in an irregular way; It may be too irregular for some textures like paved walls though...
And also, not bring any novelty like some artist work can.
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: AI Upscaled Textures

Post by TheLacus »

MasonFace wrote: Thu Feb 07, 2019 3:11 pm And all this is predicated on the assumption that I can read the materials contained in the .DFMOD file and isolate my edits to only those materials, AND that these edits persist only for one session. That is to say, the next time you run DFU, it pulls in the default values for each material from the .DFMOD file. If I can't programmatically read the contents of the .DFMOD, then I would have to read from some other file that contains all the materials in the scope of the mod, which means I would have to manually populate that file, which means I'm not fooling with it.
Assets are cached the first time they're loaded from the assetbundle. You can subscribe to ModManager.OnLoadAssetEvent(string ModTitle, string AssetName, Type assetType) to invoke a delegate when this happens and Mod.GetAsset() without the clone flag to retrieve a reference. This should allow you to apply run-time changes to the material, not sure about performance though ;)

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

Re: AI Upscaled Textures

Post by King of Worms »

Creating a high res texture which doesnt seem to repeat itself way too much in DFU scenarios is a challenge on its own and Ive struggled with it a lot.
I waged this battle with various results :) But found my way and Im quite content with it now.

Creating variations in this current state of things would be huge change to how all the texturing is working...

I think... lets just try the demo and see how it works when you actually play it, instead of being focused on one screenshot...

My guess is, this will not be such a issue.

Best regards :)

PS: I actually quite enjoy working within the constrictions of DFU, its very specific. If you can make textures look good withing these limits, you can make em look everywhere else. Its all good.

Narf the Mouse
Posts: 833
Joined: Mon Nov 30, 2015 6:32 pm

Re: AI Upscaled Textures

Post by Narf the Mouse »

One idea I saw someone mention elsewhere on the forums is to use a main texture, then a second texture which is repeated at a smaller scale. So, for example for a dungeon wall, you could have a bricks texture, and then a "gritty stone" texture which is repeated at, say, 4x4 or 8x8 by UV scaling it to 0.25 or 0.125 of the bricks texture.
Previous experience tells me it's very easy to misunderstand the tone, intent, or meaning of what I've posted. If you have questions, ask.

User avatar
MasonFace
Posts: 543
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: AI Upscaled Textures

Post by MasonFace »

Narf the Mouse wrote: Thu Feb 07, 2019 8:13 pm One idea I saw someone mention elsewhere on the forums is to use a main texture, then a second texture which is repeated at a smaller scale. So, for example for a dungeon wall, you could have a bricks texture, and then a "gritty stone" texture which is repeated at, say, 4x4 or 8x8 by UV scaling it to 0.25 or 0.125 of the bricks texture.
That's a good idea, but for some textures I'm already using a secondary normal map to get fine detail (the opposite of the suggested effect) and I don't think I can do both. I really wish I could de-couple the secondary albedo and secondary normal texture UV scaling, then I could get the best of both worlds by making the secondary albedo scale large for macro color variation, and the secondary normal scale small for the micro detail. I might play around with this concept though.
Thanks for sharing!


EDIT: I misread your post. :oops: What you described is what I'm doing and I think it works quite well!
Last edited by MasonFace on Tue Feb 12, 2019 2:22 pm, edited 1 time in total.

Post Reply