Frage

I am storing velocity information in the texture. As texture can only have color values in range {0, 1} How should I determine the direction of the velocity ? One solution is to create another texture which stores only the direction information for the velocity but it will be very costly. Any thoughts pls ?

War es hilfreich?

Lösung

You have 4 channels .. r, g, b and a ... use each channel to represent on of x,y and z. Kinda like a normal map. For the alpha channel you can encode using an RGBE style format. Effectively you store a normalised vector in the R,G and B channels and then store the exponent in the A/E channel.

Edit: Furthermore using something like a spherical environment map you could encode the direction vector as an x and y index and thus save a channel.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top