About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
EE Shader global matrix equivalents
Author Message
3DRaddict Offline
Member

Post: #1
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
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
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
Find all posts by this user Quote this message in a reply
fatcoder Offline
Member

Post: #3
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
Find all posts by this user Quote this message in a reply
Post Reply