interferences réalistes
This commit is contained in:
@ -47,27 +47,23 @@ void main() {
|
|||||||
float relX = (pixelX - center.x) * zoom;
|
float relX = (pixelX - center.x) * zoom;
|
||||||
float relY = (pixelY - center.y) * zoom;
|
float relY = (pixelY - center.y) * zoom;
|
||||||
|
|
||||||
|
|
||||||
// r^2
|
// r^2
|
||||||
float radiusSq = relX * relX + relY * relY;
|
float radiusSq = relX * relX + relY * relY;
|
||||||
|
|
||||||
// Diff de marche lamme d'air 2 * e cos(i) mais petits angles => cos(i) ~ 1 - i^2/2 mais i ~ r/f et r^2 = x^2 + y^2
|
|
||||||
float ringFactorBase = radiusSq * 0.065;
|
|
||||||
|
|
||||||
// Diff de marche du au coin d'air
|
// Diff de marche du au coin d'air
|
||||||
float wDelta = (relX * angleM1 + relY * angleM1_Y) * 200.0;
|
float wDelta = (relX * angleM1 + relY * angleM1_Y) * 200.0;
|
||||||
|
|
||||||
float currDeltaBase = deltaLnm + wDelta;
|
float cosFactor = 1.0 - (radiusSq * 0.000004);
|
||||||
|
|
||||||
float currDelta = deltaLnm - ringFactorBase + wDelta;
|
float currDelta = (deltaLnm * cosFactor) + wDelta;
|
||||||
|
|
||||||
vec3 accumColor = vec3(0.0);
|
vec3 accumColor = vec3(0.0);
|
||||||
|
|
||||||
for(int i = 0; i < 10; i++) {
|
for(int i = 0; i < 10; i++) {
|
||||||
if (i >= lambdasCount) break;
|
if (i >= lambdasCount) break;
|
||||||
float l = lambdas[i];
|
float l = lambdas[i];
|
||||||
|
if (l < 1.0) l = 550.0;
|
||||||
vec3 baseColorVec = WavelengthToRGB(l);
|
vec3 baseColorVec = WavelengthToRGB(l);
|
||||||
float currDelta = currDeltaBase - ringFactorBase;
|
|
||||||
float K = PI / l;
|
float K = PI / l;
|
||||||
float phase = currDelta * K;
|
float phase = currDelta * K;
|
||||||
float intensity = cos(phase);
|
float intensity = cos(phase);
|
||||||
|
|||||||
@ -45,9 +45,12 @@ void main() {
|
|||||||
float relY = (pixelY - center.y) * zoom;
|
float relY = (pixelY - center.y) * zoom;
|
||||||
|
|
||||||
float radiusSq = relX * relX + relY * relY;
|
float radiusSq = relX * relX + relY * relY;
|
||||||
float ringFactorBase = radiusSq * 0.065;
|
|
||||||
float wDelta = (relX * angleM1 + relY * angleM1_Y) * 200.0;
|
float wDelta = (relX * angleM1 + relY * angleM1_Y) * 200.0;
|
||||||
float currDeltaBase = deltaLnm + wDelta;
|
|
||||||
|
float cosFactor = 1.0 - (radiusSq * 0.000004);
|
||||||
|
|
||||||
|
float currDelta = (deltaLnm * cosFactor) + wDelta;
|
||||||
|
|
||||||
vec3 accumColor = vec3(0.0);
|
vec3 accumColor = vec3(0.0);
|
||||||
|
|
||||||
@ -55,15 +58,16 @@ void main() {
|
|||||||
if (i >= lambdasCount) break;
|
if (i >= lambdasCount) break;
|
||||||
|
|
||||||
float l = lambdas[i];
|
float l = lambdas[i];
|
||||||
|
|
||||||
if (l < 1.0) l = 550.0;
|
if (l < 1.0) l = 550.0;
|
||||||
|
|
||||||
vec3 baseColorVec = WavelengthToRGB(l);
|
vec3 baseColorVec = WavelengthToRGB(l);
|
||||||
float currDelta = currDeltaBase - ringFactorBase;
|
|
||||||
float K = PI / l;
|
float K = PI / l;
|
||||||
float phase = currDelta * K;
|
float phase = currDelta * K;
|
||||||
|
|
||||||
float intensity = cos(phase);
|
float intensity = cos(phase);
|
||||||
intensity = intensity * intensity;
|
intensity = intensity * intensity;
|
||||||
|
|
||||||
accumColor += baseColorVec * intensity;
|
accumColor += baseColorVec * intensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
main.c
2
main.c
@ -571,7 +571,7 @@ int main () {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
mic.center = (Vector2){ UI_WIDTH + (1920 - UI_WIDTH) / 2.0f - 100, 1080 / 2.0f };
|
mic.center = (Vector2){ UI_WIDTH + (1920 - UI_WIDTH) / 2.0f - 100, 1080 / 2.0f };
|
||||||
mic.d1 = 250.0f;
|
mic.d1 = 300.0f;
|
||||||
mic.d2 = 250.0f;
|
mic.d2 = 250.0f;
|
||||||
mic.lambdas[0] = 550.0f;
|
mic.lambdas[0] = 550.0f;
|
||||||
mic.lambdasCount = 1;
|
mic.lambdasCount = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user