applying default sky

This commit is contained in:
MagicTINTIN 2023-03-21 14:17:45 +01:00
parent 14da88df99
commit 19664c384f
2 changed files with 8 additions and 4 deletions

View file

@ -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;

View file

@ -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;