I'm trying to transmit to my Cg program the worldlview_matrix, and the projection_matrix, but it doesn't seem to work...
I noticed multiplying the world_matrix and the viewproj_matrix is equivalent to the worldviewproj_matrix, but not to the world_matrix multiplicated by the viewproj_matrix.
Weird isn't it ? Am I (again) missing something ?
Cg matrices
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
-
captainstan
- Halfling
- Posts: 94
- Joined: Thu Nov 04, 2004 12:46 pm
- Location: france
inside my shader, I don't want all my vertices to be treated the same, so I need to separate the modelview matrix from the projection matrix.
When you say autobindings, do you mean to use param_named_auto in my material script ? that's what I do but it just doesn't seem to work...
And I take care of the non-commutativity of the matrices, of course.
When you say autobindings, do you mean to use param_named_auto in my material script ? that's what I do but it just doesn't seem to work...
And I take care of the non-commutativity of the matrices, of course.
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
-
captainstan
- Halfling
- Posts: 94
- Joined: Thu Nov 04, 2004 12:46 pm
- Location: france
I'm not on my work PC, so it may not be exactly it..
in my material script, I have my vertex program reference containing
and for the moment, in my vertex shader :
if I pass in world_matrix and viewproj_matrix, it works allright.
I wanna pass the projection matrix separatly, basically because I wanna see if I can obtain some weird effects modifying it.
I've also tried to use param_named_auto with the same results (I don't see anything at all when separating projection from other matrices).
in my material script, I have my vertex program reference containing
Code: Select all
param_indexed_auto 0 worldview_matrix
param_indexed_auto 4 projection_matrix
param_indexed_auto 8 77 //must be something like that, well it references the morphfactor for terrain shading, anyway it works
Code: Select all
vertout main(float4x4 worldview,
float4x4 projection,
float morphfactor,
...)
{
position.y = //something with delta and morphfactor
out_position = mul(worldview, position);
out_position = mul(projection, out_position);
.....
}
I wanna pass the projection matrix separatly, basically because I wanna see if I can obtain some weird effects modifying it.
I've also tried to use param_named_auto with the same results (I don't see anything at all when separating projection from other matrices).
-
sinbad
- OGRE Retired Team Member

- Posts: 19269
- Joined: Sun Oct 06, 2002 11:19 pm
- Location: Guernsey, Channel Islands
- x 67
Ok, it's a bug in the MaterialSerializer, it doesn't have a case statement for projection_matrix. The auto binding is there, and I'm sure it works (since it's derived the same way for viewproj and worldviewproj), it was just missed in the script parser. I'll fix it.
[Edit]Fixed in Hastur, once anon is up to date this should work[/Edit]
[Edit]Fixed in Hastur, once anon is up to date this should work[/Edit]
-
captainstan
- Halfling
- Posts: 94
- Joined: Thu Nov 04, 2004 12:46 pm
- Location: france