简体   繁体   中英

Transformation functions in vulkan

Can anyone help me find resources to study about how to implement transformation functions (Translation, rotation & scaling) using Vulkan API on windows platform? There are very limited sources on Vulkan as far as I know and I couldn't find a single material about transformations in Vulkan.

If You are looking for a source code, Vulkan Cookbook has code samples implementing each of these transformations ( translation , rotation and scaling ).

If You are looking for an explanation why they are implemented in such a way, You can look for any resources describing these transformations. Translation, rotation and scaling behave exactly the same, no matter what API You are using. This is pure linear algebra. There are differences in projection matrices due to different coordinate systems being used (Vulkan has depth in a [0; 1] range while OpenGL in a [-1; 1] range; and framebuffer space is inverted along Y axis). But the same methodologies apply when You are constructing them by Yourself, You just need to take into account these different coord systems.

The best resource I have encountered describing why matrices are created in such a way, was Frank D. Luna's Introduction to 3D Game Programming with DirectX .

If you're looking for something like the equivalent of glTranslatef , glScalef , and glRotatef , you're out of luck. Nothing like that exists in Vulkan (or in modern OpenGL, for that matter). With modern rendering API's you manage transforms (view, model, projection) on the CPU side using your own preferred library (I use and recommend GLM ). Transforms are passed to the shaders using uniform blocks, typically as mat4 values where they can then be used to transform input vertices.

If you are asking us how to implement these by yourself, you have to study some linear algebra to do this. Previous answers answered this.

If not, then I suggest using GLM . It is a library originally written for OpenGL, so you have to be careful while using it. Axes are flipped, keep that in mind.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM