Normalize Problem

Incoming vector.blend (2.5 MB)
I am trying to obtain the incoming vector in Blender, and I’ve succeeded, but there is an issue. Although I understand the mathematics behind it, I am confused at one point. I managed to obtain this vector using two methods. The first method involves the shader panel, and the second method uses geometry nodes. The operations are the same in both methods, but when I “Normalize” the vector in the final step, a problem occurs. To help you understand the difference, I’ve added a normalize node in both editors. To see the result, disable one of the normalize nodes in the editors and enable the other one (press the M key). The problem is this: Why does the geometry nodes method not give the desired result even though the operations are the same? It creates artifacts in the image. But there is no issue with the method in the shader editor. Note: I’m sorry, my English is not very good, I use a translator.

Disclaimer: I don’t really know what I’m talking about.

…but if I had to guess, I’d say it has something to do with how the values are interpolated on the surface itself.
In GN you only normalize values on points. After the fact, the values “between” them might not be normalized (and seem to be slightly wrong).
In Shader Nodes you first get vectors per pixel (I guess?) and then normalize each.

1 Like

Yes, what you said makes sense. The issue is that I tried to obtain the “Incoming” vector in two different editors. While it worked correctly in the shader editor, I was getting visual artifacts in the geometry nodes. After many attempts, I discovered that the problem was caused by the “Normalize” operation on the vector. When I applied the normalization in the shader editor, there was no issue. If what you said is true, it explains everything.

The “Incoming” vector makes little sense in GN… Unless you feed the Camera into the GN, with which you can get the ‘Incoming’ vector from the Camera alone.
But for example, in Cycles, the Incoming vector can come from other locations that not the camera, as the rays bounce from object to object…

2 Likes

The reason I used geometry nodes was to transfer the camera’s position to the shader editor. Then I wondered if I could do it entirely with geometry nodes. And yes, I was able to create the same vector in the geometry nodes. The purpose here is not to use this vector somewhere, but just to understand the mathematics behind it. Thank you for your help.

Ah, ok…
You know you can also get the camera’s position directly in the Shader Editor, with the Attribute node > ViewLayer > camera.location. :wink:

2 Likes

Oh, I didn’t know something like that existed :open_mouth: thank you. Do you know how I can access these kinds of commands?

Do you mean, the list of available options?

Yes, for example; camera.location

Most properties that are either Floats, Colors or Vectors can be used.
The docs explain that a bit further, but some knowledge of the DataBlocks (like Object, Scene, ViewLayer, etc) is needed, 'cos the documentation doesn’t list all possible properties.

https://docs.blender.org/manual/en/latest/render/shader_nodes/input/attribute.html

4 Likes

I think this will do the job. @stray @Secrop Thank you for your help :slight_smile:

2 Likes