Shading: Best way to shade different based on side of object

I wanted to ask, what the best way is, to shade object different depending on what side of the model the geometry is.
My current solution uses the scale attribute to check if an object is mirrored to one side to change shading. The tricky thing is, if the object is parented, its the instancer not the object and in geometry nodes it doesn’t work at all.
In other software I would take the local position, but Blender only has world position. So when ever the object get moved by a parent object it will change shading, and I do not want that.

Have you thought about the Texture Coordinate Node? The Generated coordinates should allow you to determine if your geometry is left or right of object center (based on the bounding box) if it is between 0.0 and 0.49 or between .5 and 1.0 on the X component of the vector. Please let me know if you need more clarification, and I hope this helps!

Oh, here’s a link to the Texture Coordinate Node manual page for your reference:
https://docs.blender.org/manual/en/latest/render/shader_nodes/input/texture_coordinate.html#texture-coordinate-node

1 Like

Your are right the bounding box indeed is local and stays with the object.
I just have to get the nodes right to do that. Never really looked into vector math on texturing before.

Got it!
Texture Coordinate to Object (works better as it uses world scale and not bounding box)
Then separate XYZ
I used a max range to push up the values from 0 to 100 (instead 0 to 1),
then plugged it into a mix node.

Shader Nodes rock!!!

1 Like

Are you willing to share a screenshot of your result?

1 Like

I run into a problem when ever the original mesh actually need also to work when scalled negative (mirror on x axis).
I used a math node to multiply add at the axis method, so it features both. (attribute scale of the object and separate the color output for Red).

However this method didn’t work on geometry node instances (only if realized it works). The problem is, when the object is mirrored and the attribute scale works, but not when the instance is mirrored inside a geometry node.

Yeah I know that sounds complicated, but I wanted to leave that here, maybe someone finds a solution or the knowledge is used. At least the instanced object is not working with geometry node is kind of a problem.