three-gpu-pathtracer
three-gpu-pathtracer copied to clipboard
Add support for wrapS and wrapT properties
Related to #165, #91
Add support for RepeatWrapping
, ClampToEdgeWrapping
, and maybe MirroredRepeatWrapping
to the renderer shader.
I think that these are actually rarely used in my opinion. So nice to have, but definitely not absolutely required.
Here is some example code that replicates these modes:
// RepeatWrapping
texCoord0 = fract(texCoord0);
// ClampToEdgeWrapping
texCoord0 = clamp(texCoord0,0,1);
// MirroredRepeatWrapping (Ben: Is this right? I haven't checked.)
texCoord0 = fract(texCoord0*0.5)*2.0;
texCoord0 = 1 - abs(texCoord0-1);
From here: https://forum.derivative.ca/t/custom-texture-wrapping-per-instance-in-a-glsl-shader/8661/3
I actually didn't even know MirroredRepeatWrapping
existed - I expect that one might be particularly rarely used? I feel like Clamped is more common, though. Happy to wait until there's a good test model in the wild to add these. We have two remaining pixels per texture transform parameters that can be used to store this information.
Interesting discussion on twitter of which modes are actually needed: https://twitter.com/SebAaltonen/status/1536316682813186050