Skip to content

Instantly share code, notes, and snippets.

View BelmuTM's full-sized avatar
🌺
Beep Boop

Belmu BelmuTM

🌺
Beep Boop
View GitHub Profile
@BelmuTM
BelmuTM / optical_glasses_sellmeier.glsl
Last active October 2, 2026 22:39
Optical Glass Sellmeier Coefficients - Scraped from SCHOTT and Ohara databases
/***********************************************/
/* Copyright (c) 2026 Belmu */
/* All Rights Reserved */
/***********************************************/
/*
[References]:
SCHOTT. (2021). Downloads for Optical Glass. https://www.schott.com/en-be/products/optical-glass-p1000267/downloads
Ohara. (2025). Catalog Download. https://oharacorp.com/glass-catalog/
*/
@BelmuTM
BelmuTM / color_conversions.glsl
Last active October 8, 2026 06:00
GLSL Color Space Conversions
/********************************************************************************/
/* */
/* Copyright (C) 2026 Belmu */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 3 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
@BelmuTM
BelmuTM / complex.glsl
Last active October 14, 2024 00:05
Complex Float Operations
/*
[References]:
ProofWiki. (2018). Definition:Inverse Sine/Complex. https://proofwiki.org/wiki/Definition:Inverse_Sine/Complex
Jessie. (2021). open-source-utility-code. https://github.com/Jessie-LC/open-source-utility-code/blob/main/advanced/complexNumber.glsl
Wikipedia. (2023). Trigonométrie complexe. https://fr.m.wikipedia.org/wiki/Trigonom%C3%A9trie_complexe
*/
struct complexFloat {
float r;
float i;
@BelmuTM
BelmuTM / celestial_paths.glsl
Last active October 10, 2026 07:22
Accurate Sun and Moon Celestial Paths (Positions) Scaled to Minecraft Time
/*
[References]:
Museo Galileo. (2015). In-depth Ecliptic coordinates. https://catalogue.museogalileo.it/indepth/EclipticCoordinates.html#:~:text=The%20first%20of%20the%20two,celestial%20body%20and%20the%20ecliptic.
Strous, L. (2021). Astronomy Answers Positions in the Sky. https://aa.quae.nl/en/reken/hemelpositie.html
Strous, L. (2021). Astronomy Answers Position of the Sun. https://aa.quae.nl/en/reken/zonpositie.html
Wikipedia. (2024). Equation of the center. https://en.wikipedia.org/wiki/Equation_of_the_center
Wikipedia. (2024). Mean anomaly. https://en.wikipedia.org/wiki/Mean_anomaly
*/
/*
@BelmuTM
BelmuTM / sorting_algorithms.py
Last active August 25, 2024 21:33
Simple Python Sorting Algorithms
def quick_sort(s: list, start: int, end: int):
if start < end:
pos = start
for i in range(start, end):
if s[i] < s[end]:
s[i], s[pos] = s[pos], s[i]
pos += 1
s[pos], s[end] = s[end], s[pos]
@BelmuTM
BelmuTM / raytracer.glsl
Last active June 16, 2026 03:29
GLSL Screen Space Raytracer - Free to use for learning purposes
#define BINARY_REFINEMENT 1
#define BINARY_COUNT 4
#define BINARY_DECREASE 0.5
vec3 diagonal(mat4 mat) { return vec3(mat[0].x, mat[1].y, mat[2].z); }
vec3 projectionOrthogonal(mat4 mat, vec3 v) { return diagonal(mat) * v + mat[3].xyz; }
vec3 viewToScreen(vec3 viewPos) {
return (projectionOrthogonal(gbufferProjection, viewPosition) / -viewPosition.z) * 0.5 + 0.5;
}
@BelmuTM
BelmuTM / oren_nayar_diffuse.glsl
Last active May 1, 2022 02:05
Oren-Nayar Quantitative model - From the original paper
#define EPS 1e-4
#define PI 3.14159265
#define INV_PI 0.31830988
float maxEps(float x) { return max(EPS, x); }
float clamp01(float x) { return clamp(x, 0.0, 1.0); }
float pow2(float x) { return x*x; }
vec3 pow2(vec3 x) { return x*x; }