GLSL missed the normalization step.
Details
Diff Detail
- Repository
- rB Blender
Event Timeline
Generally sounds fine, but i wouldn't mix this two changes into a single commit. Or maybe i'm missing something and they're related to each other?
No, you're right, we shouldn't mix those, I just forgot about about the typo fix and it got in. Will make a separate patch.
| source/blender/nodes/shader/nodes/node_shader_vectMath.c | ||
|---|---|---|
| 79–89 ↗ | (On Diff #3174) | Well, the node has two outputs : a vector and a value. Previously the code would do the following: vector = cross(input1, input2); and now (fixed): vector = cross(input1, input2); That's how Cycles goes, and also GLSL except the normalization of the vector was missing at the end. Also I admit it's a tad verbose but apparently there are no cross and normalize function to return a vector in BLI. As far as I could see, they only return a single float. |
| 90 ↗ | (On Diff #3174) | Okay so who am I now to act as the code style police from time to time in this code review system... :P |
| source/blender/nodes/shader/nodes/node_shader_vectMath.c | ||
|---|---|---|
| 79–89 ↗ | (On Diff #3174) | I do not see the issue with value = normalize_v3(vector);, normalize_v3() does return the length of the vector (before normalization), and normalizes the vector in-place… |
| source/blender/nodes/shader/nodes/node_shader_vectMath.c | ||
|---|---|---|
| 79–89 ↗ | (On Diff #3174) | hmm, I did not see that... guess I just got stuck on the name... also, quite a funny one: while debugging, I kept changing the code but couldn't see any difference, until I realized I was compiling a release build while launching a debug one to test! :/ Anyhows, will update. |
Think you have commit rights? If so, please go on and commit, such one-liners do not really need a strict review now ;)
| source/blender/gpu/shaders/gpu_shader_material.glsl | ||
|---|---|---|
| 341 | Why not to divide by outval? Would save calculating vector length second time. | |
@Bastien Montagne (mont29), I don't have commits rights at the moment.
| source/blender/gpu/shaders/gpu_shader_material.glsl | ||
|---|---|---|
| 341 | Sounds fair, will do. | |
Then, can we have a (public) mail, so that we can commit on your behalf (this way, you'll appear as author of the commit in git history)?
Shouldn't arc be doing this automatically? Anyway, I'm already in the git logs (even for Cycles) with this mail: kevin.dietrich _at_ mailoo.org