Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
building an App

hamidbakhtiari hamid814

💭
building an App
View GitHub Profile
@hamid814
hamid814 / contrast.py
Created Jan 5, 2022
get contrast between two colors ( rgb )
View contrast.py
from math import pow
def x(v):
v /= 255
res = v / 12.92 if v <= 0.03928 else pow( (v + 0.055) / 1.055, 2.4 )
return res
def luminance(r, g, b):
@hamid814
hamid814 / FragmentShader.fs
Created Mar 17, 2021
Threejs mirror shader. Splits screen into four. Use in shaderpass
View FragmentShader.fs
uniform sampler2D tDiffuse;
varying vec2 vUv;
float map(float value, float min1, float max1, float min2, float max2) {
return min2 + (value - min1) * (max2 - min2) / (max1 - min1);
}
void main() {
vec2 doubleUv = vUv * 2.0;