aesthetics: wub wub

This commit is contained in:
FMS-Cat
2021-03-22 04:31:54 +09:00
parent 8cf33db4a2
commit cac046e36f
8 changed files with 157 additions and 118 deletions

File diff suppressed because one or more lines are too long

View File

@@ -2,7 +2,7 @@ export const
RTINSPECTOR_MULTIPLE = false,
RTINSPECTOR_CAPTURE_NAME: string | null = null,
// RTINSPECTOR_CAPTURE_NAME: string | null = 'light1/shadowMap',
// RTINSPECTOR_CAPTURE_NAME: string | null = 'EnvironmentMap/swap1',
// RTINSPECTOR_CAPTURE_NAME: string | null = 'CameraEntity/cameraTarget',
RTINSPECTOR_CAPTURE_INDEX = 0,
COMPONENT_UPDATE_BREAKPOINT: string | null = null,
// COMPONENT_UPDATE_BREAKPOINT: string | null = 'EnvironmentMap/quadIntegrate',

View File

@@ -8,6 +8,7 @@ import quadVert from '../shaders/quad.vert';
import raymarcherFrag from '../shaders/raymarcher.frag';
import { Lambda } from '../heck/components/Lambda';
import { randomTexture, randomTextureStatic } from '../globals/randomTexture';
import { auto } from '../globals/automaton';
export class Raymarcher {
public materials: MaterialMap<'deferred' | 'shadow'>;
@@ -45,10 +46,14 @@ export class Raymarcher {
'Matrix4fv',
event.projectionMatrix.multiply( event.viewMatrix ).inverse!.elements
);
material.addUniform( 'deformAmp', '1f', auto( 'Music/NEURO_WUB_AMP' ) );
material.addUniform( 'deformFreq', '1f', auto( 'Music/NEURO_WUB_FREQ' ) );
material.addUniform( 'deformTime', '1f', auto( 'Music/NEURO_TIME' ) );
}
},
active: false,
name: process.env.DEV && 'Raymarcher/setCameraUniforms',
name: process.env.DEV && 'Raymarcher/updater',
} ) );
this.mesh = new Mesh( {

View File

@@ -73,7 +73,7 @@ class EntityReplacer<T extends { entity: Entity }> {
// -- bake -----------------------------------------------------------------------------------------
const ibllut = new IBLLUT();
// dog.root.children.push( ibllut.entity );
dog.root.children.push( ibllut.entity );
// -- "objects" ------------------------------------------------------------------------------------
// const replacerSphereParticles = new EntityReplacer( () => new SphereParticles() );
@@ -90,12 +90,12 @@ const ibllut = new IBLLUT();
// } );
// }
// const replacerRings = new EntityReplacer( () => new Rings() );
// if ( process.env.DEV && module.hot ) {
// module.hot.accept( './entities/Rings', () => {
// replacerRings.replace();
// } );
// }
const replacerRings = new EntityReplacer( () => new Rings() );
if ( process.env.DEV && module.hot ) {
module.hot.accept( './entities/Rings', () => {
replacerRings.replace();
} );
}
// const replacerCube = new EntityReplacer( () => new Cube() );
// if ( process.env.DEV && module.hot ) {
@@ -104,19 +104,19 @@ const ibllut = new IBLLUT();
// } );
// }
// const replacerFlickyParticles = new EntityReplacer( () => new FlickyParticles() );
// if ( process.env.DEV && module.hot ) {
// module.hot.accept( './entities/FlickyParticles', () => {
// replacerFlickyParticles.replace();
// } );
// }
const replacerFlickyParticles = new EntityReplacer( () => new FlickyParticles() );
if ( process.env.DEV && module.hot ) {
module.hot.accept( './entities/FlickyParticles', () => {
replacerFlickyParticles.replace();
} );
}
// const replacerRaymarcher = new EntityReplacer( () => new Raymarcher() );
// if ( process.env.DEV && module.hot ) {
// module.hot.accept( './entities/Raymarcher', () => {
// replacerRaymarcher.replace();
// } );
// }
const replacerRaymarcher = new EntityReplacer( () => new Raymarcher() );
if ( process.env.DEV && module.hot ) {
module.hot.accept( './entities/Raymarcher', () => {
replacerRaymarcher.replace();
} );
}
// -- things that is not an "object" ---------------------------------------------------------------
const swapOptions = {
@@ -135,16 +135,16 @@ const swap = new Swap(
} ),
);
// const light = new LightEntity( {
// root: dog.root,
// shadowMapFov: 90.0,
// shadowMapNear: 1.0,
// shadowMapFar: 20.0,
// namePrefix: process.env.DEV && 'light1',
// } );
// light.color = [ 40.0, 40.0, 40.0 ];
// light.entity.transform.lookAt( new Vector3( [ -1.0, 2.0, 8.0 ] ) );
// dog.root.children.push( light.entity );
const light = new LightEntity( {
root: dog.root,
shadowMapFov: 90.0,
shadowMapNear: 1.0,
shadowMapFar: 20.0,
namePrefix: process.env.DEV && 'light1',
} );
light.color = [ 30.0, 1.0, 5.0 ];
light.entity.transform.lookAt( new Vector3( [ -1.0, 2.0, 8.0 ] ) );
dog.root.children.push( light.entity );
// const light2 = new LightEntity( {
// root: dog.root,
@@ -157,83 +157,83 @@ const swap = new Swap(
// light2.entity.transform.lookAt( new Vector3( [ -4.0, -2.0, 6.0 ] ) );
// dog.root.children.push( light2.entity );
// const cubemapCamera = new CubemapCameraEntity( {
// root: dog.root,
// lights: [
// light,
// // light2
// ],
// } );
// dog.root.children.push( cubemapCamera.entity );
const cubemapCamera = new CubemapCameraEntity( {
root: dog.root,
lights: [
light,
// light2
],
} );
dog.root.children.push( cubemapCamera.entity );
// const environmentMap = new EnvironmentMap( {
// cubemap: cubemapCamera.target,
// } );
// dog.root.children.push( environmentMap.entity );
const environmentMap = new EnvironmentMap( {
cubemap: cubemapCamera.target,
} );
dog.root.children.push( environmentMap.entity );
// const camera = new CameraEntity( {
// root: dog.root,
// target: swap.o,
// lights: [
// light,
// // light2
// ],
// textureIBLLUT: ibllut.texture,
// textureEnv: environmentMap.texture,
// } );
// camera.camera.clear = [ 0.0, 0.0, 0.0, 0.0 ];
// camera.entity.components.unshift( new Lambda( {
// onUpdate: ( event ) => {
// const t1 = 0.02 * Math.sin( event.time );
// const s1 = Math.sin( t1 );
// const c1 = Math.cos( t1 );
// const t2 = 0.02 * Math.cos( event.time );
// const s2 = Math.sin( t2 );
// const c2 = Math.cos( t2 );
// const r = 5.0;
const camera = new CameraEntity( {
root: dog.root,
target: swap.o,
lights: [
light,
// light2
],
textureIBLLUT: ibllut.texture,
textureEnv: environmentMap.texture,
} );
camera.camera.clear = [ 0.0, 0.0, 0.0, 0.0 ];
camera.entity.components.unshift( new Lambda( {
onUpdate: ( event ) => {
const t1 = 0.02 * Math.sin( event.time );
const s1 = Math.sin( t1 );
const c1 = Math.cos( t1 );
const t2 = 0.02 * Math.cos( event.time );
const s2 = Math.sin( t2 );
const c2 = Math.cos( t2 );
const r = 5.0;
// camera.entity.transform.lookAt( new Vector3( [
// r * c1 * s2,
// r * s1,
// r * c1 * c2
// ] ) );
// },
// visible: false,
// name: process.env.DEV && 'main/updateCamera',
// } ) );
// dog.root.children.push( camera.entity );
camera.entity.transform.lookAt( new Vector3( [
r * c1 * s2,
r * s1,
r * c1 * c2
] ) );
},
visible: false,
name: process.env.DEV && 'main/updateCamera',
} ) );
dog.root.children.push( camera.entity );
// swap.swap();
// const bloom = new Bloom( {
// input: swap.i,
// target: swap.o
// } );
// dog.root.children.push( bloom.entity );
swap.swap();
const bloom = new Bloom( {
input: swap.i,
target: swap.o
} );
dog.root.children.push( bloom.entity );
// swap.swap();
// const glitch = new Glitch( {
// input: swap.i,
// target: swap.o,
// } );
// dog.root.children.push( glitch.entity );
swap.swap();
const glitch = new Glitch( {
input: swap.i,
target: swap.o,
} );
dog.root.children.push( glitch.entity );
// swap.swap();
// const pixelSorter = new PixelSorter( {
// input: swap.i,
// target: swap.o,
// } );
// dog.root.children.push( pixelSorter.entity );
swap.swap();
const pixelSorter = new PixelSorter( {
input: swap.i,
target: swap.o,
} );
dog.root.children.push( pixelSorter.entity );
// swap.swap();
// const post = new Post( {
// input: swap.i,
// target: canvasRenderTarget
// } );
// dog.root.children.push( post.entity );
swap.swap();
const post = new Post( {
input: swap.i,
target: canvasRenderTarget
} );
dog.root.children.push( post.entity );
// if ( process.env.DEV ) {
// const rtInspector = new RTInspector( {
// target: canvasRenderTarget
// } );
// dog.root.children.push( rtInspector.entity );
// }
if ( process.env.DEV ) {
const rtInspector = new RTInspector( {
target: canvasRenderTarget
} );
dog.root.children.push( rtInspector.entity );
}

View File

@@ -177,7 +177,7 @@ void main() {
}
#ifdef FORWARD
fragColor = vec4( 1.0 );
fragColor = vec4( 0.2 );
#endif
#ifdef DEFERRED

View File

@@ -372,7 +372,7 @@ vec2 mainAudio( vec4 time ) {
// -- snare --------------------------------------------------------------------------------------
if ( inRange( time.w, SECTION_NEURO, SECTION_PORTER_FUCKING_ROBINSON ) ) {
float t = mod( time.y - 2.0 * BEAT, 4.0 * BEAT );
dest += 0.12 * snare( t );
dest += 0.1 * snare( t );
}
// -- neuro bass ---------------------------------------------------------------------------------
@@ -398,7 +398,7 @@ vec2 mainAudio( vec4 time ) {
sum += 0.3 * ( 2.0 * fbm( uv ) - 1.0 );
}
dest += mix( 0.0, 1.0, sidechain ) * 0.2 * aSaturate( sum );
dest += mix( 0.0, 1.0, sidechain ) * 0.27 * aSaturate( sum );
dest += mix( 0.0, 1.0, sidechain ) * 0.2 * sin( n2f( -36.0 ) * TAU * t );
}
@@ -519,7 +519,7 @@ vec2 mainAudio( vec4 time ) {
t += 1.0 * inRangeInteg( time.z, 28.0 * BEAT, 31.75 * BEAT, 50.0 );
float freq = n2f( chordsB[ progB ] ) * 0.125;
float fadetime = max( 0.0, time.w - SECTION_AAAA + 8.0 * BEAT );
dest += 0.1 * exp( -1.0 * fadetime ) * mix( 0.1, 1.0, sidechain ) * superbass( t, freq, exp( -2.0 * fadetime ) );
dest += 0.08 * exp( -1.0 * fadetime ) * mix( 0.1, 1.0, sidechain ) * superbass( t, freq, exp( -2.0 * fadetime ) );
}
// -- choir --------------------------------------------------------------------------------------
@@ -542,7 +542,7 @@ vec2 mainAudio( vec4 time ) {
sum += 0.3 * mix( 0.2, 1.0, sidechain ) * choir( t * rate * 0.5 );
}
dest += 0.12 * aSaturate( sum );
dest += 0.1 * aSaturate( sum );
}
// -- harp ---------------------------------------------------------------------------------------
@@ -562,7 +562,7 @@ vec2 mainAudio( vec4 time ) {
float rev = 0.3;
float rate = n2r( float( notes[ prog ] ) );
dest += 0.1 * exp( -0.5 * fi ) * mix( 0.2, 1.0, sidechain ) * harp( t * rate * 0.5 );
dest += 0.08 * exp( -0.5 * fi ) * mix( 0.2, 1.0, sidechain ) * harp( t * rate * 0.5 );
}
}
@@ -595,7 +595,7 @@ vec2 mainAudio( vec4 time ) {
sum += 0.1 * mix( 0.2, 1.0, sidechain ) * phase;
}
dest += 0.15 * aSaturate( sum );
dest += 0.12 * aSaturate( sum );
}
// -- deepkick -----------------------------------------------------------------------------------

