I'm trying to rewrite a shader I have in OpenGL that does:
vec3 somevariable = mat3*vec3;
mat3 and vec3 would be two variables of that type, however when i tried do:
float3x3 * float3
I get error in HLSL which is fine but when I try convert the math to:
(where ca = mat3
and no would be the vec
3) (float3x3
float3
)
float3 somevariable = float3(ca[0].x*no.x+ca[0].y*no.y+ca[0].z*no.z,ca[1].x*no.x+ca[1].y*no.y+ca[1].z*no.z,ca[2].x*no.x+ca[2].y*no.y+ca[2].z*no.z);
This gives a different output than mat3*vec3
does in OpenGL, anyone know why? thanks :3
答案 0 :(得分:0)
就矩阵是行主要还是列主要而言,GLSL和HLSL之间似乎存在差异。
如果没有看到错误,我会假设你的尺寸不匹配。您需要将矢量定义为float1x3或交换矢量和矩阵:
document
或<app-root>
float3x3 * float1x3