Author Topic: Splitting Render into Smaller Tiles (3ds Max) - Best Practices?  (Read 13013 times)

2015-09-01, 14:31:43

Nate101

  • Active Users
  • **
  • Posts: 33
    • View Profile
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:
  • To test my script, I am taking a simple 768x512 pixel rendering and splitting it into six 256x256 pixel tiles (3 columns x 2 rows)
  • I am using the #crop functionality in maxscript and saving the output as .tifs
  • My script calculates the “top left” and “bottom right” pixel coordinates for each tile as illustrated below:


The script works as expected, except when I try to reassemble the tiles I get noticeable seams (see below in red box):
 

 
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:
 

128 Pixel Overlap:

 
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:
  • I’m using Alpha v6 right now (but will definitely buy the most recent version if I can get this working)
  • I’m just rendering on one machine at the moment (this isn’t a backburner related issue)
  • Using bucket rendering, quality settings are generally set very low at this point
  • As mentioned, I’m saving the images as TIFs so I don’t think the seams are the result of compression artifacts
« Last Edit: 2015-09-01, 14:35:46 by Nate101 »

2015-09-01, 15:23:33
Reply #1

juang3d

  • Active Users
  • **
  • Posts: 639
    • View Profile
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.

2015-09-01, 15:51:45
Reply #2

pokoy

  • Active Users
  • **
  • Posts: 1640
    • View Profile
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.

2015-09-01, 17:26:55
Reply #3

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 9046
  • Turning coffee to features since 2009
    • View Profile
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
Rendering is magic.
Private scene uploader | How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2015-09-01, 18:20:09
Reply #4

juang3d

  • Active Users
  • **
  • Posts: 639
    • View Profile
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!

2015-09-01, 18:44:42
Reply #5

Nate101

  • Active Users
  • **
  • Posts: 33
    • View Profile
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.
« Last Edit: 2015-09-01, 18:57:03 by Nate101 »

2015-09-01, 19:18:32
Reply #6

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 9046
  • Turning coffee to features since 2009
    • View Profile
ok, can you try to make the mismatch as large as possible, and report it as a bug?
Rendering is magic.
Private scene uploader | How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2015-09-02, 10:18:58
Reply #7

Frood

  • Active Users
  • **
  • Posts: 1704
    • View Profile
    • Rakete GmbH
[... ] 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 :)


« Last Edit: 2020-01-09, 13:59:06 by Frood »
Never underestimate the power of a well placed level one spell.

2015-09-11, 14:11:53
Reply #8

Nate101

  • Active Users
  • **
  • Posts: 33
    • View Profile
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):



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).
« Last Edit: 2015-09-11, 14:28:59 by Nate101 »

2015-09-11, 19:24:37
Reply #9

Frood

  • Active Users
  • **
  • Posts: 1704
    • View Profile
    • Rakete GmbH
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!
Never underestimate the power of a well placed level one spell.

2015-09-13, 10:07:08
Reply #10

Nate101

  • Active Users
  • **
  • Posts: 33
    • View Profile
Anyone know how to "erase" the Corona frame buffer via maxscript (the button the red arrow points to below)?


2015-09-13, 12:28:57
Reply #11

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 9046
  • Turning coffee to features since 2009
    • View Profile
currently not possible, I will add support
Rendering is magic.
Private scene uploader | How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2015-09-13, 18:09:36
Reply #12

Nate101

  • Active Users
  • **
  • Posts: 33
    • View Profile
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


Tile 2


Tile 3


Tile 4


Tile 5


Tile 6


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:



Maybe there is another way to do that?
« Last Edit: 2015-09-13, 18:27:11 by Nate101 »

2015-09-13, 19:41:17
Reply #13

Ondra

  • Administrator
  • Active Users
  • *****
  • Posts: 9046
  • Turning coffee to features since 2009
    • View Profile
there will be a way in the next daily - check "clear VFB inbetween renders"
Rendering is magic.
Private scene uploader | How to get minidumps for crashed/frozen 3ds Max | Sorry for short replies, brief responses = more time to develop Corona ;)

2015-10-07, 11:24:35
Reply #14

CiroC

  • Active Users
  • **
  • Posts: 506
    • View Profile
    • Portfolio