I am capable of writing simple hlsl shaders although i dont understand why my shaders work.
Now trying to port some of them over to Unity, im confused about the semantics part.
My simple question is, what is the equal of the following in unity?
I have been running into the same problems with Semantics between HLSL and Unity, but after doing some testing, I believe that the following is acurate:
float4x4 WorldVP:WorldViewProjection; is UNITY_MATRIX_MVP
I don’t know about the other one tho, sorry. Hope this helps a little…
Stephane
I got used to unity way of doing things in modelspace. And there are helper builtin matrices in unity to convert to world space or whatever space you need.
Check the builtin matrices, also camera class for camera matrices and renderer class for mesh matrices.
Then you can build your own matrices to be used in your shaders.
Oh by the way, although projection matrix is different in directx and opengl, i believe unity camera projection matrix is calculated according to as i never faced a problem. I might be wrong though as there is no proper way of debugging that.
If you multiply the 4x4 matrix representing the modeling transform by the object-space position in homogeneous form, the result is the same position transformed into world space. This same matrix math principle applies to all subsequent transforms discussed in this chapter.