Shadow to Vertex map
Michal Rodzinski last edited by Dr. Sassi
Is there a way to transmit shadow information from a light source to vertex map? Phyton or expresso?
Like in this plugin:
But this plugin is unsuported in cinema 4d 2023.
I need this to create shader inside Octan.
I tried this method:
but it’s not working as I expected. It illuminates the entire object if it’s in the light range.
Thank you for your help.
Yes, the solution with the R18 file was based on the idea of what is hit by the light, which is more or less like what can be done with a Cone Field if a spotlight is in use. In other words, that was not render-based.
Shadows are not that simple, as they can be based on several things. Be that as it will, shadows are render based.
If you like to have that shadow in a Vertex Map, I suggest baking the object's texture (Illumination) and using that in a Shader Field inside the Vertex Map.
Example, baked and applied:
What options are available in getting Shadow Data from a node is not my expertise, as I don't have an Octane license.
All the best
Hi Dr. Sassi,
Thank you for your quick reply.
I have another question based on firestone. I will also post some screenshots to make it clear.
I'm trying to replicate the shader from Cinema 4d standalone Halfton pattern. In this shader, you can set the gradient ramp dependent on the camera or light source to get shading.
where is a shadow the dots are bigger and where is light they get smaller. there is of course node (in Octane) "toon ramp" but it can be plugin only in two places
and you can't use it as a gradient mask to set the size of the dots. The dots just decrease opacity but not size. As in this example:
Think I'm close. I was able to fake that using OSL Shader which supposes to get a light vector but it didn't work.
It can only give an object normal based on position so I move the axis point of an object to the position of the light.
And It works but only if the object and light are static.
I need it to be dynamic. So baking is not an option.
We're getting to the point where I thought vertex map could save me.
Your method from the topic https://www.cineversity.com/forums/viewthread/2374/ is promising but I have one last question
Can you set the vertex map so that if the point normal is between 0-90 degrees to the light source the vertex is 100% strength and if the angle is from 90 - 180 degrees the strength of the vertex map is 0%
I hope my English is sufficient to make it clear
What I was able to do is to set the linear fall of the light to get this effect but of course is not working with complex scenes. And it's working more like a 3d linear gradient that you can set manually.
All The best
To keep the forum readable, new questions need to have a new thread; otherwise, it becomes an endless text. Thanks for considering this in the future.
I'm unfamiliar with OSL shaders in Octane; as I mentioned, I have zero access to Octane. Perhaps check any related Octane Forum.
You can bake an image sequence and use this. My understanding of the target here is a rendering. In that way, most parts inside a project can be backed, cached, or expressed somehow.
A Vertex Map has no idea about its Normal direction, nor is there anything that defines the position inside of a given Vertex Map.
This needs to be taken from the Point Position and the Light Position. But what happens if one uses a Normal Map? The orientation changes at that moment. A few variables need to be known first to find (perhaps) a solution, but it is more complete than that.
This is not a straightforward situation. Think about Area lights, parallel lights, different shadow qualities with their edge definitions, etc., not even think how a few lights in concert will work.
All the best
I will post new questions in new threads in the future. sorry for the mess.
Thank you for your time explaining what is possible.
Thanks for understanding, Michal.
(No need for any sorry here, but thanks for the thought.)
I believe we like to find something when we go to any forum. I try to make it as easy as possible for anyone.
BTW, have you tried to place the camera as a child of light (same position, etc.), so a Fresnel Shader will show the angle of the surface and how it changes? This can be backed, even as animation. Then you have the data.
Note that the "Use Camera Vector" is enabled; Fresnel needs that.
Have a nice weekend.
You're welcome, Michal.
Enjoy your weekend as well.
P.S.: I hope this helps a little bit, as these are the closest I can find that brings shows some surface angle into the game to create a specific result.
I solved my problem getting "shadow to vertex map"
It's not perfect but it is in real time and that's enough for me for now.
I modified a little bit of your expresso and connect point normal to plight normal.
I hope it's not a bug
Thank you for all your help
I will test it with a shader and post some results.
Hi Michal Rodzinski,
Yes, that is an option for self-shadowing to a certain degree.
The Normal of a Plane point will be 0, 1, 0 even if you take the object axis and rotate the object.
The Normal direction inside of a hole (e.g., Donut) might have Normals that point to the light but would receive shadow from itself.
The Normal idea is excellent if these limitations are not in the way.
Also, this is not an option to evaluate the received shadow from a different object.
I would say it is the way it works, not a bug.
Anyway, I hope that works for you.
Hi Dr. Sassi,
I want to share what I have done with the vertex map technique and resolve one problem with this solution.
What I have now is for my sufficient. I think I don't need complex self-shadowing because as you can see in the example there is a solid black toon shadow,
that covers this area of the model.
But there is one problem.
There are two options connecting to Plight
- if from node "Point" I connect Point normal to Normal in Plight - Light rotation is working, moving object is working, rotating object is not working;
- if from node "Point" I connect Point position to Normal - Light rotation is working, Moving object is not working, rotating object is working;
and in both cases, deformers don't work.
here is a screen capture:
https://www.dropbox.com/s/nvckyml24lzzjj8/Desktop 2023.02.10 - 13.01.34.01.mp4?dl=0
this is the moment I hit the wall - is there any solution to resolve this problem?
I'm asking because I will use it on animated characters.
thank you for all your help
All the Best.
Hi Michal Rodzinski,
The idea is to rotate the points around the axis but not the axis itself.
The position of each Point is based on the Object Axis. With this, the Normal is a Local idea. So you need to rotate the "surface" but not the axis. How to do that? Rotate Point from the X-Pool>System Presets> Matrix in XPresso.
I have marked what can be moved and what can be rotated. Any derivation from that and the system is broken.
The "surface" can now be rotated or moved" while the Vertex Map is focused on the light source.
Since I have no file here, and screen capture nor images tell me that, I can only suggest/guess that you had in the Point Node, not the "Use Deformed Points" checked on.
With that knowledge, you might use the Cluster Object to rotate the points around, while the Object that rotates the Point is a child of the Object, so it stays at Position 0, 0, 0.
My best wishes