Timeline for How can I convert between float3 and float2 in HLSL?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 30, 2014 at 1:12 | history | edited | Anko | CC BY-SA 3.0 |
Some simplifications and formatting.
|
Sep 18, 2013 at 22:08 | comment | added | Nathan Reed |
Well if all you want is to find where you are in a 3D block, based on where you are in the flattened 2D texture, you just have to multiply the texture coordinate by 8 and use frac() .
|
|
Sep 18, 2013 at 21:58 | comment | added | dpaz | Thank you. I will definitely look into that as referencing a volume texture will cut down on conversion calculations (and hopefully interpolation), but unless I cannot find a way to do it, I still want to convert float2 texture coordinates to float3. I considered rendering to each slice, but I am worried because my engine is continuously pumping out hundreds of these blocks. At 64 slices each, I fear that would become quite a bottleneck and would leave very little room for actual rendering. I would rather let the CPU decode 2D to 3D than run a thousand draw calls per frame. | |
Sep 18, 2013 at 21:40 | comment | added | Nathan Reed | You can certainly use volume textures natively in pixel shader 3.0. See this related question. You can't render directly to a volume texture slice, though. (You can in D3D10/11.) At best you can render all the slices to a 2D texture, then lock it and copy the data into the volume texture. Perhaps that would work for your case, though? | |
Sep 18, 2013 at 21:26 | history | asked | dpaz | CC BY-SA 3.0 |