View File

@@ -5,7 +5,7 @@ precision highp float;
#define saturate(x) clamp(x,0.,1.)
#define linearstep(a,b,x) saturate(((x)-(a))/((b)-(a)))
const int MARCH_ITER = 50;
const int MARCH_ITER = 90;
const int MTL_UNLIT = 1;
const int MTL_PBR = 2;
const int MTL_GRADIENT = 3;
@@ -24,6 +24,9 @@ in vec2 vUv;
out vec4 fragColor;
#endif
uniform float deformAmp;
uniform float deformFreq;
uniform float deformTime;
uniform float time;
uniform vec2 resolution;
uniform vec2 cameraNearFar;
@@ -39,10 +42,40 @@ vec3 divideByW( vec4 v ) {
return v.xyz / v.w;
}
mat2 rot2d( float t ) {
float c = cos( t );
float s = sin( t );
return mat2( c, -s, s, c );
}
#pragma glslify: noise = require( ./-simplex4d );
#pragma glslify: distFunc = require( ./-distFunc );
float box( vec3 p, vec3 s ) {
vec3 d = abs( p ) - s;
return min( 0.0, max( d.x, max( d.y, d.z ) ) ) + length( max( vec3( 0.0 ), d ) );
}
float fDistFunc( vec3 p ) {
return distFunc( p, time );
float distSlasher;
if ( length( p ) > 2.0 ) { return length( p ) - 1.8; }
p += 0.5 * deformAmp / deformFreq * noise( vec4( deformFreq * p.xyz, 4.0 * deformFreq * deformTime ) );
{
vec3 pt = p;
pt.xy = rot2d( 0.5 ) * pt.xy;
pt.yz = rot2d( 0.5 ) * pt.yz;
pt.y = mod( pt.y - 0.02, 0.04 ) - 0.02;
distSlasher = box( pt, vec3( 1E1, 0.015, 1E1 ) );
}
float dist = distFunc( p, time );
return max( distSlasher, dist );
}
vec3 normalFunc( vec3 p, float dd ) {
@@ -65,18 +98,19 @@ void main() {
float dist;
for ( int i = 0; i < MARCH_ITER; i ++ ) {
dist = distFunc( rayPos, time );
rayLen += 0.7 * dist;
dist = fDistFunc( rayPos );
rayLen += 0.5 * dist;
rayPos = rayOri + rayDir * rayLen;
if ( abs( dist ) < 1E-3 ) { break; }
if ( rayLen > cameraNearFar.y ) { break; }
}
if ( 0.01 < dist ) {
discard;
}
vec3 normal = normalFunc( rayPos, 1E-4 );
vec3 normal = normalFunc( rayPos, 1E-2 );
vec4 color = vec4( 0.4, 0.7, 0.9, 1.0 );
vec4 projPos = projectionMatrix * viewMatrix * vec4( rayPos, 1.0 ); // terrible
@@ -87,7 +121,7 @@ void main() {
fragPosition = vec4( rayPos, depth );
fragNormal = vec4( normal, 1.0 );
fragColor = color;
fragWTF = vec4( vec3( 0.2, 0.9, 0.0 ), MTL_PBR );
fragWTF = vec4( vec3( 0.9, 0.2, 0.0 ), MTL_PBR );
#endif
#ifdef SHADOW

View File

@@ -79,7 +79,7 @@ void main() {
// == compute size ===============================================================================
vPosition = vec4( tex0.xyz, 1.0 );
float size = vDice.x * 0.08;
float size = vDice.x * 0.05;
size *= sin( PI * saturate( vLife ) );
vec3 shape = position * size;