Repository navigation
Prefer lhs on a tie for min grad ops and rhs for max - #512
LukeP0WERS wants to merge 8 commits into
Conversation
|
Interesting! Do you have any easy ways to reproduce the rendering artifacts, e.g. a model + settings that I could run myself with I don't object to the fix – having matching CPU/GPU behavior isn't a hard requirement, but let's do it if it's easy – but having it make a significant visual difference doesn't make sense to me, so I'd like to dig a little further (could be a WGPU or driver bug) |
|
I haven't reproduced it with any model that can be shared easily. The gradients were being flipped in exactly 180 degrees right at the boundary of a box with empty space. I'm need to double check but I think the grad sample might have been exactly on the surface of the box, which might be a clue as to why things were going wrong, but I'll have to verify for sure. |
|
Yep the inversion only happens when sampling right on the surface of the box, which might explain why a tie would affect it. Sampling above or below the box gives the correct SDF pointing in the same direction, right on flips it without this fix. |
|
Okay, here's my thoughts:
So my disposition is to not merge this PR, since it would cause the CPU and GPU implementations to diverge. |
|
I should have taken a look at the other CPU functions, I was just looking at the x86_64 JIT |
|
I dug into this a bit deeper, and I think the JIT version is the better convention. |
|
Whats nice is that fidget already sets up this identity to work no matter what, if you try to pass arguments in the order of fidget/fidget-core/src/context/mod.rs Lines 215 to 224 in 25528e0 |
op_min inside grad_op.wgsl being inconsistent with the CPU counterpartlhs on a tie for min grad ops and rhs for max
|
Thanks, I've moved this over to #513 (rebased to remove unnecessary commits, and added a unit test early in the comit stack). |
This led to some pretty extreme rendering artifacts, surprising considering its just a different tiebreak. I assume the CPU is being treated as the source of truth for the project, so this might need to be flipped if not.