0
$\begingroup$

I'm having a bit of trouble with using rectangular textures on my nvidia 3060 GPU. Everything works well when using square textures.

The small GLSL compute shader code and small C++ code can be found at: https://github.com/sjhalayka/light_blocking_asymmetric

I've done my best to make the code as simple as possible. Is there a small bug, or a feature that I'm missing? Thanks for your time and expertise.

Rectangular texture (undesired, sheared lighting):

Rectangular texture

Square texture (desired lighting):

Square texture

$\endgroup$
2
  • 1
    $\begingroup$ The "rectangular" image looks like the height is being used for the width for drawing the lit area. So potentially height and width are being transposed somewhere. On a square texture if height and width are swapped it won't matter. $\endgroup$
    – pmw1234
    Commented Oct 2 at 9:37
  • $\begingroup$ Thank you for your guidance and time. I ended up going with square power-of-two textures so that I can do a tile-based renderer. I thank you for pointing out my error. $\endgroup$ Commented Oct 2 at 16:38

1 Answer 1

0
$\begingroup$

I cannot figure out how to fix this bug elegantly. Instead, I just made it so that rectangular textures are made square by padding with black pixels before computing, and then cropping the output from square back to rectangular.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.