-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
mat3 quaternionWXYZToMatrix(const vec4 q){
const float w = q.x;
const float x = q.y;
const float y = q.z;
const float z = q.w;
const float xx = x * x;
const float yy = y * y;
const float zz = z * z;
const float xy = x * y;
const float xz = x * z;
const float yz = y * z;
const float wx = w * x;
const float wy = w * y;
const float wz = w * z;
return mat3(
1.0 - 2.0 * (yy + zz), 2.0 * (xy - wz), 2.0 * (xz + wy),
2.0 * (xy + wz), 1.0 - 2.0 * (xx + zz), 2.0 * (yz - wx),
2.0 * (xz - wy), 2.0 * (yz + wx), 1.0 - 2.0 * (xx + yy)
);
}
-
위의 코드는 쿼터니언을 회전행렬로 변환하는 함수
-
파티클 회전 정보가 쿼터니언으로 되어있는데 glsl에서는 회전 행렬 계산만 가능
-
때문에 hit된 파티클마다 위 함수 수행해야됨
-
쿼터니언 to 회전행렬 변환을 전처리로 미리 계산 하면 어떨까?
- 메모리 크기 커지는 문제 : vec4 -> mat3
Metadata
Metadata
Assignees
Labels
No labels