Author Topic: Multishader multipass masks?  (Read 285 times)

2024-04-16, 17:00:43

TeoRossi93

  • Active Users
  • **
  • Posts: 129
    • View Profile
Hey guys, is it possible to have a black/white mask for different colors in multishader material?
Like, I need a mask for the diamonds attached here, and a separate one for the emeralds.
Matteo Rossi 3D - https://www.teorossi.it/

2024-04-17, 16:08:32
Reply #1

Beanzvision

  • Corona Team
  • Active Users
  • ****
  • Posts: 3873
  • Bengamin
    • View Profile
    • Cormats
Hi, would create 2 materials and give them each a material ID from the Advanced settings in the material. Scatter 2 objects and assign each a different mat. In the multipass settings, make 2 masks and enable Material ID and give them the same number as the materials. Render and you will have a different alpha for each. Here's an example.

Bengamin Jerrems l
Portfolio l Click me!

2024-04-18, 10:55:44
Reply #2

TeoRossi93

  • Active Users
  • **
  • Posts: 129
    • View Profile
Hi, would create 2 materials and give them each a material ID from the Advanced settings in the material. Scatter 2 objects and assign each a different mat. In the multipass settings, make 2 masks and enable Material ID and give them the same number as the materials. Render and you will have a different alpha for each. Here's an example.



Hi Bengamin,

thanks for the answer but unlickily this is not gonna work with my current animation setup.
I'm attaching my scene here so you could have a look at it. I can't change the rig at the moment, the only chance I have is to make the multishader masks work properly.
Matteo Rossi 3D - https://www.teorossi.it/

2024-04-19, 15:19:07
Reply #3

Beanzvision

  • Corona Team
  • Active Users
  • ****
  • Posts: 3873
  • Bengamin
    • View Profile
    • Cormats
Hi there, this should work. Here's another sample scene. I have my objects in the cloner, each object has a comp tag with it's own object ID, a material using the mutli-shader (set to object ID) and then two masks in the multipass settings. Each mask also has Object ID enabled. If this works for you, maybe this can be applied to your scene as well?
Bengamin Jerrems l
Portfolio l Click me!

2024-04-22, 11:25:07
Reply #4

Stefan-L

  • Active Users
  • **
  • Posts: 515
    • View Profile
a multi material woudl be really great. similar tot he multi shader, or layered material. where one can add materials and use them similar as the multishader (assignment by different random or cpntroled menthods)

2024-04-23, 10:02:52
Reply #5

TeoRossi93

  • Active Users
  • **
  • Posts: 129
    • View Profile
Hi there, this should work. Here's another sample scene. I have my objects in the cloner, each object has a comp tag with it's own object ID, a material using the mutli-shader (set to object ID) and then two masks in the multipass settings. Each mask also has Object ID enabled. If this works for you, maybe this can be applied to your scene as well?
Hey Bengamin, unluckily I can't do like this. I must keep the animation setup as I did since in my scene there's a lot of stuff going on and I should keep the rig as you saw in my file...
What Stefan suggests would be great tbh
Matteo Rossi 3D - https://www.teorossi.it/

Yesterday at 17:21:16
Reply #6

bnji

  • Corona Team
  • Active Users
  • ****
  • Posts: 195
  • Benjamin
    • View Profile
    • Corona Renderer
Hello there,


I'm sorry you had to deal with this. There's a nice solution for this...
If you're using a "Multishader", you can use the same shader for the Multipass to get a "Mask" according to the shader colors.
If you're only using 3 colors for the Multishader, you can copy the Multishader from your material, then use a "Texmap" in the Multipass window and paste it right there; last thing, set the Multishader colors to use R, G, and B colors respectively, this way you can get an RGB mask.
If you prefer, you can use several/different "Texmap" elements in the Multipass window, copy/paste the Multishader, and set colors to use B&W but only one at a time; I mean, If you're using 4 colors for the Multishader, you can set the first color from the first copy of the Multishader to white, and the rest set them to black color; then, use a new "texmap" Multipass and paste the same Multishader, but this time, set the second color to white, and the rest to black.
I know this is not perfect, but it will provide you with a solution that works.
I'm including the sample file (using your previously submitted file) to illustrate this.
Quick note: Don't forget to enable the "Ignore background" option for the "Texmap" Multipass.
I hope this helps.
Looking forward to hearing from you.
Have an amazing day/weekend.
Benjamin Rosas | chaos-corona.com
3D Support Specialist - Corona | contact us
Corona Uploader l Upload