
Translate GLSL to SPIRV for Vulkan at Runtime
Table of Contents Get Glslang Libs Use Glslang Build Glslang Libs As I’m porting my game engine from OpenGL to Vulkan, I encountered the need of translating exisiting glsl shaders (with changes for Vulkan) to spirv. The recommanded way is to use offline toolchain glslangValidator, provided in Vulkan…

SSE SIMDを用いて４ｘ４の逆行列の高速アルゴリズム
Table of Contents トランスフォーム行列 一般の逆行列 付録その一 付録その二 English Verison 始まる前に、実際に必要となる逆行列は「一般の行列」かどうかを考えてください。 私は自作ゲームエンジンの数学系ライブラリを書く時、逆行列の問題を考えました。ゲームや３Dアプリケーションでは、オブジェクトのトランスフォーム情報は４ｘ４行列で記録されています。このような、位置、回転、スケールの三要素から作成している行列は、この文章で「トランスフォーム行列」と呼びます。トランスフォーム行列は一般の行列より2倍早い逆行列の求め方があります。この文章の前半は先ずトランスフォーム行列について話しましょう。後半はSIMD命令を用いた一般の４ｘ４行列の逆行列の求め方を説明します。最…

How to Make Tools in UE4
This article is based on Unreal 4.17 code base, tested in Unreal 4.23. This is a step by step tutorial to write tools for your Unreal project. I would assume you are familiar with Unreal already. This is NOT a tutorial for SLATE code, that deserves a tutorial…

Improve Tilebased Light Culling with Sphericalsliced Cone
Table of Contents The Problem of SphereFrustum Test Cone Test Sphericalsliced Cone Test Extend to Clustered Light Culling Tilebased method is used in both deferred and forward rendering. Since light calculation is expensive, one of the main goal for improving tilebased method is to provide more accurate and efficient light…

Stop Using Normal Matrix
For rendering, I used to calculate normal matrix to transform vertex normal from model space to world space or view space. The normal matrix is defined as the inverse transpose of upperleft 3x3 matrix of the model matrix, from this article. Of course matrix inverse is not a cheap operation…

Fast 4x4 Matrix Inverse with SSE SIMD, Explained
Table of Contents Transform Matrix Inverse General Matrix Inverse Appendix 1 Appendix 2 Before we start, think about this question: do we really need the inverse of a general matrix? I came to this problem when writing a math library for my game engine. If you are making a game…

Conversion between View Space Linear and Screen Space Linear
Some background of this problem: when doing screen space reflection, we need to shoot a ray from every pixel to find out reflection color. However we don’t want to march the ray in view space, because for example you have a ray pointing relatively inwards or outwards to the…

Calculate Minimal Bounding Sphere of Frustum
I came across this problem when fixing shadow shimmering in Cascaded Shadow Map, but it could be used in many other cases. To describe what we are going to do more specifically: given a frustum with near plane \(n\), far plane \(f\), and field of view angle \(fov\), we need…

A Different Way to Understand Quaternion and Rotation
Before We Start Quaternion is widely used in game engines to represent 3D rotation. As a game engineer you might be using quaternion explicitly or implicitly in your daily work, but do you really understand what is going on under the hood when you are calling “rotate a vector” or…