Ren'Py Issue with Displaying Upscaled Images in Ren'Py Game

s6ty3q2

Newbie
Sep 10, 2024
19
12
So, while I personally completely understand your desire to make use of every pixel on your spiffy 4K monitor, I'm sure you can understand these reasons why few developers make games at that resolution.
That all makes a lot of sense, I can very much understand the downsides for developers with higher res. And of course, just because it's in 4k does not inherently mean higher quality.

I'm personally willing to spend a bunch of cpu/gpu power to upres assets before playing games because it'll improve my own enjoyment. I've since figured out how to do so, by unpacking then using waifu2x to rescale + frame interpolation.

I do wish renpy made it easier to include higher res assets - they have an Oversampling feature, but you have to edit all the rpy files to specifically use the oversampled assets.

AsiGenc You need to name the image files accordingly (like happy2.png is 2x oversampled), but also edit the rpy to point to the new file. I wish renpy would automatically look for 2x 3x etc assets first :(
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,617
7,609
I do wish renpy made it easier to include higher res assets - they have an Oversampling feature, but you have to edit all the rpy files to specifically use the oversampled assets.

AsiGenc You need to name the image files accordingly (like happy2.png is 2x oversampled), but also edit the rpy to point to the new file. I wish renpy would automatically look for 2x 3x etc assets first :(
So, file an enhancement request with them. This is the kind of thing they might consider via an "options" flag. In other words, Ren'py programmers could choose the current or the "new" behavior based on a configuration option.
 

Spin256

Mothers and Daughters
Game Developer
Dec 16, 2019
602
1,161
Rendering at 4k isn't just about the additional render time. You're assuming the detail is present in the figures/items being rendered.

I've used older Genesis models for background characters. In 4k, you can see they don't have the same level of detail as the foreground characters. Something not so noticeable at 1080.

The gallery images in my game are higher quality than the regular ones, but those images need more postwork, which means more time.
 
  • Like
Reactions: Golden.Nyks

Golden.Nyks

Newbie
May 24, 2020
43
45
Be careful not to compare apples to oranges. Based on the file sizes, it's quite clear that those three images are not all compressed to the same quality level.

Checking with imagemagick:
Code:
D:\transfer>magick identify -format "%Q" 720p.jpg
99
D:\transfer>magick identify -format "%Q" 1080p.jpg
95
D:\transfer>magick identify -format "%Q" 1440p.jpg
95
If the 720p image is compressed to the same quality level as the other, it's about 280KB, or 63% of the size of the 1080p image.
I didn't realize that the program automatically prints out 95% quality. When outputting at the same compression quality as you said, the average size is 1080p: 500 KB - 720p: 320 KB.

But I think this size difference is worth it. At first, when rendering, it will work better to render in 1080p instead of 720p, but then upscaled from 720p to 1080p works fine, it takes 6-8 hours for about 4000 images.
 

Golden.Nyks

Newbie
May 24, 2020
43
45
I didn't realize that the program automatically prints out 95% quality. When outputting at the same compression quality as you said, the average size is 1080p: 500 KB - 720p: 320 KB.

But I think this size difference is worth it. At first, when rendering, it will work better to render in 1080p instead of 720p, but then upscaled from 720p to 1080p works fine, it takes 6-8 hours for about 4000 images.
Actually, I don't think so, I wish it were so that the detail levels of the models would be high so that high rendering would make sense, but unfortunately not every model has these.
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,617
7,609
I didn't realize that the program automatically prints out 95% quality. When outputting at the same compression quality as you said, the average size is 1080p: 500 KB - 720p: 320 KB.

But I think this size difference is worth it. At first, when rendering, it will work better to render in 1080p instead of 720p, but then upscaled from 720p to 1080p works fine, it takes 6-8 hours for about 4000 images.
It's also worth pointing out that if you're including animations in your project (webm, mp4, whatever), those files tend to be much larger than image files. Again, the choice of screen resolution has a big impact on those, as does the bitrate to which you compress the video. (The equivalent of the JPEG compression level.) And, since every video has a lot of frames that need to be rendered, size also has a big impact on rendering time there.

If I was starting this game today, instead of (eek!) over 6 years ago, I probably would have chosen 1080p instead of 720p. But, back then, my rendering hardware was much more anemic than it is today, and having every render take 2.25 times longer didn't look... "attractive," shall we say? LOL

Similarly, I had observed how many games "needed" people compressing them for others to be able to afford to download them, so I deliberately chose to manage my game's size by compressing my JPEG images (85% quality) as compared to the "raw" JPEG's that Daz Studio would output. (DS outputs at 100% quality level.) That reduced the image sizes to about 25% of the "raw" file. Does that result in some loss of detail? Yes, but it seemed to me that this quality level was kind of the "knee in the curve" between size and visual quality.

So, yes, my choices weren't necessarily what someone with super-duper display hardware would have preferred, but, like most of life, there are always tradeoffs. LOL

And I'm not in any way advocating the view that my choices were "the correct ones" - your (and anybody else's) mileage may vary, depending on which of the competing parameters you choose to prioritize.
 

Golden.Nyks

Newbie
May 24, 2020
43
45
That all makes a lot of sense, I can very much understand the downsides for developers with higher res. And of course, just because it's in 4k does not inherently mean higher quality.

I'm personally willing to spend a bunch of cpu/gpu power to upres assets before playing games because it'll improve my own enjoyment. I've since figured out how to do so, by unpacking then using waifu2x to rescale + frame interpolation.

I do wish renpy made it easier to include higher res assets - they have an Oversampling feature, but you have to edit all the rpy files to specifically use the oversampled assets.

AsiGenc You need to name the image files accordingly (like happy2.png is 2x oversampled), but also edit the rpy to point to the new file. I wish renpy would automatically look for 2x 3x etc assets first :(
Thank you, I was busy for a while and now I decided to try again and the "Oversamplinglink" feature you mentioned was the solution for me, in fact the easiest solution, there is no need to edit Ren'py ".rpy" files, it works flawlessly.

For those who see this topic and wonder how it is done, let me explain briefly;

Normally, when you use images that you upscale, only that much of the image is visible since Ren'Py is based on the resolution the game was prepared for.

The solution is very simple:
Add "@x" to the end of the file names of the images you upscale, according to how many times you enlarged them.
For example:
For 3x upscale: image1.jpg → image1@3.jpg
For 2x upscale: image1.jpg → image1@2.jpg
You don't need to do anything else.
(Remember that you need to save the files to their original location)

(You can upscale them using tools like Waifu2x, Real-ESRGAN or Topaz Photo AI. I use Topaz and the results are really amazing)
 

Turning Tricks

Rendering Fantasies
Game Developer
Apr 9, 2022
1,489
2,777
Thank you, I was busy for a while and now I decided to try again and the "Oversamplinglink" feature you mentioned was the solution for me, in fact the easiest solution, there is no need to edit Ren'py ".rpy" files, it works flawlessly.

For those who see this topic and wonder how it is done, let me explain briefly;

Normally, when you use images that you upscale, only that much of the image is visible since Ren'Py is based on the resolution the game was prepared for.

The solution is very simple:
Add "@x" to the end of the file names of the images you upscale, according to how many times you enlarged them.
For example:
For 3x upscale: image1.jpg → image1@3.jpg
For 2x upscale: image1.jpg → image1@2.jpg
You don't need to do anything else.
(Remember that you need to save the files to their original location)

(You can upscale them using tools like Waifu2x, Real-ESRGAN or Topaz Photo AI. I use Topaz and the results are really amazing)
Lol, I was wondering why the image links were trying to email me - but I guess it's just a feature of this forum when you use the '@' character.

Thanks for the post though... this is a good thing to remember if you ever make a project and then down the road want to upscale all the images.
 
  • Like
Reactions: Golden.Nyks

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,617
7,609
The solution is very simple:
Add "@x" to the end of the file names of the images you upscale, according to how many times you enlarged them.
For example:
For 3x upscale: image1.jpg → image1@3.jpg
For 2x upscale: image1.jpg → image1@2.jpg
You don't need to do anything else.
(Remember that you need to save the files to their original location)

(You can upscale them using tools like Waifu2x, Real-ESRGAN or Topaz Photo AI. I use Topaz and the results are really amazing)
It's worth pointing out that you can also do this via the directory name as opposed to in the file name:

From :
A directory can also specify how much to oversample images inside it. For example, images/@2/eileen happy.png will be oversampled 2x.
 

Golden.Nyks

Newbie
May 24, 2020
43
45
Lol, I was wondering why the image links were trying to email me - but I guess it's just a feature of this forum when you use the '@' character.

Thanks for the post though... this is a good thing to remember if you ever make a project and then down the road want to upscale all the images.

For now, I don’t have any plans to create my own project. It's truly a time-consuming and labor-intensive task, especially when I have no experience with DAZ3D or Blender. I used Maya for some projects in the past, but I don't think it's very suitable for scene preparation. Maybe I can model other things except human models.

My main goal is to bring old legendary games back to life. At least for myself :), by using 15% of my GPU power for 3-4 hours (a bit longer for 4K), I can make the game I play look significantly better.

(The fact that Topaz still lacks multiprocessing support slows things down a bit. Since it processes images one by one, it takes a long time and only uses a small portion of the CPU/GPU power.)

-This method works exceptionally well for 720p games. It takes the visuals to a whole new level. There’s also an improvement in 1080p games, but the jump isn’t as significant as in 720p.

-Don’t think of it as just increasing the resolution. While upscaling not only removes blurriness caused by low resolution but also eliminates compression artifacts and imperfections caused by low-detail rendering in the original images.

Of course, there are some drawbacks. For heavily compressed and low-resolution images, especially on distant faces, AI might struggle to find enough data, resulting in artifacts. However, the overall results are quite satisfying. In a 720p game with 2000 images, I only encountered artifacts in 2-3 instances, while in 1080p, I didn’t come across any.
 
Last edited: