This is the starting shader code:
float4 Pos0 : POSITION0...
matrix WorldViewProjection=World*View*Projection;
output.Pos = mul( Pos0, World );
output.Pos = mul( output.Pos, View );
output.Pos = mul( output.Pos, Projection );
and it works.
But if i change my code to: ( it should be the same...)
matrix WorldViewProjection=World*View*Projection;
output.Pos = mul( Pos0, WorldViewProjection );
i can see nothing!!! How it's possible?
Thanks!!
World*View*Project in DX11 problem
This is the starting shader code:
float4 Pos0 : POSITION0...
matrix WorldViewProjection=World*View*Projection;
output.Pos = mul( Pos0, World );
output.Pos = mul( output.Pos, View );
output.Pos = mul( output.Pos, Projection );
and it works.
But if i change my code to: ( it should be the same...)
matrix WorldViewProjection=World*View*Projection;
output.Pos = mul( Pos0, WorldViewProjection );
i can see nothing!!! How it's possible?
Thanks!!
No, those are not the same
I don't see why you want to change your original approach since it's just fine as it is
If you really insist on calculating your wvp-matrix in a single line you should use this:
matrix WorldViewProjection = mul(mul(World, View), Projection);
Great!!! I thought that World*View*Projection resolved this way:
World * View then result * Projection;
Another Question why do you say that i should not change the original code?
Thanks a lot!!
World * View then result * Projection;
Another Question why do you say that i should not change the original code?
Thanks a lot!!
Because this:
is exactly the same as this:
The first option is more flexible for if you would need to do calculations with your view-space position for example
output.Pos = mul( Pos0, World );
output.Pos = mul( output.Pos, View );
output.Pos = mul( output.Pos, Projection );
is exactly the same as this:
matrix WorldViewProjection=mul(mul(World,View),Projection)
output.Pos = mul( Pos0, WorldViewProjection );
The first option is more flexible for if you would need to do calculations with your view-space position for example
The * operator does not perform matrix multiplication, it performs per-component multiplication. You want to use mul(), not *.
The * operator does not perform matrix multiplication, it performs per-component multiplication. [/quote]
Pity, in C++, the * operator does exactly this.
The * operator does not perform matrix multiplication, it performs per-component multiplication.
Pity, in C++, the * operator does exactly this.
[/quote]
That depends on which math library you're using....
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement