anderslanglands / alShaders2

BSD 3-Clause "New" or "Revised" License
75 stars 38 forks source link

C4DtoA bugs #10

Closed jrwg closed 7 years ago

jrwg commented 7 years ago

Hi, I'd like to report some bugs I noticed when using alShaders-win-2.0.0-ai5.0.1.0 with C4D.

Bug 1: crypto_material fails when applying an Arnold Object Mask Tag to a parent node. snapshot 206

Bug 2: crypto_material fails when there are stacked materials, even if the left materials have no effect on the render. snapshot 207

jonahfriedman commented 7 years ago

Hi jrwg, thanks for reporting.

I'm unfamiliar with Cinema 4D, but we'll see what we can do to fix this. To do that I need to see what happens under the hood in Arnold. Could you export both these scenes as ass files, and attach them?

It'd help if things were named/structured exactly like your examples so we can know exactly what we're looking at.

SenH commented 7 years ago

I can confirm issue 1. The reason is that the object mask tag internally creates an aov_write_float shader which has the beauty material attached as passthrough. The child objects are seen from Cryptomatte's perspective as a single material since the aov_write_shaders are named null and we strip off the root node name.

@jonahfriedman Some info about C4DtoA object mask tag and ass file crypto_objectmask.zip https://support.solidangle.com/display/A5AFCUG/Object+Mask @jrwg I'm curious. What's the reason to use additional object masks when you have Cryptomatte?

Can you clarify how Cryptomatte fails in issue 2? Not sure if I can reproduce it. crypto_stacked_materials @jonahfriedman More info about material stacking in C4DtoA and ass file. crypto_stacked_materials.zip https://support.solidangle.com/display/A5AFCUG/Arnold+Shader+Network#ArnoldShaderNetwork-Materialstacking

SenH commented 7 years ago

This stripping of the material root node name should only happen in my branch, maybe we should change that. Peter is going to check the naming of all objects generated by C4DtoA after 2.1 release so we could fix this also by changing the AOV shader name null to beauty material.

jonahfriedman commented 7 years ago

Thanks Sen, as always. The pass through insertion is what I suspected.

I was thinking, we could have a list of shaders that are known to be pass throughs that perhaps we should look through to get at the thing that we actually want. However, I saw that in this scene the shader that is linked to there is called c4d|3|flat. That doesn't look like a useful name either. Is "3" the name of the material or just an index given by the exporter? Are materials in c4d usually named by the user?

jrwg commented 7 years ago

@SenH For issue 2, I think if you check your two blue cubes you'll find that they are actually different colors, so yes, crypto_material does fail with stacked materials.

In addition to the two issues mentioned, there is a third bug/issue: crypto_material will fail if the object is a polygon object with no uvw tag and you apply the material from the material manager. However, crypto_material will work if you copy over a material from another object.

As for why I use an object mask tag in addition to crytomatte, I render still images of products. If I want to remove the background, the object mask will create a black/white image layer in Photoshop with which I can create a high quality antialiased mask to separate the product from the background. I've not found a way to extract a high quality mask from a "clown pass" which crypto_material/object is, although it's very good for quick compositing work.

Lastly, I have a question. I prefer to render to a PSD file with these layers: Beauty, crypto_material, crypto_object and the object mask for the entire product. However, there seems to be no way to get the beauty layer unless I add RGBA image from Multipass in the render settings, which seems wrong. Is this correct? Also, a layer called alpha is automatically added, is there a way to prevent that?

Thanks.

jonahfriedman commented 7 years ago

@jrwg

In addition to the two issues mentioned, there is a third bug/issue: crypto_material will fail if the object is a polygon object with no uvw tag and you apply the material from the material manager. However, crypto_material will work if you copy over a material from another object.

We're going to need an ass file of that too if we're going to investigate.

Lastly, I have a question

This doesn't seem like a Cryptomatte issue. (Also FWIW sounds normal to me)

SenH commented 7 years ago

Is "3" the name of the material or just an index given by the exporter?

It's the name I gave.

Are materials in c4d usually named by the user?

That's correct and C4D allows for identically named objects and materials in its manager but it's not always consequently handled in the C4DtoA translator. For example, identically named materials end up as one in crypto_material. Objects are generally suffixed with an index. I think this can also be considered as a feature and it's up to the user to come up with unique naming (which mostly is the case with materials).

@SenH For issue 2, I think if you check your two blue cubes you'll find that they are actually different colors, so yes, crypto_material does fail with stacked materials.

That sounds right to me. Internally Arnold creates a different material for stacked materials in C4D because that's the only way to support this feature..

I've not found a way to extract a high quality mask from a "clown pass" which crypto_material/object is,

It's certainly possible to extract perfect anti-aliased mattes but you have to use a decoder which currently exist for Fusion and Nuke. I doubt that using Cryptomatte as a clown pass in PS will get you any useful results.

jonahfriedman commented 7 years ago

Closing this. If stacked materials were to work differently, I think the C4dtoA devs would need to get involved.