hq render

This commit is contained in:
MagicTINTIN 2023-03-21 20:37:28 +01:00
parent eaf480b473
commit 81c7a59bce

View file

@ -53,16 +53,21 @@ 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_Box_Frame(rotate(p,vec3(0.,.2*Time,0.)),vec3(.5,.5,.5),.1);
//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 min(SDF_Box_Frame(repeat(p, vec3(4.,2.,10.), vec3(2., 25., 4.)), vec3(1.,1.,1.),.1),p.y); //infinity(p, vec(0.3, 0.2, 0.5))
return min(SDF_Box_Frame(repeat(p, vec3(4.,2.,10.), vec3(2., 25., 4.)), vec3(1.,1.,1.),.1),SDF_Box(p,vec3(20.,0.1,50.))); //infinity(p, vec(0.3, 0.2, 0.5))
}
vec4 Get_Impact(vec3 origin,vec3 dir){//must have length(dir)==1
vec3 pos=origin;
float dist;
for(int i=0;i<60;i++){
for(int i=0;i<260;i++){
dist=SDF_Global(pos);
pos+=dist*dir;
if(dist<=.01) return vec4(pos,1.);