glslify / glslify/glsl-perturb-normal
Invalid result if textures coordinates are qual
- Dominant language
- GLSL
- Stars
- 36
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Description
If multiple texture coordinates points to the exact same point the `cotangentFrame` function returns an invalid matrix.
This is because duv1 and duv2 will be zero vectors and will lead to a division by zero at this line:
https://github.com/glslify/glsl-perturb-normal/blob/1f8ec7f4266de7ac3269a964a0c9be64dffa0d77/cotangent-frame.glsl#L16
In default texture mapping of meshes, the case where vertices points to the same texture coordinate is quite common.
Should not be `cotangentFrame` robust enough to handle these cases too?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with cotangent-frame.glsl at line 16, where the issue reports division by zero when texture-coordinate differences are zero. Reproduce the case with repeated texture coordinates and inspect the resulting matrix. Done means cotangentFrame no longer returns an invalid matrix for that input, with the expected behavior confirmed.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100