Replaced normal computation.
Didn't solve the problem at hand though
This commit is contained in:
parent
c33efde305
commit
1fb3fac7da
2 changed files with 17 additions and 10 deletions
|
@ -8,13 +8,19 @@ vec2 RM_Map( in vec3 pos );
|
||||||
vec3 RM_GetNormal(
|
vec3 RM_GetNormal(
|
||||||
in vec3 pos )
|
in vec3 pos )
|
||||||
{
|
{
|
||||||
vec2 v = vec2( .0005 , 0 );
|
const vec2 e = vec2( 1 , -1 ) * .0001;
|
||||||
return normalize( vec3(
|
const vec4 f = vec4(
|
||||||
RM_Map( pos + v.xyy ).x - RM_Map( pos - v.xyy ).x ,
|
RM_Map( pos + e.xyy ).x ,
|
||||||
RM_Map( pos + v.yxy ).x - RM_Map( pos - v.yxy ).x ,
|
RM_Map( pos + e.yyx ).x ,
|
||||||
RM_Map( pos + v.yyx ).x - RM_Map( pos - v.yyx ).x ) );
|
RM_Map( pos + e.yxy ).x ,
|
||||||
|
RM_Map( pos + e.xxx ).x );
|
||||||
|
return normalize( f.x * e.xyy
|
||||||
|
+ f.y * e.yyx
|
||||||
|
+ f.z * e.yxy
|
||||||
|
+ f.w * e.xxx );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
vec3 RM_Basic(
|
vec3 RM_Basic(
|
||||||
|
|
|
@ -18,7 +18,7 @@ T_PBRMaterial PBRMaterials[1] = {
|
||||||
// Albedo color
|
// Albedo color
|
||||||
vec3( .8 , 1 , .8 ) ,
|
vec3( .8 , 1 , .8 ) ,
|
||||||
// Roughness , metallic , subsurface , anisotropy
|
// Roughness , metallic , subsurface , anisotropy
|
||||||
.2 , .7 , .7 , .7 ,
|
.2 , .8 , .5 , .0 ,
|
||||||
// Specular strength / tint%
|
// Specular strength / tint%
|
||||||
.5 , .5
|
.5 , .5
|
||||||
}
|
}
|
||||||
|
@ -49,9 +49,10 @@ vec2 RM_Map( vec3 pos )
|
||||||
vec3 q = pos;
|
vec3 q = pos;
|
||||||
HG_pMod2( q.xy , vec2( 8. ) );
|
HG_pMod2( q.xy , vec2( 8. ) );
|
||||||
HG_pR( q.xz , 1 );
|
HG_pR( q.xz , 1 );
|
||||||
return vec2( mix( HG_fBox( q , vec3( 1.5 ) ) ,
|
return vec2( HG_fOpUnionColumns(
|
||||||
|
HG_fBox( q , vec3( 1.5 ) ) ,
|
||||||
HG_fSphere( q , 1.5 ) ,
|
HG_fSphere( q , 1.5 ) ,
|
||||||
.35 ) ,
|
1. , 8 ) ,
|
||||||
step( 0. , -HG_fSphere( pos , 3 ) ) );
|
step( 0. , -HG_fSphere( pos , 3 ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue