XNA 4: GetData from Texture2D and Set it into Texture3D with specific order
Posted
by
cubrman
on Game Development
See other posts from Game Development
or by cubrman
Published on 2014-04-01T15:29:35Z
Indexed on
2014/05/31
22:07 UTC
Read the original article
Hit count: 365
I am trying to convert my color grading 2d lookup texture into 3d LUT. When I simply use:
ColorAtlas.GetData(data);
ColorAtlas3D.SetData(data);
I get this:
I tried building my 2d atlass horizontally but it did not helped - the data was messed up in a different way.
So my question is how can I influence the order of the data I get from the 2d atlas and how can I properly pass it into my 3d atlas?
Update: I know that I can GetData from a specific Rectangular area and put it into several arrays, but the result is still the same. This is what I tried:
Color[] data2D = new Color[0];
for (int i = 0; i < 32; i++)
{
Color[] data = new Color[32 * 32];
GraphicsDevice.SetRenderTarget(null);
ColorAtlas.GetData(0, new Rectangle(0, i*32, 32, 32), data, 0, data.Length);
int oldLength = data2D.Length;
Array.Resize<Color>(ref data2D, oldLength + data.Length);
Array.Copy(data, 0, data2D, oldLength, data.Length);
}
ColorAtlas3D.SetData(data2D);
© Game Development or respective owner