[MMD Raycast] Tonemapping + HDR10 Output!
I decide to show all the tonemapping that Ray-MMD (or Raycast)
contains. The first seven from top-left to bottom-right are from
Raycast. It seems like Linear gives the most accurate saturation spots,
as opposed to the other ones. Reinherd does compress the highlights
aggressively. Hable and Uncharted generally becomes lighter with
highlight compression. The rest decides to play around the contrast.
Here
is one big news about Raycast that almost no one thinks it’s possible
on MMD. HDR10 OUTPUT!!! The modern new output that is on Ultra Blu-Ray
and Netflix 4k Streaming.
Of all the
tonemapping that Raycast offers, doing this experiment to have MMD
render for HDR is possible. I played it on my TV and it looks like the
contrast looks better and the highlights are shown at the same time
without desaturation or clipping. It generally lets the highlights be
brighter on screen without being clipped through. HDR is supposed to
have better contrast, and the lights being lit are supposed to show more
details without any compression.
This is being
played on MPC-BE and MPV to see how their HDR->SDR algorithm handle.
It looks a lot better than any of the tonemapping shown on Raycast. It
is being played on SDR, for obvious reasons. When you play it on real
HDR screen, it should look better and the contrast should be a bit more
real. MadVR is trying to match MPV by going with 300 nits and have
highlights compressed. It also uses highlight recovery to low to show
minor details on compressed highlights. On MPV, it is on deafult, with
HDR-Compute-Peak=No added to the config file to have constant
brightness. With MadVR and MPV on these settings, it can show how it
would look on HDR display. That way, you can test them to see how it
would look. MadVR seems to win by several areas over MPV. To see how HDR
content would look on HDR display, around 300-400 nits can be played
through in MadVR to see if you can adjust the settings. MPV is using the
latest dev build by the way, and there was an issue ticket on github
regarding HDR.
The HDR10 experiment is
experimental! I did this by setting tonemapping to linear, and have the
Contrast- set to 0.8 to have them look more grey and compressed so that
any HDR tonemaps can make it look amazing. It does look a little more
saturated. I’m not done yet to adjust them or make tutorials on it. It
is challenging to have the colorspace converted from Rec.709 to
Rec.2020. I tried doing that on Avisynth+, but converting to Rec.2020
doesn’t really change anything, and I don’t want any players to mistake
it as a native Rec.2020 source. It would look oversaturated and color
shifts. I had to import a UT Video YUV420 Rec.709 AVI to Sony Vegas and
use 3DLUT Cube file to convert the colorspace to Rec.2020. After that, I
render it by using Debug Framework tool or export as UT Video YUV420
Rec.709 AVI. For the former, it must use an .avs file to load the fs.avi
file. x265 or Staxrip can load the .avs file.
By the way, most Players and web services want these exact settings for x265 to play the video in HDR:–profile
main10 –colormatrix bt2020nc –colorprim bt2020 –transfer smpte2084
–max-cll 1000,300 –master-display
G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)
–hdr
I’m gonna still play around with this, and I will update it on the next post that discusses MMD in HDR10.
[MMD] Downscaling Anti-Aliasing with RAY-MMD
Edit 3/12: Correct Downsampling terms. 4x is 4 pixels coverage and not actually 2x.
This
project of doing the best method of Anti-Aliasing is challenging. If
you use MMD-RAY shader, any form of Anti-Aliasing, whether it’s from
MMD’s default AA, or your driver’s AA, is not being used at all. You
only do have post-procesing shaders instead, such as FXAA and SMAA.
Although, I do came across artifacts on SMAA. Those post-aa shaders
don’t help temporal aliasing or shimmering from missing geometry lines,
and Ray-MMD doesn’t have internal supersampling options. I’ve tried many
theories to do this approach, and while it’s easier to do with photos
since it takes seconds to do snapshots, videos do take a lot longer the
higher the resolution is. Ray Shader is a tricky situation for better
Anti-Aliasing since it has its own framebuffer.
Here are the comparisons of Anti-Aliasing, and it includes Downsampling:
https://pokefan531.tumblr.com/post/171769349563
Video:
https://youtu.be/5Uc3wkC7Xx8 1080p version for none and 4x.
https://youtu.be/Sqaz_v9IAZs 720p version for none, 4x, and 9x.
The
best option right now is to double, triple, or quadruple the target
resolution. You do get more pixel samples and it is the only easiest
method if you know how to downscale manually. Think of this as Nvidia’s
DSR or AMD’s VSR ecept only doing 4x.
In the photo, I’ve shown no
downsampling, 4x, and 16x. All downscaled from Photoshop to have more
defined anti-aliasing. FXAA isn’t used here to demonstrate the quality
of downsampling. 4x have 4 pixel samples, 9x has 9 samples, and 16x has
16 samples. 16x seems to be the best quality, especially for photo
editing. If you are doing a non-integer sampling, such as putting a
resolution in the middle between 1080p and 4k, the downsampling won’t
really help a lot on shimmering and temporal aliasing on lower samples
than 4x.
4x Downsampling is really 4 times pixels from your
target resolution. As you can see at the image on top, you can see the
difference between no downsampling and 4x. Look at the foliage and small
lines at the staircases. It even takes care of the shading aliasing as
seen on the models. It is a big difference. It is “recommended” for most
users to use this quality of downsampling for video rendering to save
rendering time to process on both MMD and Virtualdub.
16x
Downsampling is the last thing to show from the image above. It is 16
times pixels. The staircase is taken cared well and the lines around the
screen are more connected. It is somewhat less of the difference from
9x from the comparison AA post, but comparing the image is noticeable if
you look at small lines and missing disconnected lines. It is more
noticeable if you compare it with 4x. It is best for Image rendering for
Ray Shader.
Instructions how to downsample your video or image.
For
Image, load your favorite photo editor like Photoshop or GIMP, and load
that file, and downscale it to your target resolution. Downscale it
with Bilinear, and Bicubic gives off ringing around the edges. For
example, you downscale 3840x2160 to 1920x1080p with bilinear for 4x
downsampling. You can save that image.
For Video, since you render it
to AVI with UT Video, load it to Virtualdub, and go to filters and use
resizer, and make sure you know the video’s resolution to downsample.
Use bilinear and put 1920x1080 if it’s from 4k to do 4x downsampling,
and go to Compression and select UT Video RGB to compress and then click
Files and Save AVI and name your AVI to save, and you are rendering
your downsampled video and it’s saved. If you have audio, it will
automatically do a direct copy, and you can check at Stream List and see
if you have audio.
You can use it with FXAA to give more AA IQ,
even at 16x. It’s always best to upscale the resolution by exact
integer, like double, triple, and so to have best AA quality. For
example, if you are targeting 1080p (1920x1080), then you double it to
4k (3840,2160) for 4x downsampling, (5760,3240) for 9x, or 8k
(7680x4320, INSANE!!!) for 16x. UT Video RGB codec is recommended.
Let’s
talk specs for 4k rendering to video with Ray shader. A 2GB video card
won’t give you reasonable fps for video rendering. For me with GTX 950
OC, it is around 1fps to render in 4k (VRAM bottleneck) and a bit more
at 1440p. It has to be at least more VRAM, but 4GB is recommended, but
that doesn’t mean that you can’t get or keep a GTX 1060 3GB. 8k right
now is pretty insane if your VRAM is lower than 10GB+ for video
rendering while using MMD-RAY shader. RayMMD on higher resolutions are
intense right now, and if you want to supersample your 1080p video with
16x or a 4k video with 4x, your GPU has to be like GTX 1080 Ti to render
it to video with decent fps, 16GB RAM, and a CPU that has at least 8
threads in last few years, like i7s or Ryzen 7. A CPU while using UT
Video with lossless compression and use Gradient for the fastest encode
than the lowest settings, Left, which has lower compression ratio than
Gradient or Median. T2 renders faster with CPUs that have AVX2 or
AVX-512, but if you want to play the video, it’s pretty difficult as
I’ve tried to get video players to run it, but didn’t show on players or
video editors, but loads well on Virtualdub or Avisynth. RAM is best
for at least 8GB, and I’ve had 4k rendering hit around 6.5gb and goes
around 5gb on 1080p or lower. Image Snapshots are not really worried
about for fps. It takes several seconds with MMD-RAY, but if you got a
crash for going even higher resolution, then downsample less like 4x for
stability. My GPU has no problems taking snapshots at 8k so far, but
whether you are doing snapshots or video rendering that bottlenecks your
VRAM, you will experiences slowdown on your desktop since it shares the
VRAM and can make it almost unusable during the bottleneck. If you
don’t mind letting your PC render on higher resolution for downsampling
or doing native 4k, you can leave it on, and it does depend on how long
it is the project and can depend how much fps you want to render your
video to. 30fps vs 60fps will double the rendering time. For Image, it’s
best to use PNG since you’re gonna downscale it and JPEGs has lower
quality and artifacts, depends of the quality that an applications will
encode it to.
My conclusion is this is our alternative to do
better anti-aliasing on MMD Ray to have better quality. It currently
doesn’t have its internal downsampling or is compatible with traditional
MMD AA or Video Driver’s AA. I prefer doing 4x on videos if I have to
wait for video rendering. What I noticed in this image is that bloom
effects scale differently on higher resolutions, because the bloom on
the models are smaller, but the white lights around the screen have
larger blooms.
If you are not using Ray shader and either using
your driver’s Supersampling, or stuck with MMD’s AA, and if you want to
get rid of small aliasing as possible, 4x Downsampling should do the job
if you decide to do that, especially for photo editing.