aesthetics: update condition

This commit is contained in:
FMS-Cat
2021-03-27 20:19:32 +09:00
parent 5443eb38b5
commit b57ca265cb
2 changed files with 17 additions and 2 deletions

View File

@@ -2,11 +2,14 @@
precision highp float;
const float RADIUS_CULL_SPHERE = 1.5;
const int MTL_UNLIT = 1;
#define saturate(i) clamp(i,0.,1.)
#define linearstep(a,b,x) saturate(((x)-(a))/((b)-(a)))
in float vScale;
in float vPhase;
in vec3 vNormal;
in vec4 vPosition;
@@ -35,10 +38,18 @@ uniform float phaseOffset;
uniform float phaseWidth;
void main() {
float phase = fract( 2.0 * vPhase + vHuh.z + 0.1 * time + vHuh.y + phaseOffset );
float phase = fract( 2.0 * vPhase + vHuh.z + 0.1 * time + vHuh.y + phaseOffset / vScale );
if ( phase > phaseWidth ) { discard; }
vec3 color = vec3( 2.0 );
float lenFromCenter = length( vPosition.xyz );
if ( lenFromCenter < RADIUS_CULL_SPHERE ) { discard; }
float colorPhase = exp( -4.0 * ( lenFromCenter - RADIUS_CULL_SPHERE ) );
vec3 color = mix(
vec3( 2.0 ),
vec3( 0.0 ),
colorPhase
);
#ifdef FORWARD
fragColor = vec4( color, 1.0 );

View File

@@ -8,6 +8,7 @@ layout (location = 0) in vec2 what;
layout (location = 1) in vec4 huh;
out float vPhase;
out float vScale;
out vec3 vNormal;
out vec4 vPosition;
out vec4 vHuh;
@@ -36,6 +37,9 @@ void main() {
vec3 tube = 0.1 * basis * vec3( sin( theta ), cos( theta ), 0.0 );
vNormal = ( normalMatrix * vec4( tube, 1.0 ) ).xyz;
vScale = exp( 2.0 * fs( huh.z + 2.56 * huh.y ) );
vPosition.xyz *= vScale;
vPosition.xyz += tube;
vPosition = modelMatrix * vPosition;