applying default sky
This commit is contained in:
parent
14da88df99
commit
19664c384f
2 changed files with 8 additions and 4 deletions
|
@ -53,9 +53,13 @@ float SDF_Sphere(vec3 p,float r){
|
||||||
return length(p)-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){
|
float SDF_Global(vec3 p){
|
||||||
return SDF_Sphere(p,.5);
|
return max(SDF_Sphere(p,1.),-SDF_Box_Frame(rotate(p,vec3(1.*Time,2.0*Time,3.*Time)),vec3(.8,.8,.8),.2));
|
||||||
//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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 Get_Impact(vec3 origin,vec3 dir){//must have length(dir)==1
|
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){
|
vec3 Get_Color(vec3 origin,vec3 dir){
|
||||||
vec4 impact = Get_Impact(origin,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 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));
|
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;
|
return vec3(clamp(0.,1.,dot(sunPos-impact.xyz,normale)));//normale;
|
||||||
|
|
|
@ -80,7 +80,7 @@ vec3 grad(vec3 p){
|
||||||
|
|
||||||
vec3 Get_Color(vec3 origin,vec3 dir){
|
vec3 Get_Color(vec3 origin,vec3 dir){
|
||||||
vec4 impact = Get_Impact(origin,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 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));
|
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;
|
return vec3(clamp(0.,1.,dot(sunPos-impact.xyz,normale)));//normale;
|
||||||
|
|
Loading…
Reference in a new issue