Forum

Encoding a matrix as a texture

I’m need to save a view projection matrix as a texture. Is there a good way to encode the the 16 floats in less than 4*4channel textures? Maybe some of the values need less precision than others? Can you recommend any good encoding techniques?

Did you take a look at the Particles GPU Library Guide ?
particlesgpu-library-guide

are you thinking you need multiple textures? You can just just 4 pixels of a RGBA texture, if you need a spread just add lines, or am I missing something?

I was talking about encoding a 4x4 matrix, so 16 channels reqiured ie; 4x rgba textures.

Was interested to know if there was a technique similar to this, http://aras-p.info/texts/CompactNormalStorage.html but for a VP matrix

But 4 pixels x 4 RGBA channels = 16 values, so 1 texture 4x1 pixels in size.

ah sorry. I mean a different matrix for each pixel :)

As someone pointed out, with dx11 the best bet is text file + structured buffer. I just like texture approaches as it keeps the option open for animation

no, cant do that. a view projection matrix uses all entries in the matrix, so you cannot omit any of them to reduce the amount of values to store. unless you know that the view will not be rotated or so…

so if you do the math, the biggest format is 128-bit per pixel which would give you 8 bit per value… so 256 possible values for each matrix component. not really practical. you will need 2 or 4 pixels per matrix…