i heard some rumours that it’s possible to access individual slices of spreads in shaders
is this true?
i’m feeding in matricies of data as transforms using SetMatrix.
It would be nice if i could access one specific matrix slice at a time.
I’m on the pixel shader, and generally I only need to access one slice per pixel (if that is a limitation)
anyone know the way to go?
p.s. i’m not feeding the matricies in on the ‘Transform’ pin, i’ve got seperate MAtrix4x4 inputs
September 17, 2009, 4:16pm
as far as i know it works like this:
create a global array like this:
then get a particular slice:
float4 newPos = mul(oldPos, transforms~091~i~093~);
September 17, 2009, 5:08pm
September 17, 2009, 5:24pm
hhhm, just thinking loud:
would it also be possible to access a single value out of an ARRAY of transforms?
float FarPlane = 1/ ( tArray i 2 3 + tArray i 3 3 ) ; //
perhaps i check this later.
seems to work fine
also, spreading colours throws an error (about converting between structs and floats) maybe somebody else can get it working, i hacked here by putting things into floats before they get in the shader.
also, i dont seem to be able to be able to go higher than around 128 values per input
shader spread test.zip (3.1 kB)
September 17, 2009, 7:30pm
float4 spreadcol~91~48~93~ : Color;
works for me…
September 18, 2009, 2:12am
yep, the array length is limited, see
Arrays in the EX9.HLSL.Introduction.
color spreads work as tonfilm pointed out. where do you get the error thrown?