Author Topic: Vector masks - is it possible?  (Read 7080 times)

2018-01-10, 15:26:54

Rimas

  • Active Users
  • **
  • Posts: 156
  • Please refer all complaints to a brick wall nearby
    • View Profile
Hi, guys,

Happy new year!

I have a question: Is it possible to render out/save vector masks?

Essentially we have a client that needs a bunch of product renders, but with the images they also need masks of various parts so that they can recolor things on-the-fly in their web engine. They want the masks supplied in a vector format for their use.

So far I figured I'd render out a stupid resolution image with B/W masks and vectorize those in Illustrator - and that works for the most part, but it breaks in places of small detail - no matter how I adjust the trace settings some small details just get lost no matter what (or sorta appear back, together with an exaggerated stair-step and waviness effects which were never in the original image) - you'd think that Illustrator could pick up the details I can easily see with my eyes...

So I was wondering if there was a way to extract vector outlines out of Corona (or MAX, for that matter) to use as a mask?

Thanks!
A morning of awkwardness is far better than a night of loneliness...

2018-01-10, 16:08:00
Reply #1

NicolasC

  • Primary Certified Instructor
  • Active Users
  • ***
  • Posts: 539
  • CG supervisor / teacher / artist
    • View Profile
Hello,

If I understand you correctly, the only tool able to do vectors output from 3dsmax is finalToon from Cebas. Maybe worth giving it a try.
Check this: https://youtu.be/gr3be4uKCUc
Nicolas Caplat
CG supervisor / teacher / artist

2018-01-10, 16:37:38
Reply #2

pokoy

  • Active Users
  • **
  • Posts: 1983
    • View Profile
I believe mental ray had an outline shader that would be used on the camera and was able to save out vector formats. It's only a glimpse of a memory though so look it up on the net, and would work only in versions prior to Max 2017 only.

2018-01-10, 18:13:11
Reply #3

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
Hi. I'm pretty sure that the mr outline could not be output to vector directly (spent a looooong time to try to find a solution for this some years ago). AFAIK finalToon is the only tool that can do this ATM, but it would be really nice if Corono took up the challenge :)

2018-01-10, 18:21:41
Reply #4

iancamarillo

  • Active Users
  • **
  • Posts: 282
    • View Profile
May be worth looking into Illustrate by David Gould.
http://www.davidgould.com/

2018-01-10, 19:19:46
Reply #5

sprayer

  • Active Users
  • **
  • Posts: 803
    • View Profile

2018-01-10, 21:16:09
Reply #6

PROH

  • Active Users
  • **
  • Posts: 1219
    • View Profile
Thanks for the link sprayer. I tried it a couple of years ago without any luck (hence my earlier post), but today I found out how to make it work! What's missing from the tut (due its age) is that "sampling mode" in the renderer setup must be set to "classic".

Thanks :)

NB - my test was done in max2014

2018-01-11, 11:58:10
Reply #7

Rimas

  • Active Users
  • **
  • Posts: 156
  • Please refer all complaints to a brick wall nearby
    • View Profile
Thanks for the ideas, guys, but these methods won't be accurate enough for my needs, I'm afraid. I literally need a mask outlined and filled, so random toon lines, even if vector, will require too much manual work to be a viable way to do it on a job like this (it's a volume job - will need to process hundreds of these masks!).
Also, MR has been discontinued and I use MAX 2018 - sure as hell am I not downgrading for one job :D

Apparently Illustrator uses a low-res proxy internally past a certain resolution to trace, which explains why increasing the image res gave me same/worse tracing results. Cropping in on detail gave me a perfect trace, but that means I'd need to split each image into 6-8 tiles just to trace, which means merging the vector mask tiles back into one piece somehow - again, not viable as a volume job.

The workflow I ended up with (and I hope it helps someone later on here) is as follows:

1) Render all the files in bulk using backburner at a fairly large res
2) Separate the masks into a folder and run that trough a neural network upscaler at 4x res. This one runs on my GPUs on CUDA, so takes very little time to upscale the images. But it's important to use this instead of Photoshop to keep sharp lines!
3) Batch action: Open the mask images in Photoshop, select white and make a mask. Convert the pixel mask into a path using a 2px tolerance (this is where the upscale was important - without a fairly large tolerance the path ends up wavy, but at a larger tolerance I'm losing detail. At 4x the res I can afford to round off to 2px and keep the detail!). Downscale the file back to 25%. Save the path as an .ai file. This is executed automatically in bulk once I've set up an action.
3) Action, but executed manually (Illustrator is retarded - no batch processing!): Open the .ai files in bulk in Illustrator, making sure to keep the original pixel proportions of the mask file (there's a tickbox - important so that the vector mask is in the same place as it should be when overlaying the raster renders!). An action is set up to select all lines, release compound path, then select all again and make the compound path (this is important because the automatic compound path is wrong at first), then select the resulting path and fill with black (as required by client), then save file. So for this I need to essentially open any of the bunch of tabs and go "Play action > CTRL+F4 (close tab) > repeat" - sounds bad, but would only take me a minute or two for 100 files!
4) Open all the files in Illustrator again and go scripts>SaveDocsAsSVG - all files get saved as SVG files in a given location.

