Hi to all community.
I'm recently experimenting with blender technics about line rendering from Lino Grandi (https://www.youtube.com/watch?v=HUHF2KWAyQQ&t=736s)
and pattern rendering from these 2 tutorials. (https://www.youtube.com/watch?v=508pwYME-w4&t=265s https://www.youtube.com/watch?v=2ZR5XIjBmho&t=940s)
The goal is to create a shader that will react to the light direction. I run into some problems and I hope someone can help me.
First I will show you some of my early work. In the beginning, I was using a specular ramp in the toon shader but it didn't behave as I want.
The toon ramp just changes the opacity of the patterns, not their thickness.
These are examples:
https://www.dropbox.com/s/9c1iexsseu1poau/08.png?dl=0
https://www.dropbox.com/s/snjkxqp0h9yy0rz/09.png?dl=0
https://www.dropbox.com/s/ulstnpv0kmwge75/10.png?dl=0
https://www.dropbox.com/s/es8pn8n1fgs33se/11.png?dl=0
https://www.dropbox.com/s/sqpe51zm0anzmjs/12.png?dl=0
I also experiment with Dirt node as a mask for specular and roughness:
https://www.dropbox.com/s/z8uax7pmdsoalrw/16.png?dl=0
https://www.dropbox.com/s/g65wv0dutgw6m19/13.png?dl=0
https://www.dropbox.com/s/b1wy4y3g5kigezk/14.png?dl=0
https://www.dropbox.com/s/g8abnq9oe9mfguw/15.png?dl=0
https://www.dropbox.com/s/95xyi4e13cu9e1v/17.png?dl=0
https://www.dropbox.com/s/8vw8x8zf5qlzvvh/18.png?dl=0
But it still doesn't produce the expected results with line and dots behavior. But it works with complex scenes and animated characters.
Then I thought I might use a compere node with some patterns that have values from black to white and gradient based on light direction.
But in Octane, there is no node like in blender (Shader to RGB) so I found an OSL Shader MAlightvec.osl and The shader description says it doesn't work.
To overcome the problem I change the axis point of the object to the position of the light and it starts working but only with static objects and static light.
https://www.dropbox.com/s/95e3xsitjgtl7xz/01.png?dl=0
https://www.dropbox.com/s/jfkftwoet704mei/02.png?dl=0
My second thought was to get Shadow or Light illumination information to the vertex map and use it in the comper node. Like in this C4D plugin (https://cinemaplugins.com/c4d-plugins/t ... rtex-maps/) but this plugin doesn't work in C4D 2023. So with help of Dr. Sassi from cinevercity I was able to use Plight to get this illumination information.
but in one case it works with changing the position of the object but doesn't work with rotation or the opposite. But the results are the best. And it doesn't work with complex meshes and scenes, because it has to calculate the normal of a vertex.
https://www.dropbox.com/s/u798z52iw24464c/19.png?dl=0
https://www.dropbox.com/s/c6v0l4jx195f2em/20.png?dl=0
https://www.dropbox.com/s/nrrqycxd1rimvpd/21.png?dl=0
and dynamic light render
https://www.youtube.com/watch?v=-w2yPYcm8SY
Now I hit the wall because this technique can't be used in complex animated scenes.
Finally my question:
Is there a way to get this gradient ramp based on the light direction in Octan inside Cinema 4d? Maybe someone has an idea of how to fix that OSL shader?
Thank you for all your help.
All the best
Michal