When you create a new quaternion, what do you do with it, so you can apply rotations to your object?

And do you have to do it inside the PICA vertex shader?

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter delete12345
- Start date
- Views 1,522
- Replies 14

When you create a new quaternion, what do you do with it, so you can apply rotations to your object?

And do you have to do it inside the PICA vertex shader?

D

Correction; itCompelty off topic, but it is Citra, not Citro

The easier one would be to convert your quaternion to a matrix and multiply your modelView matrix with it, which you pass into the vertex shader.

Another option(the more difficult but better option) would be to pass the quaternion to your vertex shader and use magic quaternion math(which you have to copy and translate to Pica assembler by yourself from the source code of c3d, see here: https://github.com/fincs/citro3d/blob/master/source/maths/quat_crossfvec3.c) to apply the rotation to your vertices(watch out for the order, first rotate then translate).

What should the C3D_FVec argument be? I remembered vaguely that it's for forward, up, and right, but I would like for confirmation.

Ah, then I may be mistakenly referring to FVec3_CrossQuat(v, q) instead? Thanks for the info.

what are you going to do? I'm a little bit confused the first way or the second?

Using quaternions to move around in the world. Not relying on matrix transformations as much as possible. This is to force myself to learn about quaternions and trying to embed the big picture of using it into my brain, so I can get past the hurdles for thinking about it conceptually.

ah, ok. I never really understood how they work internally.

Good luck

Don't try to understand how they work internally. It's a 4-dimensional abstraction where three of the dimensions are imaginary. You only need to understand what their operations accomplish.

--------------------- MERGED ---------------------------

Using quaternions to move around in the world.

Quaternions are orientations; they do not include position. You can use quats to "move" rotationally. You need to translate using the result from cross multiplying with a vector if you want to use them for moving position.

Not relying on matrix transformations as much as possible.

Yes. Quat+Vec3 (orientation plus position) uses less memory than a 4x4 matrix. Additionally, quat operations are cheaper than their equivalent matrix operations. Plus you have the whole reason they were invented: the quotient of two rotations. This allows you to slerp between two orientations. You can't do this (generically) at all with matrix math.

Using quaternions to move around in the world. Not relying on matrix transformations as much as possible. This is to force myself to learn about quaternions and trying to embed the big picture of using it into my brain, so I can get past the hurdles for thinking about it conceptually.

I liked this math series about quaternions by Professor Norman Wildberger at UNSW (Australia).

https://www.youtube.com/user/njwildberger/search?query=quaternions

Start here:

How do you even use Citro3D? And why do we need shader files?

You will have to look up the example codes provided with a devkitPro installation. Citro3D is like OpenGL ES 2.0, hence the shader files. (Analogy only)

- Replies
- 2

- Views
- 351

- Replies
- 2

- Views
- 395

- Replies
- 1

- Views
- 459

- Replies
- 30

- Views
- 5K

- Replies
- 42

- Views
- 4K