Hi,
Im trying to get my paticle-vertex-shader to work, but for each particle I need to have a different rotation, scaling and position, but this is not the problem right now. The problem is, that I have to use a float4x4 as an variable. Every time I do lets say float4x4 mat = float4x4(1); the PB3D-Compiler is fine about it.
When compiling the AGAL-program...
this.m_program.upload(programPair.vertexProgram.byteCode, programPair.fragmentProgram.byteCode);
it gives me this as an the error:
AGAL-Überprüfung fehlgeschlagen: Temporärer Registerindex außerhalb des gültigen Bereichs für destination operand bei Token 5 des vertex-Programms.
In english it sais something like this:
Agal-Check failed: Temporary registerindex out of range for destination operand at token 5 of the vertex-Program.
the full vertex-shader:
input vertex float4 vo <id: "PB3D_POSITION";>; // vertex offset
output float4 vertexClipPosition;
parameter float4x4 object;
parameter float4x4 camera;
void evaluateVertex()
{
float4x4 m2 = float4x4(1.0);
float4x4 m = object * camera * m2;
vertexClipPosition = m * vo;
}
Note: This is not the real shader I will use, this is just a test.
m2 is the problem here, because it is not initialized from an existing one. If I just use the matrices from the parameters, everything works like it should.
Any ideas what could be wrong here?
Thanks
Ok after reading the doc again, I noticed, that my program uses more than 8 temporary registers. 10 to be exact. Now I managed to get it down to 5, but still, the same error.
here is the full code of it.
input vertex float4 vo <id: "PB3D_POSITION";>; // vertex offset
input vertex float2 pm; // particle Movement
input vertex float2 pp; // particle Position
input vertex float ps; // particle Scale
output float4 vertexClipPosition;
parameter float4x4 object;
parameter float4x4 camera;
void evaluateVertex()
{
float2 dir = normalize(pm);
float4x4 m = float4x4( dir.x, -dir.y, 0.0, 0.0,
dir.y, dir.x, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);
float4 vp = vo * ps;
vp = m * vp;
vp.xy += pp.xy;
m = object * camera;
vertexClipPosition = m * vp;
}
after trying out so many cases for hours I have to come to the conclusion, that there has to be an error in PB3D.
[object ParticleMaterialShader]
FragmentParameter: color startRegister: 1 offset: 0
FragmentParameter: texTile startRegister: 2 offset: 0
VertexParameter: camera startRegister: 5 offset: 0
VertexInputRegister: pp startRegister: 0
VertexInputRegister: ps startRegister: 1
VertexInputRegister: vo startRegister: 2
VertexInputRegister: UVCoord startRegister: 3
fragment temp registers: 3
vertex temp registers: 6
It is not working
Now I have a version that uses just 4 vertex tempregisters. Nothing
Here is the code:
input vertex float4 vo <id: "PB3D_POSITION";>; // vertex offset
input vertex float2 pm; // particle Movement
input vertex float2 pp; // particle Position
input vertex float ps; // particle Scale
output float4 vc;
parameter float4x4 camera;
void evaluateVertex()
{
float4x4 m = float4x4(1.0);
float4 vp = m * float4(vo.x, vo.y, 0,0);
vp.xy *= ps;
vp.xy += pp.xy;
vc = camera * vp;
}
North America
Europe, Middle East and Africa
Asia Pacific