Texture upscaling mod question

Questions specific to OpenMW-CS can be asked, and content development related topics can be discussed here
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Texture upscaling mod question

Post by raevol »

Nice, bookmarked, thank you. Why did you have to give a talk on anti-aliasing?
User avatar
AnyOldName3
Posts: 2667
Joined: 26 Nov 2015, 03:25

Re: Texture upscaling mod question

Post by AnyOldName3 »

I had to give a talk on something as the person who was in charge of what I did at university thought it helped make people into better computer scientists. Anti-aliasing was something to do with computer science which I knew more about than any of the other people I was doing my degree with, so it's what I went with.
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Texture upscaling mod question

Post by raevol »

Nice, makes sense.
User avatar
lysol
Posts: 1513
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: Texture upscaling mod question

Post by lysol »

AnyOldName3 wrote: 06 Jan 2018, 00:13
but the vanilla textures give you kind of a hind of how big the texture needs to be.
That's putting an awful lot of faith in the competency of Bethesda... although it's reasonable as a starting point. I'm now going to go into more detail than you're probably interested in.
That's why I said "kind of a hint" and not "do like the vanilla textures!". ;) Of course it's all about how close you are to the object in question and how much you see the object.

And that Nyqvist theorem makes sense. Thanks!
User avatar
wareya
Posts: 338
Joined: 09 May 2015, 13:07

Re: Texture upscaling mod question

Post by wareya »

In sampling theory, the isotropic brick-wall lowpass for 2d stuff is convolution against Jinc. This destroys high-frequency checkerboard information, but that's what makes it isotropic: if you have a square tiling image, lowpassing it with jinc means that you can then rotate it however you want without losing information (assuming perfect sampling).
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Texture upscaling mod question

Post by Chris »

In theory, a perfect brick-wall lowpass filter (jinc in 2D, sinc in 1D) results in a "perfect" resample that loses no information from the input. In practice this leads to ringing artifacts as a result of the sample points (pixels) hitting the peaks and troughs of the band-limited analog signal (aka the Gibbs effect "ripples"), and is considered poor for image quality if the output image isn't well above the pixel density the human eye is capable of seeing. You actually need to add high-frequency noise to suppress those artifacts (a de-ringing filter). But unless you have the original high-frequency content (the original high-resolution image) it will always be nothing more than an approximation, a guess.
User avatar
wareya
Posts: 338
Joined: 09 May 2015, 13:07

Re: Texture upscaling mod question

Post by wareya »

In theory you want to use a brick-wall filter with a reversible deringing filter (which can just be another blur, but one that isn't a brick wall filter!), but nobody does that. They use filters with tons of aliasing instead, so whenever you resize an image too much (EDIT: too many times in a row) it starts to look weird. Brick-wall filters are the only way to be able to do several resampling operations and not make it look weird. It would even be fine to just do sinc in both dimensions then blur it a little with a gaussian blur.
Last edited by wareya on 08 Jan 2018, 01:39, edited 1 time in total.
User avatar
Ravenwing
Posts: 335
Joined: 02 Jan 2016, 02:51

Re: Texture upscaling mod question

Post by Ravenwing »

lysol wrote: 05 Jan 2018, 22:54 Smart people think something like this: Most major textures in Morrowind is 256x256. These guys go up to 2048x2048 if you go for 2k, which is 8 times bigger than 256. Then you have some 64x64 textures. Go for 8x bigger again, which is 512. Etc etc. Most textures (they are also the largest ones) will then be 2048x2048, so you basically have a 2k pack now.
This is the route I'm going, but less because I'm very smart and more because the increase is going to have to be constant if it's all batched lol. Glad I'm not crazy though.
AnyOldName3 wrote: 06 Jan 2018, 00:13 Even then, it's possible that it needs a bigger texture than it fills pixels. For example, as the texture covers the whole object, if it takes up around 128x128 screen pixels, a 128x128 texture won't be adequate as some of those texels are used for the back of the object so you don't end up with a whole texel per pixel.
Interesting, I hadn't thought of that, but that makes a lot of sense. And thanks for the link! It should be required reading for anyone talking about computer graphics. I've never really read anything that pulled all those different phenomena together in such a way. Probably only understood about half of it, but all the general concepts weren't too hard to grasp.

As an update, I converted all the textures into vectors, but for some reason the tracing function in Illustrator slightly shifts the whole image so it's not quite centered anymore and I couldn't figure out how to crop it out without possibly shifting textures so they didn't line up anymore. Then I actually tried the waifu2x upscaler. It worked pretty well actually, but since I'm applying some filters over the texture anyway, I didn't think the extra processing time was worth it. I would be willing to try again if someone was able to train a version on game textures, but their version that was trained on photos instead of anime just made everything blurry.
User avatar
Ravenwing
Posts: 335
Joined: 02 Jan 2016, 02:51

Re: Texture upscaling mod question

Post by Ravenwing »

Well, altogether this has been a rather discouraging experience. Basically every step of the way has been considerably more complicated than I anticipated. Photoshop's batching capabilities are much more limited than I had hoped and forced me to use an external tool to convert everything back into a DDS. For anyone's future reference, there are a few things standing in the way of this being as cut and dry as I had originally anticipated:
  1. Illustrator's image trace has to be batched externally and then moves the texture ever so slightly out of center.
  2. Basically any filter you can apply will disrupt the seem between different textures because the algorithm obviously doesn't know anything about the other textures it has to align to.
  3. For any artistic filters, the scale of the brush strokes vary based on the scale of the image, creating a visual imbalance between textures of different size.
  4. Not sure if it's a limitation of DDS or the tool I was using, but textures over a certain size don't package properly.
  5. No way of batching (that I knew of) that will maintain proper type of transparency among different DDS types. I could have used the variable alpha type, but I'm sure that would have either screwed up normal textures, and at least bloated the file size.
  6. Different batching methods only allow saving as certain file types and not all can use and maintain subdirectories.
One of my big goals with this would be running anyone's personal set of texture mods through the process to aid in the visual coherency of having different mod authors. Some of these problems are more insurmountable than others, but it's certainly a complicated task regardless of how efficient you can use preexisting tools. I might pick this experiment up again later, but for now I'm a bit too frustrated with everything to continue. Thanks for the help everyone! Maybe one of you clever people can figure out how to solve some of these problems.
Post Reply