#### Re: How can I store global variables one by one in an array?

Larry Gritz

Hi, sorry for letting this sit for a long time without a reply, but I'm still not sure I understand what you're trying to do.

If you are tracing rays in some order, when tracing one particular ray, you don't yet know where all the other rays (that you haven't trace yet) are going to hit. So you don't know when you're shading what all the other P's will necessarily be, if that's what you're trying to find out.

Are you asking for the vertices of the mesh of the geometry that you hit?

Are you just trying to find out which side of the surface a light is? The variable Ng should be the oriented surface normal, and you can compare that to the direction of the light to determine whether the light (or any other point) is in front of or behind the surface. Also dPdu and dPdv are the tangents of the surface at the shading point, and those can also be used to figure out the orientations.

On Mar 2, 2022, at 11:31 AM, トマトフライ <tomatofry.illust@...> wrote:

I know this is a silly thing to talk to a developer about.
I would appreciate it if you could share your wisdom.

I am trying to recreate a Raytraced Hard Shadow in Cycles in Blender.
In the original OSL, this can be easily implemented using trace().
However, Cycles does not accept "shade" parameter input.
Therefore, the result of trace() is very dirty.

So I was looking for a way to calculate shadows without relying on the "Shade" parameter.
By letting the trace rays penetrate self geometry, I was able to determine the shadows falling from other objects.
Used inner product to determine P not facing the light.
However, I was unable to achieve a way to determine the shadow cast by the self geometry on self, which is why I asked the question.

If we have an array containing P, we can determine if light is being blocked by the difference in the inner product of the vector toward the light source.
With this in mind, I asked you the question, but I regret that I could not realize it.

Would what I have in mind be realized by other means?
I hope that will be the case.

Thank you.

--
Larry Gritz

Join {osl-dev@lists.aswf.io to automatically receive all group messages.