3DRaddict
Member
|
EE Shader global matrix equivalents
What would help me immensely in my understanding of the EE shader code would be if you could kindly supply me with the names of the EE equivalents for these global matrices used in most HLSL shaders:
WorldMatrix
ViewMatrix
ViewProjectionMatrix
ViewInverseTransformMatrix
|
|
09-16-2014 03:21 PM |
|
Esenthel
Administrator
|
RE: EE Shader global matrix equivalents
Hi,
Please look into:
"Constants.h"
Code:
Matrix4 MatrixProj ; // projection matrix
Matrix MatrixCam ; // camera matrix
#define MatrixOC0 MatrixOC [0] // object camera matrix (use this for no skinning) (this is object matrix * inversed camera matrix)
instead of using them directly, I recommend using following functions:
Code:
pos= TransformPos(vtx.pos4());
nrm=Normalize(TransformDir(vtx.nrm ()));
outVtx=Project(pos);
For full example you can look at "Blend.cpp" shader, and the vertex shader:
Code:
void VS
(
VtxInput vtx,
..
|
|
09-17-2014 04:34 AM |
|
fatcoder
Member
|
RE: EE Shader global matrix equivalents
I've written a number of custom shaders over the years in EE, and this is definitely the area where I see EE users struggle the most, which is probably why we don't see many people using custom shaders (beyond what is supplied by EE).
A lot of example HLSL code uses various combinations of world, view and projection matrices requiring you to often covert HLSL code to use the above mentioned constructs provided by EE in their place.
Perhaps a tutorial dealing specifically with the use of world, view and projection matrices equivalents in EE may help. Once someone understand these basic concepts it comes together a lot easier then.
|
|
09-17-2014 06:34 AM |
|