Sounds like a bit of work, but it really isn't, surprisingly, just need to set up all the actions and run them. Sure beats processing hundreds of masks manually. Though it would be even faster if Corona could save a vector mask *nudge nudge, wink wink* :) (or if Illustrator wasn't retarded and using a low-res proxy to trace....)
« Last Edit: 2018-01-11, 12:04:20 by Rimas »
A morning of awkwardness is far better than a night of loneliness...

2018-01-11, 14:24:46
Reply #8

sprayer

  • Active Users
  • **
  • Posts: 803
    • View Profile
can you explain why your client need vector and can't use raster mask what can be made with wirecolor and photoshop.

As 3ds max output of rendering is only raster, maybe you can dig in this method - to make automatically(somehow) outline of object with spline and export as vector

2018-01-12, 10:59:27
Reply #9

Rimas

  • Active Users
  • **
  • Posts: 156
  • Please refer all complaints to a brick wall nearby
    • View Profile
As I originally mentioned in the 1st post, the clients use a web system where they can pick SVG elements for various parts and recolor them on-the-fly in the browser. Useful for product selections where multiple colors have to be made. That way I only have to render and produce overlay files for details and shadows and they can do color changes for various elements themselves as and when new options become available and old ones are phased out. Saves me rendering hundreds of variations too. You can't exactly do that with raster files as quickly. Plus it saves on memory and download bandwidth.
« Last Edit: 2018-01-12, 11:19:16 by Rimas »
A morning of awkwardness is far better than a night of loneliness...

2018-01-12, 11:42:14
Reply #10

sprayer

  • Active Users
  • **
  • Posts: 803
    • View Profile
There will be not much difference in memory comparing raster mask with one color and detailed vector file. Also raster images have more options to change color in java as i know. And making manual vector mask is a pain, also will be not perfect as you think at first.

Maybe you can try do render mask(wire color) with more contrast colors for vectorization. Can you share picture for vectorization i wanna try? =)

2018-01-12, 13:29:55
Reply #11

Rimas

  • Active Users
  • **
  • Posts: 156
  • Please refer all complaints to a brick wall nearby
    • View Profile
You seem to have ignored what I wrote two messages up, mate xD

I've already got an automatic workflow. Will only take me a few minutes to vectorize a hundred of masks at good accuracy :)

Plus I'm in no place to tell client to change their infrastructure because someone somewhere thinks rasters are better, that would be daft xD
A morning of awkwardness is far better than a night of loneliness...

2018-01-13, 00:04:28
Reply #12

mferster

  • Active Users
  • **
  • Posts: 525
    • View Profile
Since we've already established that we can't use corona to make your vector masks....

I don't know about you, but I personally have found photoshop is better at making vector masks compared to using illustrator's live trace.

1. Select > color range > select your black or white in your mask> change fuzziness to 200

2. go to paths panel > Alt left click the "make work path from selection" button > set it 0.9 pixels

3. File > export paths to illustator

I'm curious to know if the workflow I've used before gives you a better result than you are currently getting! If it works out,  then you can do all the steps in a recorded action and automate batch all your masks.

2018-01-15, 09:19:23
Reply #13

Rimas

  • Active Users
  • **
  • Posts: 156
  • Please refer all complaints to a brick wall nearby
    • View Profile
Since we've already established that we can't use corona to make your vector masks....

I don't know about you, but I personally have found photoshop is better at making vector masks compared to using illustrator's live trace.

1. Select > color range > select your black or white in your mask> change fuzziness to 200

2. go to paths panel > Alt left click the "make work path from selection" button > set it 0.9 pixels

3. File > export paths to illustator

I'm curious to know if the workflow I've used before gives you a better result than you are currently getting! If it works out,  then you can do all the steps in a recorded action and automate batch all your masks.

I don't know if my message was invisible or if people just don't read, but I've already established this exact workflow. It's all there in post #7 xDD
Just that I need to do extra upscaling/downscaling steps and set the path conversion tolerance to 2px in Photoshop to prevent waviness :)

Usually illustrator does the job very well with smaller files, but it seems to add too much pre-processing/downscaling where totally unnecessary at higher resolutions, which makes it totally useless at that point.
A morning of awkwardness is far better than a night of loneliness...

2018-01-15, 17:10:34
Reply #14

mferster

  • Active Users
  • **
  • Posts: 525
    • View Profile

I don't know if my message was invisible or if people just don't read, but I've already established this exact workflow.

Hahaha, Wow you are exactly right, I'm a tool. I somehow totally missed that message you posted. My bad, hahah.