Ancestors

Toot

Written by kb on 2024-12-10 at 18:37

In today's "things that are obvious in hindsight" news:

Instead of the inverse transpose matrix, use the adjugate matrix for transforming normals. It leaves out the 1/determinant which you'd normalize() away anyway.

https://www.shadertoy.com/view/3s33zj

Only drawback: It doesn't flip the normals when the world matrix is inside out (eg. with negative scale). But you can counter this by flipping backface normals in the shader, and boom - everything always works, regardless what the user throws at it. \o/

=> More informations about this toot | More toots from kb@abraum.social

Descendants

Written by Mrs Beanbag on 2024-12-10 at 19:39

@kb something about this did feel familiar, so i've gone to check my own source code from 8 years ago and found somewhere where i'd factored out the determinant in an inverse matrix times vector, so that it would only be 3 divisions and not 9.

=> More informations about this toot | More toots from mrsbeanbag@ieji.de

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113629976829380630
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
249.325304 milliseconds
Gemini-to-HTML Time
0.430492 milliseconds

This content has been proxied by September (ba2dc).