2024/11

Difference between right-handed and left-handed systems

Whenever I write a program in Direct3D, I am always concerned about the fact that it is a left-handed system. I was used to right-handed systems because my first 3DCG learning experience was with OpenGL, and the mathematics I learned as a student must have been right-handed as well. I also think that many of the GL-like APIs for game consoles were also right-handed. And yet, I think that Direct3D’s adoption of the left-hand system has made complex 3DCG even more complex.

Many people think that the right-hand system and the left-hand system are just different in matrix calculation, but the biggest difference is that the definition of the Z buffer changes. Whereas the right-hand system is in the range-1~ 1, the left-hand system is in the range 0 ~ 1. The projective transformation matrix changes accordingly, clipping range changes, the orientation of the vectors in the outer product calculation changes, and the orientation of the polygon faces changes. Frankly, just reading the program, I am not quite sure what the correct code is.

Debugging Direct3D12 Apps with RenderDoc

Debugging even simple shaders to see if they are working correctly is difficult. At first I tried to debug using PIX, but although I could see the contents of the constant buffer, I could not see the VertexShader vertex data, I wondered if my settings were bad, but when I asked Dr. ChatGPT, his answer was to use RenderDoc when in trouble, so I decided to use RenderDoc with half a doubt.

RenderDoc worked easily. I could see the vertex data of VertexShader without any particular settings, and the step execution of shaders worked without any problem.

The debugging method for VertexShader is as follows.

Drawing a mesh created in Blender with Direct3D12

I decided to try drawing an arbitrary mesh in Direct3D12, so I first created the mesh data.

I use Maya in my work, but this time, I will create the data in Blender. Since this is my first time, I created the rocket mesh while reading this book on Kindle Unlimited.

https://amzn.to/4fcLOOz

I think this book is simple and easy to understand.

Next, I figured out how to bring the Blender data toC++. This time, the two types of data needed will be vertex data and index data. (Materials will come later.)

If we were to export the Blender data, we could use fbx, usd, and glTF formats. Each also provides a python API so you can get the data you need. However, each was more tedious than I expected when I tried to dump the vertex data in python. Is there a more user-friendly format?