feat: aspect ration correction
This commit is contained in:
5
sdf.fs
5
sdf.fs
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user