Chaos Corona Forum

Chaos Corona for Cinema 4D => [C4D] General Discussion => Topic started by: Br0nto on 2018-11-14, 19:34:33

Title: Layering Alpha Channels with Different Mappings
Post by: Br0nto on 2018-11-14, 19:34:33
I'm trying to fake some headlight fog with a series of layered shaders. First, I have a layered material that contains a white diffuse/fresnel opacity shader, with an additional opacity gradient on top to make it fade out as it leaves the headlights. This part works fine:

(https://i.imgur.com/gFmRLRk.jpg)

However, I also want to add a fade just as it touches the road to avoid a hard transition. The trick is that it needs a separate mapping, since the cones are using a cylindrical map and I need to do a flat map to align with the road:

(https://i.imgur.com/EmDtNRG.jpg)

The problem I run into is that I don't know how to combine these two together in a way that merely adds the second alpha fade to the original headlight layered shader. I tried making it a second material tag mixed on top of the first, but that only gave me stuff like this:

(https://i.imgur.com/ldMXu4V.jpg)

Any ideas? Thanks!
Title: Re: Layering Alpha Channels with Different Mappings
Post by: romullus on 2018-11-14, 20:21:11
3ds Max or C4D?
Title: Re: Layering Alpha Channels with Different Mappings
Post by: Br0nto on 2018-11-14, 20:21:40
Oh, sorry, Cinema 4D R19, with Corona B2 (core 3).
Title: Re: Layering Alpha Channels with Different Mappings
Post by: davetwo on 2018-11-15, 23:35:26
Try C4Ds native projection shader
Title: Re: Layering Alpha Channels with Different Mappings
Post by: Beanzvision on 2018-11-16, 10:44:23
Have you tried the volumetric material?

(https://forum.corona-renderer.com/index.php?action=dlattach;topic=22417.0;attach=93737;image)
Title: Re: Layering Alpha Channels with Different Mappings
Post by: Br0nto on 2018-11-16, 20:57:12
Try C4Ds native projection shader

That did the trick, thanks!

(https://i.imgur.com/pBIPonl.jpg)

(https://i.imgur.com/XyBRw0N.jpg)


Have you tried the volumetric material?

I tried that first, but this particular scene has some quirks that prevented it from working as expected. Ideally, the headlights would be a light that matches the shape, and then that would illuminate the volumetric shader and fade as it leaves the light. However, these headlights are made up of a bunch of individual lights to get the reflector look correct, plus separate beams for the road illumination and an IES for the light bleed. The resulting illumination was quite unnatural looking.

When it became evident I couldn't use "realistic" in-scene lighting for the fog, I tried a slight bit of emissive light on the volumetric shader. That had the problem of not fading as it left the light, and I couldn't find a way to fade it out with distance. The emissive light also started shining back on the car, which I probably could have fixed with a corona compositing tag had I continued down that road.

In the end, the subtle faked effect is very adjustable and I can use gradients to fade it at whatever angles I need. The fresnel properties also fade it out automatically as the camera moves in front of the car, to prevent visible edges.

Thanks!