feat: aspect ration correction

This commit is contained in:
2025-08-27 16:55:51 +02:00
parent 83fb5cd587
commit 8ae83ad7cd
2 changed files with 10 additions and 4 deletions

5
sdf.fs
View File

@@ -4,6 +4,8 @@ R"###(
out vec4 FragColor;
in vec2 texCoords;
uniform float aspect;
vec3 center = vec3(0.0,0.0,20.0);
float radius = 5.0;
@@ -89,6 +91,7 @@ vec3 calcNormal(Ray ray){
void main()
{
vec3 dir = vec3((texCoords - 0.5)*2,1.0);
dir.x *= aspect;
vec3 pos = dir;
Ray ray = Ray(normalize(dir),pos,.0,.0,vec3(.0));
@@ -97,7 +100,7 @@ void main()
vec3 normal = calcNormal(ray);
vec3 lighDir = normalize(vec3(.5,-1.0,0.5));
float light = (- min(dot(normal,lighDir),0.0))*0.7+0.3;
float light = (- min(dot(normal,lighDir),0.0))*0.85+0.3;
Ray shRay = Ray(lighDir * (-1.0), ray.pos + 0.5*normal , .0,.0, vec3(.0));
shRay = march(shRay);