From 19664c384ff98fb3a613e291179800e7202f5d02 Mon Sep 17 00:00:00 2001 From: MagicTINTIN Date: Tue, 21 Mar 2023 14:17:45 +0100 Subject: [PATCH] applying default sky --- shaders/default.fs | 10 +++++++--- shaders/immeublesparisiens.fs | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/shaders/default.fs b/shaders/default.fs index f05aa1b..0501b90 100644 --- a/shaders/default.fs +++ b/shaders/default.fs @@ -53,9 +53,13 @@ float SDF_Sphere(vec3 p,float r){ return length(p)-r; } +float SDF_Box(vec3 p, vec3 t){ + vec3 q=abs(p)-t; + return length(max(q,0.0))+ min(max(q.x,max(q.y,q.z)),0.0); +} + float SDF_Global(vec3 p){ - return SDF_Sphere(p,.5); - //return max(SDF_Sphere(p,.5),-SDF_Box_Frame(rotate(p,vec3(0.,.2*Time,0.)),vec3(1.,1.,1.),.3));//min(SDF_Box_Frame(p,vec3(.5,.5,.5),0.1),SDF_Circle(mod(p+vec3(.5),vec3(1.,1.,1.))-vec3(.5),.15)); + return max(SDF_Sphere(p,1.),-SDF_Box_Frame(rotate(p,vec3(1.*Time,2.0*Time,3.*Time)),vec3(.8,.8,.8),.2)); } vec4 Get_Impact(vec3 origin,vec3 dir){//must have length(dir)==1 @@ -79,7 +83,7 @@ vec3 grad(vec3 p){ vec3 Get_Color(vec3 origin,vec3 dir){ vec4 impact = Get_Impact(origin,dir); - if(impact.w<0.) return (impact.y+1.)*.05*vec3(.5,.7,1.); + if(impact.w<0.) return vec3(.5,.8,.9)+.5*dir.y+.05*clamp(origin.y-10.,-10.,10.);//(impact.y+1.)*.05*vec3(.5,.7,1.); vec3 normale=grad(impact.xyz); vec3 sunPos=vec3(3.,3.5,.5);//vec3(3.*sin(Time*1.5),3.*cos(Time*3.),3.*cos(Time*1.5)); return vec3(clamp(0.,1.,dot(sunPos-impact.xyz,normale)));//normale; diff --git a/shaders/immeublesparisiens.fs b/shaders/immeublesparisiens.fs index 99ec4f8..8a538df 100644 --- a/shaders/immeublesparisiens.fs +++ b/shaders/immeublesparisiens.fs @@ -80,7 +80,7 @@ vec3 grad(vec3 p){ vec3 Get_Color(vec3 origin,vec3 dir){ vec4 impact = Get_Impact(origin,dir); - if(impact.w<0.) return (impact.y+1.)*.05*vec3(.5,.7,1.); + if(impact.w<0.) return vec3(.5,.8,.9)+.5*dir.y+.05*clamp(origin.y-10.,-10.,10.); vec3 normale=grad(impact.xyz); vec3 sunPos=vec3(3.,3.5,.5);//vec3(3.*sin(Time*1.5),3.*cos(Time*3.),3.*cos(Time*1.5)); return vec3(clamp(0.,1.,dot(sunPos-impact.xyz,normale)));//normale;