anderslanglands / alShaders2

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

Texture Mattes? #11

Open noizfactory opened 7 years ago

noizfactory commented 7 years ago

This is not an issue per se but logging this here for easier tracking.

We currently use an internal passthrough shader for all texture based mattes (on top of the automated cryto mattes) but I was wondering if it was possible to somehow also use crypto for this. I don't see anything in the original specifications for this but the user stuff in the new shader leads me to think something could be hacked with crypto now?

acjones commented 7 years ago

This is definitely something we've been talking about lately. There are actually 2 sides to this. The first part, which I think is what you're talking about, is to support Cryptomattes in which the IDs are coming from "control maps" used in texturing. We had a show not too long ago that ran out of matte channels even in alSurface, and really got us talking about this. There are two things we'd need to do as a bare minimum:

1) Make a shader that converts an array of floating point inputs into Cryptomatte-encoded ID/coverages, and stores them in Cryptomatte AOVs from the shader.

2) Make the filter support multiple Cryptomatte layers per sample. (Currently it just assumes one ID/Coverage pair per sample).

(Incidentally, in addition to control maps, these changes will lay the groundwork for supporting things like reflected/refracted Cryptomattes. However in order to finish that feature, we will need to explore what's possible in terms of integrating matte contributions from secondary rays in Arnold 5).

Part 1 kind of highlights the other aspect of this, which is that it would be interesting to look into using Cryptomatte-encoded control maps as textures ("Cryptomaps?"). It may not be the perfect thing for all types of control maps, but I think it could provide a really interesting scale-able way to perform "soft" material assignments (as opposed to having a material per-object or per-primative, with mixing done with ad-hoc layering nodes in a shader graph). A switch to this sort of paradigm would no doubt require some research and a fair bit of back and forth with users, but I think it's a really interesting avenue for exploration, and is something we're actively looking at.