Extracting View*Projection

Started by
2 comments, last by Evil Steve 14 years, 1 month ago
Is it possible to convert View*Projection back to View or Projection?, like seperate them ?
:)
Advertisement
You need more information that just View*Projection. For example if you know the projection matrix too you could multiply by its inverse (as long as it is invertible) to get the view matrix.
Its getting it from the shader
npDevice->GetVertexShaderConstantF(5,ViewTimesProj,4); //view*proj
it's like that in the constant table

Name=[cViewProj]
RegisterSet=[D3DXRS_FLOAT4]
RegisterIndex=[8]
RegisterCount=[4]
Class=[D3DXPC_MATRIX_COLUMNS]
Type=[D3DXPT_FLOAT]
Rows=[4]
Columns=[4]
Elemets=[1]
StructMembers=[0]
Bytes=[64]
DefaultValue=[0x0]
StartRegister=[5]
END

because the shader sets the matrices you can't do
npDevice->GetTransform(D3DTS_PROJECTION,&Projection); etc....
:)
Not really - it may be possible, but it'll involve a significant amount of work to get, so much so that it's likely to exceed your instruction limit.

Just pass in the view and projection matrices separately and multiply them in the shader (Or, pass in the premultiplied matrix as well).

This topic is closed to new replies.

Advertisement