Skip to content

Instantly share code, notes, and snippets.

View zcyemi's full-sized avatar
⚗️
Transform code into magic

Zheng Chu zcyemi

⚗️
Transform code into magic
  • ECNU
  • Shanghai
View GitHub Profile
@zcyemi
zcyemi / octahedral.shader
Created January 25, 2025 08:06 — forked from pyalot/octahedral.shader
octahedral mapping
#define sectorize(value) step(0.0, (value))*2.0-1.0
#define sum(value) dot(clamp((value), 1.0, 1.0), (value))
#define PI 3.141592653589793
vec2 normalToUvRectOct(vec3 normal){
normal /= sum(abs(normal));
if(normal.y > 0.0){
return normal.xz*0.5+0.5;
}
else{