aesthetics: improve condition

This commit is contained in:
FMS-Cat
2021-03-27 19:08:18 +09:00
parent f683f09e54
commit 5443eb38b5
6 changed files with 30 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@@ -35,7 +35,7 @@ uniform float phaseOffset;
uniform float phaseWidth;
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 + vHuh.z + 0.1 * time + vHuh.y + phaseOffset );
if ( phase > phaseWidth ) { discard; }
vec3 color = vec3( 2.0 );

View File

@@ -1,5 +1,7 @@
#version 300 es
#define fs(i) (fract(sin((i)*114.514)*1919.810))
const float TAU = 6.283185307;
layout (location = 0) in vec2 what;
@@ -26,17 +28,24 @@ void main() {
vec4 tex = texture( samplerSvg, vec2( what.x, huh.x ) );
vPosition = vec4( tex.xy + vec2( huh.y, 0.0 ), 60.0 - 120.0 * huh.z, 1.0 );
vPosition = vec4( tex.xy, 0.0, 1.0 );
// vPosition.x += huh.y;
mat3 basis = orthBasis( vec3( tex.zw, 0.0 ) );
float theta = what.y / 3.0 * TAU;
vec3 tube = 0.2 * basis * vec3( sin( theta ), cos( theta ), 0.0 );
vec3 tube = 0.1 * basis * vec3( sin( theta ), cos( theta ), 0.0 );
vNormal = ( normalMatrix * vec4( tube, 1.0 ) ).xyz;
vPosition.xyz += tube;
vPosition = modelMatrix * vPosition;
vec3 randomPos = fs( vec3( 5.0, 8.6, 1.9 ) + huh.z + 2.56 * huh.y ) - 0.5;
randomPos.z = mod( randomPos.z + 0.1 * time, 1.0 ) - 0.5;
vPosition.xyz += vec3( 5.0, 5.0, 20.0 ) * randomPos;
// vPosition.z += 6.0 - 1.2 * huh.z;
vec4 outPos = projectionMatrix * viewMatrix * vPosition;
outPos.x *= resolution.y / resolution.x;
gl_Position = outPos;

View File

@@ -0,0 +1,8 @@
#pragma glslify: uniformSphere = require( ./uniformSphere );
vec3 uniformHemisphere( vec2 Xi, vec3 n ) {
vec3 d = uniformSphere( Xi );
return dot( n, d ) < 0.0 ? -d : d;
}
#pragma glslify: export(uniformHemisphere)

View File

@@ -0,0 +1,7 @@
vec3 uniformSphere( vec2 Xi ) {
float p = 2.0 * PI * Xi.x;
float t = acos( 1.0 - 2.0 * Xi.y );
return vec3( cos( p ) * sin( t ), cos( t ), sin( p ) * sin( t ) );
}
#pragma glslify: export(uniformSphere)

View File

@@ -13,6 +13,7 @@ const float NOISE_CLUTCH = 0.1;
const vec2 CHROMA_FREQ = vec2( 227.5, 120.0 );
const mat3 RGB_TO_YCBCR = mat3( 0.299, -0.168736, 0.5, 0.587, -0.331264, -0.418688, 0.114, 0.5, -0.081312 );
#define fs(i) (fract(sin((i)*114.514)*1919.810))
#define saturate(i) clamp(i,0.,1.)
#define linearstep(a,b,x) saturate(((x)-(a))/((b)-(a)))
#define lofi(i,m) (floor((i)/(m))*(m))
@@ -25,7 +26,6 @@ uniform float time;
uniform vec2 resolution;
uniform sampler2D sampler0;
#pragma glslify: fractSin = require( ./modules/fractSin );
#pragma glslify: cyclicNoise = require( ./modules/cyclicNoise );
// https://www.shadertoy.com/view/3sKSzW
@@ -68,7 +68,7 @@ void main() {
); // cb as cosine of subcarrier
// static noise
signal += 0.01 * ( fractSin( noise.x ) - 0.5 );
signal += 0.01 * ( fs( noise.x ) - 0.5 );
// high peak noise
float bump = exp( -2.0 * fract( 10.0 * hnoise.z * ( 1.0 * hnoise.x + uv.x ) ) );