Skip to content

Instantly share code, notes, and snippets.

View hamid814's full-sized avatar
💭
building an App

hamidbakhtiari hamid814

💭
building an App
View GitHub Profile
@hamid814
hamid814 / FragmentShader.fs
Created March 17, 2021 14:57
Threejs mirror shader. Splits screen into four. Use in shaderpass
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;
@hamid814
hamid814 / contrast.py
Created January 5, 2022 12:19
get contrast between two colors ( rgb )
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):