mirror of
https://github.com/FMS-Cat/condition.git
synced 2025-08-21 12:51:57 +02:00
aesthetics: improve opening
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -80,8 +80,8 @@ export class Condition extends Entity {
|
|||||||
arrayIter.push(
|
arrayIter.push(
|
||||||
( tablePos[ j * 2 + 0 ] + 0.5 ) / 7.0,
|
( tablePos[ j * 2 + 0 ] + 0.5 ) / 7.0,
|
||||||
tablePos[ j * 2 + 1 ],
|
tablePos[ j * 2 + 1 ],
|
||||||
i,
|
i / 16.0,
|
||||||
j,
|
j / 12.0,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ import cubeFrag from '../shaders/cube.frag';
|
|||||||
import cubeVert from '../shaders/cube.vert';
|
import cubeVert from '../shaders/cube.vert';
|
||||||
import depthFrag from '../shaders/depth.frag';
|
import depthFrag from '../shaders/depth.frag';
|
||||||
|
|
||||||
const PRIMCOUNT = 512;
|
const PRIMCOUNT = 64;
|
||||||
|
|
||||||
export class Cube extends Entity {
|
export class Cube extends Entity {
|
||||||
public mesh: Mesh;
|
public mesh: Mesh;
|
||||||
@@ -32,7 +32,7 @@ export class Cube extends Entity {
|
|||||||
|
|
||||||
this.transform.position = new Vector3( [ 0.0, 0.0, 0.0 ] );
|
this.transform.position = new Vector3( [ 0.0, 0.0, 0.0 ] );
|
||||||
this.transform.rotation = rot0;
|
this.transform.rotation = rot0;
|
||||||
this.transform.scale = this.transform.scale.scale( 0.2 );
|
this.transform.scale = this.transform.scale.scale( 0.3 );
|
||||||
|
|
||||||
// -- geometry ---------------------------------------------------------------------------------
|
// -- geometry ---------------------------------------------------------------------------------
|
||||||
const cube = genCube();
|
const cube = genCube();
|
||||||
|
@@ -38,7 +38,7 @@ void main() {
|
|||||||
float phase = fract( 2.0 * vPhase + 0.01 * vHuh.z + 0.1 * time + 0.1 * vHuh.y + phaseOffset );
|
float phase = fract( 2.0 * vPhase + 0.01 * vHuh.z + 0.1 * time + 0.1 * vHuh.y + phaseOffset );
|
||||||
if ( phase > phaseWidth ) { discard; }
|
if ( phase > phaseWidth ) { discard; }
|
||||||
|
|
||||||
vec3 color = 2.0 * vec3( exp( -0.2 * vHuh.z ) );
|
vec3 color = vec3( 2.0 );
|
||||||
|
|
||||||
#ifdef FORWARD
|
#ifdef FORWARD
|
||||||
fragColor = vec4( color, 1.0 );
|
fragColor = vec4( color, 1.0 );
|
||||||
|
@@ -26,7 +26,7 @@ void main() {
|
|||||||
|
|
||||||
vec4 tex = texture( samplerSvg, vec2( what.x, huh.x ) );
|
vec4 tex = texture( samplerSvg, vec2( what.x, huh.x ) );
|
||||||
|
|
||||||
vPosition = vec4( tex.xy + vec2( huh.y, 0.0 ), 6.0 - 12.0 * huh.z, 1.0 );
|
vPosition = vec4( tex.xy + vec2( huh.y, 0.0 ), 60.0 - 120.0 * huh.z, 1.0 );
|
||||||
|
|
||||||
mat3 basis = orthBasis( vec3( tex.zw, 0.0 ) );
|
mat3 basis = orthBasis( vec3( tex.zw, 0.0 ) );
|
||||||
float theta = what.y / 3.0 * TAU;
|
float theta = what.y / 3.0 * TAU;
|
||||||
@@ -35,7 +35,9 @@ void main() {
|
|||||||
|
|
||||||
vPosition.xyz += tube;
|
vPosition.xyz += tube;
|
||||||
|
|
||||||
vec4 outPos = projectionMatrix * viewMatrix * modelMatrix * vPosition;
|
vPosition = modelMatrix * vPosition;
|
||||||
|
|
||||||
|
vec4 outPos = projectionMatrix * viewMatrix * vPosition;
|
||||||
outPos.x *= resolution.y / resolution.x;
|
outPos.x *= resolution.y / resolution.x;
|
||||||
gl_Position = outPos;
|
gl_Position = outPos;
|
||||||
|
|
||||||
|
@@ -25,12 +25,7 @@ void main() {
|
|||||||
|
|
||||||
vPositionWithoutModel = vec4( position, 1.0 );
|
vPositionWithoutModel = vec4( position, 1.0 );
|
||||||
|
|
||||||
vec3 clapScaleSeed = vec3( 14.0, 5.2, 8.7 ) + 100.0 * instanceId;
|
vec3 clapScale = fs( vec3( 14.0, 5.2, 8.7 ) + 100.0 * instanceId );
|
||||||
vec3 clapScale = mix(
|
|
||||||
fs( clapScaleSeed + floor( clap ) ),
|
|
||||||
fs( clapScaleSeed + floor( clap + 1.0 ) ),
|
|
||||||
fract( clap )
|
|
||||||
);
|
|
||||||
vPositionWithoutModel.xyz *= clapScale;
|
vPositionWithoutModel.xyz *= clapScale;
|
||||||
|
|
||||||
vPosition = vPositionWithoutModel;
|
vPosition = vPositionWithoutModel;
|
||||||
|
@@ -110,6 +110,8 @@ struct AngularInfo {
|
|||||||
vec3 V;
|
vec3 V;
|
||||||
vec3 L;
|
vec3 L;
|
||||||
vec3 H;
|
vec3 H;
|
||||||
|
float lenL;
|
||||||
|
float lenV;
|
||||||
float dotNV;
|
float dotNV;
|
||||||
float dotNL;
|
float dotNL;
|
||||||
float dotNH;
|
float dotNH;
|
||||||
@@ -118,8 +120,14 @@ struct AngularInfo {
|
|||||||
|
|
||||||
AngularInfo genAngularInfo( Isect isect ) {
|
AngularInfo genAngularInfo( Isect isect ) {
|
||||||
AngularInfo aI;
|
AngularInfo aI;
|
||||||
aI.V = normalize( cameraPos - isect.position );
|
aI.V = cameraPos - isect.position;
|
||||||
aI.L = normalize( lightPos - isect.position );
|
aI.lenV = length( aI.V );
|
||||||
|
aI.V = normalize( aI.V );
|
||||||
|
|
||||||
|
aI.L = lightPos - isect.position;
|
||||||
|
aI.lenL = length( aI.L );
|
||||||
|
aI.L = normalize( aI.L );
|
||||||
|
|
||||||
aI.H = normalize( aI.V + aI.L );
|
aI.H = normalize( aI.V + aI.L );
|
||||||
aI.dotNV = clamp( dot( isect.normal, aI.V ), EPSILON, 1.0 );
|
aI.dotNV = clamp( dot( isect.normal, aI.V ), EPSILON, 1.0 );
|
||||||
aI.dotNL = clamp( dot( isect.normal, aI.L ), EPSILON, 1.0 );
|
aI.dotNL = clamp( dot( isect.normal, aI.L ), EPSILON, 1.0 );
|
||||||
@@ -175,8 +183,7 @@ vec3 shadePBR( Isect isect, AngularInfo aI ) {
|
|||||||
float ao = texture( samplerAo, isect.screenUv ).x;
|
float ao = texture( samplerAo, isect.screenUv ).x;
|
||||||
shadow *= ao;
|
shadow *= ao;
|
||||||
|
|
||||||
float lenL = length( isect.position - lightPos );
|
float decayL = 1.0 / ( aI.lenL * aI.lenL );
|
||||||
float decay = 1.0 / ( lenL * lenL );
|
|
||||||
|
|
||||||
vec3 albedo = mix( isect.color * ONE_SUB_DIELECTRIC_SPECULAR, vec3( 0.0 ), metallic );
|
vec3 albedo = mix( isect.color * ONE_SUB_DIELECTRIC_SPECULAR, vec3( 0.0 ), metallic );
|
||||||
vec3 f0 = mix( DIELECTRIC_SPECULAR, isect.color, metallic );
|
vec3 f0 = mix( DIELECTRIC_SPECULAR, isect.color, metallic );
|
||||||
@@ -184,7 +191,7 @@ vec3 shadePBR( Isect isect, AngularInfo aI ) {
|
|||||||
vec3 diffuse = brdfLambert( f0, albedo, aI.dotVH );
|
vec3 diffuse = brdfLambert( f0, albedo, aI.dotVH );
|
||||||
vec3 spec = brdfSpecularGGX( f0, roughness, aI.dotVH, aI.dotNL, aI.dotNV, aI.dotNH );
|
vec3 spec = brdfSpecularGGX( f0, roughness, aI.dotVH, aI.dotNL, aI.dotNV, aI.dotNH );
|
||||||
|
|
||||||
vec3 shade = PI * lightColor * decay * shadow * aI.dotNL * ( diffuse + spec );
|
vec3 shade = PI * lightColor * decayL * shadow * aI.dotNL * ( diffuse + spec );
|
||||||
|
|
||||||
vec3 color = shade;
|
vec3 color = shade;
|
||||||
|
|
||||||
@@ -253,6 +260,8 @@ void main() {
|
|||||||
|
|
||||||
vec3 color = vec3( 0.0 );
|
vec3 color = vec3( 0.0 );
|
||||||
|
|
||||||
|
AngularInfo aI = genAngularInfo( isect );
|
||||||
|
|
||||||
if ( isect.materialId == MTL_NONE ) {
|
if ( isect.materialId == MTL_NONE ) {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|
||||||
@@ -262,14 +271,12 @@ void main() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else if ( isect.materialId == MTL_PBR ) {
|
} else if ( isect.materialId == MTL_PBR ) {
|
||||||
AngularInfo aI = genAngularInfo( isect );
|
|
||||||
color = shadePBR( isect, aI );
|
color = shadePBR( isect, aI );
|
||||||
|
|
||||||
} else if ( isect.materialId == MTL_GRADIENT ) {
|
} else if ( isect.materialId == MTL_GRADIENT ) {
|
||||||
color = shadeGradient( isect );
|
color = shadeGradient( isect );
|
||||||
|
|
||||||
} else if ( isect.materialId == MTL_IRIDESCENT ) {
|
} else if ( isect.materialId == MTL_IRIDESCENT ) {
|
||||||
AngularInfo aI = genAngularInfo( isect );
|
|
||||||
isect.color *= mix(
|
isect.color *= mix(
|
||||||
vec3( 1.0 ),
|
vec3( 1.0 ),
|
||||||
catColor( isect.materialParams.x * aI.dotNV ),
|
catColor( isect.materialParams.x * aI.dotNV ),
|
||||||
@@ -280,6 +287,8 @@ void main() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
color *= exp( -0.4 * max( aI.lenV - 3.0, 0.0 ) );
|
||||||
|
|
||||||
#ifdef IS_FIRST_LIGHT
|
#ifdef IS_FIRST_LIGHT
|
||||||
// color = 0.5 + 0.5 * isect.normal;
|
// color = 0.5 + 0.5 * isect.normal;
|
||||||
// color = vec3( calcDepth( tex0.xyz ) );
|
// color = vec3( calcDepth( tex0.xyz ) );
|
||||||
|
@@ -37,21 +37,6 @@ vec2 uvInvT( vec2 _uv ) {
|
|||||||
|
|
||||||
// ------
|
// ------
|
||||||
|
|
||||||
#pragma glslify: distFunc = require( ./-distFunc );
|
|
||||||
|
|
||||||
float fDistFunc( vec3 p ) {
|
|
||||||
return distFunc( p, time );
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 normalFunc( vec3 p, float dd ) {
|
|
||||||
vec2 d = vec2( 0.0, dd );
|
|
||||||
return normalize( vec3(
|
|
||||||
fDistFunc( p + d.yxx ) - fDistFunc( p - d.yxx ),
|
|
||||||
fDistFunc( p + d.xyx ) - fDistFunc( p - d.xyx ),
|
|
||||||
fDistFunc( p + d.xxy ) - fDistFunc( p - d.xxy )
|
|
||||||
) );
|
|
||||||
}
|
|
||||||
|
|
||||||
mat2 rotate2D( float _t ) {
|
mat2 rotate2D( float _t ) {
|
||||||
return mat2( cos( _t ), sin( _t ), -sin( _t ), cos( _t ) );
|
return mat2( cos( _t ), sin( _t ), -sin( _t ), cos( _t ) );
|
||||||
}
|
}
|
||||||
@@ -137,7 +122,7 @@ void main() {
|
|||||||
) {
|
) {
|
||||||
dt = time - timing;
|
dt = time - timing;
|
||||||
|
|
||||||
pos = 0.5 * randomSphere( seed );
|
pos = 15.0 * randomSphere( seed );
|
||||||
|
|
||||||
vel = 1.0 * randomSphere( seed );
|
vel = 1.0 * randomSphere( seed );
|
||||||
|
|
||||||
@@ -148,19 +133,14 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// == update particles ===========================================================================
|
// == update particles ===========================================================================
|
||||||
// distFunc
|
|
||||||
float dist = fDistFunc( pos.xyz ) - 0.2;
|
|
||||||
vec3 nor = normalFunc( pos.xyz, 1E-4 );
|
|
||||||
vel -= dt * 100.0 * dist * nor;
|
|
||||||
|
|
||||||
// spin around center
|
// spin around center
|
||||||
vel.zx += dt * 20.0 * vec2( -1.0, 1.0 ) * normalize( nor.xz );
|
// vel.zx += dt * 20.0 * vec2( -1.0, 1.0 ) * normalize( nor.xz );
|
||||||
|
|
||||||
// noise field
|
// noise field
|
||||||
vel += 40.0 * vec3(
|
vel += 40.0 * vec3(
|
||||||
noise( vec4( pos.xyz, 1.485 + sin( time * 0.1 ) + noisePhase ) ),
|
noise( vec4( 0.1 * pos.xyz, 1.485 + sin( time * 0.1 ) + noisePhase ) ),
|
||||||
noise( vec4( pos.xyz, 3.485 + sin( time * 0.1 ) + noisePhase ) ),
|
noise( vec4( 0.1 * pos.xyz, 3.485 + sin( time * 0.1 ) + noisePhase ) ),
|
||||||
noise( vec4( pos.xyz, 5.485 + sin( time * 0.1 ) + noisePhase ) )
|
noise( vec4( 0.1 * pos.xyz, 5.485 + sin( time * 0.1 ) + noisePhase ) )
|
||||||
) * dt;
|
) * dt;
|
||||||
|
|
||||||
// resistance
|
// resistance
|
||||||
|
@@ -40,7 +40,7 @@ void main() {
|
|||||||
#ifdef DEFERRED
|
#ifdef DEFERRED
|
||||||
fragPosition = vPosition;
|
fragPosition = vPosition;
|
||||||
fragNormal = vec4( vNormal, 1.0 );
|
fragNormal = vec4( vNormal, 1.0 );
|
||||||
fragColor = vec4( vColor.xyz, 1.0 );
|
fragColor = vec4( 0.01 * vColor.xyz, 1.0 );
|
||||||
fragWTF = vec4( vec3( 0.9, 0.1, 0.0 ), MTL_PBR );
|
fragWTF = vec4( vec3( 0.9, 0.1, 100.0 ), MTL_PBR );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,7 @@ void main() {
|
|||||||
// == compute size ===============================================================================
|
// == compute size ===============================================================================
|
||||||
vPosition = vec4( tex0.xyz, 1.0 );
|
vPosition = vec4( tex0.xyz, 1.0 );
|
||||||
|
|
||||||
float size = vDice.x * 0.05;
|
float size = vDice.x * 0.01;
|
||||||
size *= sin( PI * saturate( vLife ) );
|
size *= sin( PI * saturate( vLife ) );
|
||||||
|
|
||||||
vec3 shape = position * size;
|
vec3 shape = position * size;
|
||||||
|
@@ -32,21 +32,6 @@ uniform float noisePhase;
|
|||||||
|
|
||||||
// ------
|
// ------
|
||||||
|
|
||||||
#pragma glslify: distFunc = require( ./-distFunc );
|
|
||||||
|
|
||||||
float fDistFunc( vec3 p ) {
|
|
||||||
return distFunc( p, time );
|
|
||||||
}
|
|
||||||
|
|
||||||
vec3 normalFunc( vec3 p, float dd ) {
|
|
||||||
vec2 d = vec2( 0.0, dd );
|
|
||||||
return normalize( vec3(
|
|
||||||
fDistFunc( p + d.yxx ) - fDistFunc( p - d.yxx ),
|
|
||||||
fDistFunc( p + d.xyx ) - fDistFunc( p - d.xyx ),
|
|
||||||
fDistFunc( p + d.xxy ) - fDistFunc( p - d.xxy )
|
|
||||||
) );
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 uvInvT( vec2 _uv ) {
|
vec2 uvInvT( vec2 _uv ) {
|
||||||
return vec2( 0.0, 1.0 ) + vec2( 1.0, -1.0 ) * _uv;
|
return vec2( 0.0, 1.0 ) + vec2( 1.0, -1.0 ) * _uv;
|
||||||
}
|
}
|
||||||
@@ -171,14 +156,6 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// == update particles ===========================================================================
|
// == update particles ===========================================================================
|
||||||
// distFunc
|
|
||||||
float dist = fDistFunc( pos.xyz ) - 0.2;
|
|
||||||
vec3 nor = normalFunc( pos.xyz, 1E-4 );
|
|
||||||
vel -= dt * 100.0 * dist * nor;
|
|
||||||
|
|
||||||
// spin around center
|
|
||||||
vel.zx += dt * 20.0 * vec2( -1.0, 1.0 ) * normalize( nor.xz );
|
|
||||||
|
|
||||||
// noise field
|
// noise field
|
||||||
vel += 40.0 * vec3(
|
vel += 40.0 * vec3(
|
||||||
noise( vec4( pos.xyz, 1.485 + sin( time * 0.1 ) + noisePhase ) ),
|
noise( vec4( pos.xyz, 1.485 + sin( time * 0.1 ) + noisePhase ) ),
|
||||||
|
Reference in New Issue
Block a user