Skip to content

Instantly share code, notes, and snippets.

Arseny Kapoulkine zeux

Block or report user

Report or block zeux

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
zeux / islandize-reuv.cpp
Last active Jun 25, 2019
Isolate UV islands and move each island to 0..1 range if possible; this reduces the total UV range of the mesh.
View islandize-reuv.cpp
unsigned int follow(std::vector<unsigned int>& ids, unsigned int v)
unsigned int nv = v;
while (ids[nv] != nv)
nv = ids[nv];
return ids[v] = nv;
size_t islandize(const std::vector<unsigned int>& indices, std::vector<unsigned int>& islands)
zeux /
Last active Jun 13, 2019
Notes on supporting half-precision computation in SPIRV based shader pipelines

The following assumes that HLSL source is used as an input for shader compilation, glslang is used to compile it to SPIRV, and then SPIRV-Cross is optionally used to compile the result to MSL/GLSL.

First, make sure you use min16floatN type instead of halfN type. This is necessary because glslang treats halfN type (with default compilation options) as floatN because unfortunately that's what DX10 does as well.

#define half min16float
#define half2 min16float2
#define half3 min16float3
View decomposetrs.cpp
void decomposeMatrix(const float* matrix, float translation[3], float rotation[4], float scale[3])
translation[0] = matrix[12];
translation[1] = matrix[13];
translation[2] = matrix[14];
// 0 1 2
// 4 5 6
// 8 9 10
float det =
zeux /
Last active Jul 15, 2019
Frequently asked questions about the Lua VM work we (Roblox) are doing.

We're working on a new Lua VM for Roblox and also introducing optional type checking to Lua (based on a combination of type inference and type annotations - the latter require extensions to the syntax). This page summarizes the questions often asked.

Why not just use LuaJIT?

We obviously know about LuaJIT; it's a fantastic project, and really what inspired us to go down this route - it provided an existence proof that Lua can be much faster. Our primary performance target is a wide set of platforms, many of which (iOS, Xbox) don't allow JIT per se - but LuaJIT has a very fast interpreter. So - use it, we're done? Well...

LuaJIT is a large, almost complete rewrite of Lua VM. Over the years we had a set of changes aimed at improving sandboxing in the VM -

zeux / murmur.h
Last active Feb 28, 2019
MurMurHash finalizers as 32-bit integer/pointer hashers
View murmur.h
uint32_t murmur2(uint32_t h)
h ^= h >> 13;
h *= 0x5bd1e995;
h ^= h >> 15;
return h;
uint32_t murmur3(uint32_t h)
zeux / simplifier.cpp
Created Feb 18, 2019
SIMD sloppy simplifier for "Flavors of SIMD" blog post
View simplifier.cpp
// This file is part of meshoptimizer library; see meshoptimizer.h for version/license details
#include "meshoptimizer.h"
#include <assert.h>
#include <float.h>
#include <math.h>
#include <string.h>
#ifndef TRACE
#define TRACE 0
zeux / launch.json
Created Feb 12, 2019
Visual Studio Code launch.json for debugging with gdb via WSL
View launch.json
"version": "0.2.0",
"configurations": [
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/mnt/c/work/meshoptimizer/build/debug/meshoptimizer",
"args": ["-d", "data/kitten.obj"],
"stopAtEntry": false,
zeux /
Last active Jan 19, 2019
Reproduction for 36 seconds of simplification time in debug when using MSVC 2017 x64 with default settings on buddha.obj
zeux /
Last active May 23, 2019
Simplifier variants

State of Roblox graphics API across all platforms, with percentage deltas since EOY 2018. Updated July 11 2019.


API Share
Direct3D 11+ 82% (+2%)
Direct3D 10.1 9.5% (-0.5%)
Direct3D 10.0 7% (-1%)
Direct3D 9 1.5% (-0.5%)
You can’t perform that action at this time.