Chaos Corona Forum

Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: Nate101 on 2015-09-01, 14:31:43

Title: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Nate101 on 2015-09-01, 14:31:43
Hi all, new to Corona and loving the product so far.  I’m currently working on a maxscript that breaks a render into smaller tiles, and have come across some minor issues:
(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/TileIllustration_zpsn0mcjzvt.jpg)

The script works as expected, except when I try to reassemble the tiles I get noticeable seams (see below in red box):
 
(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/0Illustration_zps2vtv0ush.jpg)
 
So apparently this is a pretty common problem with distributed rendering, most sources say the solution is to create a 10-20 pixel overlap between tiles that gets trimmed away in post.  I've done that and although it helps a little, it doesn’t completely eliminate the problem, even with a 128 pixel overlap:
 
20 Pixel Overlap:
 (http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/20Illustration_zpsfcnpxdzq.jpg)

128 Pixel Overlap:
(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/128Illustration_zpsovywmfet.jpg)
 
Curious whether anyone knows a workaround to this problem.  I’ve tried some minor tweaking to the render settings but still getting the same issues.  Is it better to use #region vs. #crop?  Are there render region controls native to the Corona VFB that work better for splitting the image?  Appreciate any feedback!
 
Some additional background:
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: juang3d on 2015-09-01, 15:23:33
The first thing I woudl try is to use render region instead of crop, I never liked crop too much, I'm not sure but maybe there is a camera related problem with crop because your seams seem to be related with the pictures not matching perfectly due to a different perspective, I may be wrong, but maybe crop is affecting that.

I think if you a render region, as long as you render the pieces up the the same sampling level, they should match perfectly, or near perfectly, I'm not sure if there can be any problem with the noise pattern, but it's a different problem than the one you show here.

Hope what I said makes sense :)

Cheers.
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: pokoy on 2015-09-01, 15:51:45
I remember there was a bug report where crop renders ended up in different lighting/reflections (not sure which but it rendered differently when rendered as whole frame). I had problems with a similar script that divided the frame using crop mode, not sure if the problem still exists in the latest versions of Corona. You may want to test this on v1.x so you don't run into issues when people actually start using it in production on v1 and above.

Love the idea for this script, I'd certainly use it. Both thumbs up here!

BTW, I can't see the images.
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Ondra on 2015-09-01, 17:26:55
I would prefer crop, as region still allocates the whole buffer and uses up much more memory. The shading differences could be from UHD cache, you can avoid it by precomputing and reusing it. Let me know if you find any definite geometric differences (such as edges not fitting together), there might of course be a bug
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: juang3d on 2015-09-01, 18:20:09
Ondra but the problem I see in those pictures is that the resulting picture is missmatching, you can see that in the floor for example, the lines of the texture are not correctly aligned, can this be provoqued by UDH?

Cheers!
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Nate101 on 2015-09-01, 18:44:42
Thanks for the quick responses guys.  I'm going to download 1.x and see if that makes a difference.  I'll also give region a try just to see what happens.  Of course, it could always just be an error somewhere in my script, I'll run some additional tests this evening.

I would prefer crop, as region still allocates the whole buffer and uses up much more memory. The shading differences could be from UHD cache, you can avoid it by precomputing and reusing it. Let me know if you find any definite geometric differences (such as edges not fitting together), there might of course be a bug

That was actually the first thing I thought of (although I'm using Alpha v6 so only HD Cache is available).  I also tried pathtracing the secondary bounces.  Neither reduced the appearance of the seams.
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Ondra on 2015-09-01, 19:18:32
ok, can you try to make the mismatch as large as possible, and report it as a bug?
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Frood on 2015-09-02, 10:18:58
[... ] Neither reduced the appearance of the seams.

Back in dark win32 ages with 2GB limit I found a very basic line of code, extended it and wrapped all into a Maxscript GUI. This script uses rendermode #blowup + region.

I don´t know who had this idea in the first place so I will provide the full script here for you and others.

I just checked it with corona and it seems to work. Haven´t used it since Win32 times so there may be improvements to do. I can faintly remember that I always had issues with standard #crop and for this reason changed to #blowup + region (I don´t think it´s a corona problem you have. What´s the result using scanline renderer?).

Restriction of the script is obviously that number of tiles x and y are always the same. So in your case you have to render 768x510 with 9 tiles.

Good Luck!



Edit: Attaching v2.21 where UI size cap is raised to 2^16 (65536). Will maybe revisit this in 10 years to set it to 2^17 :)


Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Nate101 on 2015-09-11, 14:11:53
Just wanted to give everyone an update.  Tried #region instead of #crop and it fixed the problem.  Oddly enough I had to add one pixel to the bottom right coordinate of each region as shown below (with a one pixel overlap):

(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/TileIllustrationRegion_zpsb6benana.jpg)

As others mentioned, I think crop just isn't the right tool for this kind of job (it is a max issue, not a corona issue).  Blowup sounds like it could be just what I need but I will have to modify my code a bit to test it out (my render has a 16:9 aspect ratio but my tiles must be square).
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Frood on 2015-09-11, 19:24:37
Just wanted to give everyone an update.

Thanks for this and not abandoning the thread. I´m very interested in the final result.

Good Luck!
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Nate101 on 2015-09-13, 10:07:08
Anyone know how to "erase" the Corona frame buffer via maxscript (the button the red arrow points to below)?

(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/EraseButton_zpsppbvgjtc.png)
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Ondra on 2015-09-13, 12:28:57
currently not possible, I will add support
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Nate101 on 2015-09-13, 18:09:36
currently not possible, I will add support

Thanks Ondra, I probably should have explained why I asked.  When I use #region to render my tiles they get saved cumulatively (ie you can see each previous tile that was rendered):

Tile 1
(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/Sequence0_zpshnthio1d.jpg)

Tile 2
(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/Sequence1_zpspcbzbjd8.jpg)

Tile 3
(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/Sequence2_zps7nv2iyfr.jpg)

Tile 4
(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/Sequence3_zpshsukww6a.jpg)

Tile 5
(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/Sequence4_zpsiuel2ryf.jpg)

Tile 6
(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/Sequence5_zpswala8atf.jpg)

I was looking for a way to clear the frame buffer after every render so that each image would have only one tile (like the first one in the sequence above).  For example, Tile 6 would look like this:

(http://i661.photobucket.com/albums/uu332/nfelle101/TileIllustration/Sequence5Fixed_zpsja43t0kn.jpg)

Maybe there is another way to do that?
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: Ondra on 2015-09-13, 19:41:17
there will be a way in the next daily - check "clear VFB inbetween renders"
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: CiroC on 2015-10-07, 11:24:35
Hi Nate101

Any news about this script? :D
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: naikku on 2015-10-12, 07:58:09
Two weeks ago I had to render a 17000x8000 pixel image for a client.
I was hoping that the rendering would be at +100 passes in the morning but it got to 30 passes.
I have 6 computers and only one could render it, other comps had crashed.
Title: Re: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?
Post by: harumscarum on 2021-05-17, 12:36:57
Edit: Attaching v2.21 where UI size cap is raised to 2^16 (65536). Will maybe revisit this in 10 years to set it to 2^17 :)
this script is amazing - thank you very much!
however, it would be great if it may support "Blowup + Auto Region Selected" mode which will allows to render top-views areas precisely

Thank you in advance!