diff --git a/BandLive.exe b/BandLive.exe index 75e0f94..bb43d22 100644 Binary files a/BandLive.exe and b/BandLive.exe differ diff --git a/BandLive_v0.1.0.zip b/BandLive_v0.1.0.zip new file mode 100644 index 0000000..da5eb8a Binary files /dev/null and b/BandLive_v0.1.0.zip differ diff --git a/BandLive_v0.2.0.zip b/BandLive_v0.2.0.zip new file mode 100644 index 0000000..bd9c841 Binary files /dev/null and b/BandLive_v0.2.0.zip differ diff --git a/BandLive_v0.3.0.zip b/BandLive_v0.3.0.zip new file mode 100644 index 0000000..4038b3b Binary files /dev/null and b/BandLive_v0.3.0.zip differ diff --git a/HidDump.exe b/HidDump.exe index 70f76fe..eb4eb67 100644 Binary files a/HidDump.exe and b/HidDump.exe differ diff --git a/assets/col_tri_fragment.fs b/assets/col_tri_fragment.fs new file mode 100644 index 0000000..c0a81b3 --- /dev/null +++ b/assets/col_tri_fragment.fs @@ -0,0 +1,13 @@ +#version 420 + +in vec4 color; +in vec2 texcoords; + +out vec4 out_color; + +uniform sampler2D tex_sampler; + + +void main() { + out_color = color * texture(tex_sampler, texcoords.xy).rgba; +} diff --git a/assets/col_tri_transform.vs b/assets/col_tri_transform.vs new file mode 100644 index 0000000..a1a5330 --- /dev/null +++ b/assets/col_tri_transform.vs @@ -0,0 +1,18 @@ +#version 430 + +layout(location = 0) in vec4 in_vertex; +layout(location = 1) in vec4 in_color; +layout(location = 2) in vec2 in_texcoord; + +layout(location = 0) uniform mat4 mvp_mat; + +out vec4 position; +out vec4 color; +out vec2 texcoords; + + +void main() { + gl_Position = mvp_mat * in_vertex; + color = in_color; + texcoords = in_texcoord; +} diff --git a/assets/cymbal.glb b/assets/cymbal.glb new file mode 100644 index 0000000..ea526e4 Binary files /dev/null and b/assets/cymbal.glb differ diff --git a/assets/gems-pbr.fs b/assets/gems-pbr.fs new file mode 100644 index 0000000..bef0781 --- /dev/null +++ b/assets/gems-pbr.fs @@ -0,0 +1,127 @@ +#version 430 + +in vec4 position; +in vec4 color; +in vec3 light_dir; +in vec3 normal; +in vec2 texcoord; +in mat3 tbn; + +out vec4 out_color; + +layout(location = 0) uniform uint config; +layout(location = 3) uniform vec4 base_color_factors; +layout(location = 4) uniform vec3 emissive_factors; +layout(location = 5) uniform vec2 metallic_factors; + +layout (binding = 0) uniform sampler2D base_color_sampler; +layout (binding = 1) uniform sampler2D metallic_roughness_sampler; +layout (binding = 2) uniform sampler2D normal_sampler; +layout (binding = 3) uniform sampler2D occlusion_sampler; +layout (binding = 4) uniform sampler2D emissive_sampler; + + +const float PI = 3.14159265359; + + +float DistributionGGX(float NdotH, float roughness) { + float a = roughness * roughness; + float a_sq = a * a; + + float d = (NdotH * NdotH) * (a_sq - 1) + 1; + return a_sq / max(PI * d * d, 0.00001); +} + +float GeometrySchlickGGX(vec3 N, vec3 X, float k) { + float NdotX = max(dot(N, X), 0); + float denominator = NdotX * (1 - k) + k; + return NdotX / denominator; +} + +float GeometrySmith(vec3 N, vec3 L, vec3 V, float roughness) { + float k = ((roughness + 1) * (roughness + 1)) / 8.0; + return GeometrySchlickGGX(N, V, k) * GeometrySchlickGGX(N, L, k); +} + +vec3 Fresnel(vec3 F0, float HdotV) { + return F0 + (1 - F0) * pow(1 - HdotV, 5); +} + + +mat3 cotangent_frame(vec3 N, vec3 p, vec2 uv) { + // get edge vectors of the pixel triangle + vec3 dp1 = dFdx(p); + vec3 dp2 = dFdy(p); + vec2 duv1 = dFdx(uv); + vec2 duv2 = dFdy(uv); + // solve the linear system + vec3 dp2perp = cross(dp2, N); + vec3 dp1perp = cross(N, dp1); + vec3 T = dp2perp * duv1.x + dp1perp * duv2.x; + vec3 B = dp2perp * duv1.y + dp1perp * duv2.y; + // construct a scale-invariant frame + float invmax = inversesqrt(max(dot(T,T), dot(B,B))); + return mat3(T * invmax, B * invmax, N); +} + + +void main() { + float metalness = metallic_factors.x; + float roughness = metallic_factors.y; + + vec3 metallic_roughness = texture(metallic_roughness_sampler, texcoord).rgb; + roughness *= metallic_roughness.g; + metalness *= metallic_roughness.b; + + vec3 N = normal.xyz; + if ((config & (1<<18)) != 0) { + mat3 tbn_mat = tbn; + if ((config & 16) == 0) { + tbn_mat = cotangent_frame(normal.xyz, position.xyz, texcoord); + } + N = normalize(tbn_mat * (texture(normal_sampler, texcoord).rgb * 2.0 - 1.0)); + } + + vec4 albedo = base_color_factors * color; + albedo *= texture(base_color_sampler, texcoord); + + vec3 ambient = vec3(.03) * albedo.rgb; + + float occlusion = texture(occlusion_sampler, texcoord).r; + ambient *= vec3(occlusion); + + vec3 emission = emissive_factors; + emission *= texture(emissive_sampler, texcoord).rgb; + + // PBR + vec3 V = normalize(-position.xyz); + vec3 L = light_dir; + vec3 H = normalize(light_dir + V); + + float NdotV = max(dot(N, V), 0); + float NdotL = max(dot(N, L), 0); + float NdotH = max(dot(N, H), 0.00001); + float HdotV = max(dot(H, V), 0.00001); + + const float reflectance = .5; + vec3 f0 = vec3(0.16 * reflectance * reflectance); + vec3 base_reflect = mix(f0, albedo.rgb, metalness); + + float D = DistributionGGX(NdotH, roughness); + float G = GeometrySmith(N, L, V, roughness); + vec3 F = Fresnel(base_reflect, HdotV); + + vec3 specular = (D * G * F) / max(4 * NdotL * NdotV, 0.00001); + vec3 diffuse = (vec3(1.0) - F) * (1.0 - metalness); + + vec3 Lo = (diffuse * albedo.rgb / PI + specular) * NdotL; + Lo += emission; + + + vec3 col_out = ambient + Lo + emission; + col_out *= PI; + //col_out /= col_out + vec3(1.0); + //col_out = pow(col_out, vec3(1.0 / 2.2)); + + out_color = vec4(col_out, albedo.a); +} diff --git a/assets/color.fs b/assets/gems.fs similarity index 100% rename from assets/color.fs rename to assets/gems.fs diff --git a/assets/gems.vs b/assets/gems.vs index ce8649f..16b5cb9 100644 --- a/assets/gems.vs +++ b/assets/gems.vs @@ -2,18 +2,18 @@ layout(location = 0) in vec3 in_vertex; layout(location = 1) in vec3 in_normal; -layout(location = 2) in vec3 in_position; +layout(location = 2) in vec4 in_position; layout(location = 3) in vec4 in_color; -layout(location = 0) uniform mat4 mv; -layout(location = 1) uniform mat4 proj; +layout(location = 0) uniform mat4 proj; +layout(location = 1) uniform mat4 mv; out vec4 color; out vec4 light_1; out vec4 normal; void main() { - gl_Position = proj * mv * vec4(in_position + in_vertex, 1.0); + gl_Position = proj * mv * vec4(in_position.xyz + in_vertex, 1.0); normal = mv * vec4(in_normal, 0); light_1 = mv * normalize(vec4(1, -1, 1, 0)); color = in_color; diff --git a/assets/instanced.vs b/assets/instanced.vs new file mode 100644 index 0000000..564ec49 --- /dev/null +++ b/assets/instanced.vs @@ -0,0 +1,50 @@ +#version 440 + +layout(location = 0) in vec3 in_vertex; +layout(location = 1) in vec3 in_normal; +layout(location = 2) in vec2 in_texcoord; +layout(location = 3) in vec4 in_color; +layout(location = 4) in vec4 in_tangent; + +layout(location = 0) uniform uint config; +layout(location = 1) uniform mat4 viewproj_mat; +layout(location = 2) uniform mat4 model_mat; + +layout(std140, binding = 1) uniform InstanceData { + vec4 inst_positions[512]; + vec4 inst_colors[512]; +}; + +out vec4 position; +out vec4 color; +out vec3 light_dir; +out vec3 normal; +out vec2 texcoord; +out mat3 tbn; + + +void main() { + if ((config & 1) != 0) { + position = model_mat * vec4(in_vertex + inst_positions[gl_InstanceID].xyz, 1.0); + gl_Position = viewproj_mat * position; + } + if ((config & 2) != 0) { + normal = normalize(model_mat * vec4(in_normal, 0)).xyz; + } + if ((config & 4) != 0) { + texcoord = in_texcoord; + } + color = inst_colors[gl_InstanceID]; + if ((config & 8) != 0) { + color *= in_color; + } + + light_dir = normalize(vec3(1, .35, 1)); + + if ((config & 16) != 0) { + vec3 tangent = normalize((model_mat * vec4(in_tangent.xyz, 0)).xyz); + tangent = normalize(tangent - dot(tangent, normal) * normal); + vec3 bitangent = cross(normal, tangent.xyz) * in_tangent.w; + tbn = mat3(tangent, bitangent, normal); + } +} diff --git a/assets/kickbar.glb b/assets/kickbar.glb new file mode 100644 index 0000000..066f571 Binary files /dev/null and b/assets/kickbar.glb differ diff --git a/assets/pbr.fs b/assets/pbr.fs new file mode 100644 index 0000000..67b1715 --- /dev/null +++ b/assets/pbr.fs @@ -0,0 +1,126 @@ +#version 430 + +in vec4 position; +in vec4 color; +in vec3 light_dir; +in vec3 normal; +in vec2 texcoord; +in mat3 tbn; + +out vec4 out_color; + +layout(location = 0) uniform uint config; +layout(location = 3) uniform vec4 base_color_factors; +layout(location = 4) uniform vec3 emissive_factors; +layout(location = 5) uniform vec2 metallic_factors; + +layout (binding = 0) uniform sampler2D base_color_sampler; +layout (binding = 1) uniform sampler2D metallic_roughness_sampler; +layout (binding = 2) uniform sampler2D normal_sampler; +layout (binding = 3) uniform sampler2D occlusion_sampler; +layout (binding = 4) uniform sampler2D emissive_sampler; + + +const float PI = 3.14159265359; + + +float DistributionGGX(vec3 N, vec3 H, float roughness) { + float a = roughness * roughness; + float a_sq = a * a; + float NH = max(dot(N, H), 0); + + float d = (NH * NH) * (a_sq - 1) + 1; + return a_sq / max(PI * d * d, 0.00001); +} + +float GeometrySchlickGGX(vec3 N, vec3 d, float k) { + float Nd = max(dot(N, d), 0); + float denominator = Nd * (1 - k) + k; + return Nd / denominator; +} + +float GeometrySmith(vec3 N, vec3 H, vec3 L, vec3 V, float roughness) { + float k = ((roughness + 1) * (roughness + 1)) / 8.0; + return GeometrySchlickGGX(N, V, k) * GeometrySchlickGGX(N, L, k); +} + +vec3 Fresnel(vec3 F0, float HdotV) { + return F0 + (1 - F0) * pow(1 - HdotV, 5); +} + + +mat3 cotangent_frame(vec3 N, vec3 p, vec2 uv) { + // get edge vectors of the pixel triangle + vec3 dp1 = dFdx(p); + vec3 dp2 = dFdy(p); + vec2 duv1 = dFdx(uv); + vec2 duv2 = dFdy(uv); + // solve the linear system + vec3 dp2perp = cross(dp2, N); + vec3 dp1perp = cross(N, dp1); + vec3 T = dp2perp * duv1.x + dp1perp * duv2.x; + vec3 B = dp2perp * duv1.y + dp1perp * duv2.y; + // construct a scale-invariant frame + float invmax = inversesqrt(max(dot(T,T), dot(B,B))); + return mat3(T * invmax, B * invmax, N); +} + + +void main() { + float metalness = metallic_factors.x; + float roughness = metallic_factors.y; + + vec3 metallic_roughness = texture(metallic_roughness_sampler, texcoord).rgb; + roughness *= metallic_roughness.g; + metalness *= metallic_roughness.b; + + vec3 N = normal.xyz; + if ((config & (1<<18)) != 0) { + mat3 tbn_mat = tbn; + if ((config & 16) == 0) { + tbn_mat = cotangent_frame(normal.xyz, position.xyz, texcoord); + } + N = normalize(tbn_mat * (texture(normal_sampler, texcoord).rgb * 2.0 - 1.0)); + } + + vec4 albedo = base_color_factors * color; + albedo *= texture(base_color_sampler, texcoord); + + vec3 ambient = vec3(.03) * albedo.rgb; + + float occlusion = texture(occlusion_sampler, texcoord).r; + ambient *= vec3(occlusion); + + vec3 emission = emissive_factors; + emission *= texture(emissive_sampler, texcoord).rgb; + + // PBR + vec3 V = normalize(-position.xyz); + vec3 L = light_dir; + vec3 H = normalize(light_dir + V); + + float NdotV = max(dot(N, V), 0); + float NdotL = max(dot(N, L), 0); + float NdotH = max(dot(N, H), 0.00001); + float HdotV = max(dot(H, V), 0.00001); + + vec3 base_reflect = mix(vec3(0.04), albedo.rgb, metalness); + + float D = DistributionGGX(N, H, roughness); + float G = GeometrySmith(N, H, L, V, roughness); + vec3 F = Fresnel(base_reflect, HdotV); + + vec3 specular = (D * G * F) / max(4 * NdotL * NdotV, 0.00001); + vec3 diffuse = (vec3(1.0) - F) * (1.0 - metalness); + + vec3 Lo = (diffuse * albedo.rgb / PI + specular) * NdotL; + Lo += emission; + + + vec3 col_out = ambient + Lo + emission; + col_out *= 2; + //col_out /= col_out + vec3(1.0); + col_out = pow(col_out, vec3(1.0 / 2.2)); + + out_color = vec4(col_out, albedo.a); +} diff --git a/assets/tom.glb b/assets/tom.glb new file mode 100644 index 0000000..f3a39e4 Binary files /dev/null and b/assets/tom.glb differ diff --git a/assets/ui-texture.png b/assets/ui-texture.png new file mode 100644 index 0000000..0a19fb9 Binary files /dev/null and b/assets/ui-texture.png differ diff --git a/config/config.ini b/config/config.ini index a68fa3a..d37e4ea 100644 --- a/config/config.ini +++ b/config/config.ini @@ -1,15 +1,15 @@ [Game] window_width = 1600 window_height = 900 -calib_video = 2 +calib_video = 0 calib_audio = 80 -calib_voice = 120 +calib_voice = 80 vsync = 0 fullscreen = 0 [Songs] song_folder = songs -start_song = 0 +start_song = -1 default_difficulty = 2 [Input] @@ -22,13 +22,12 @@ y_cym_notes = 22 26 42 46 54 b_cym_notes = 51 53 56 59 g_cym_notes = 49 52 55 57 pro_strum_debounce = 50 -light_sensor_delay = 23 +light_sensor_delay = 15 audio_sensor_delay = 100 [PitchDetection] -sample_size = 1024 -cutoff_frequency = 2500 -max_freq_change = 1300 +lowest_pitch = 64 +highest_pitch = 1100 low_pass_coeff = 0.25 [Settings] @@ -41,8 +40,14 @@ drum_window_before = 80 drum_window_after = 80 key_window_before = 80 key_window_after = 80 -vocal_window_start = 30 -vocal_window_end = 0 +vocal_window_before = 50 +vocal_window_after = 25 +vocal_funnel_length = 50 +vocal_funnel_width = 3 +vocal_tolerance_easy = 3.25 +vocal_tolerance_medium = 2.25 +vocal_tolerance_hard = 1.5 +vocal_tolerance_expert = 1.0 tremolo_grace_period = 150 max_trill_delay = 200 glissando_ahead = 3 diff --git a/config/controllers/ghl_guitar.cfg b/config/controllers/ghl_guitar.cfg new file mode 100644 index 0000000..bc53f24 --- /dev/null +++ b/config/controllers/ghl_guitar.cfg @@ -0,0 +1,19 @@ +# Usage Page:Usage Bit Offset:Size:Input +0x9:0x1 0:1:W1 +0x9:0x2 0:1:B1 +0x9:0x3 0:1:B2 +0x9:0x4 0:1:B3 +0x9:0x5 0:1:W2 +0x9:0x6 0:1:W3 + +0x9:0x9 0:1:select +0x9:0xA 0:1:start +0x9:0xB 0:1:select +0x9:0xD 0:1:home + +0x1:0x31 0:8:strum +0x1:0x35 0:8:whammy + +0x1:0x39 0:4:dpad + +0xFF00:0x2C 0:8:tilt_axis diff --git a/config/controllers/harmonix_keyboard.cfg b/config/controllers/harmonix_keyboard.cfg index d884535..ebc5a52 100644 --- a/config/controllers/harmonix_keyboard.cfg +++ b/config/controllers/harmonix_keyboard.cfg @@ -27,3 +27,4 @@ 0xFF00:0x28 0:8:slider 0xFF00:0x2F 0:8:counter +0xFF00:0x2F 8:4:state diff --git a/config/controllers/harmonix_proguitar.cfg b/config/controllers/harmonix_proguitar.cfg index 68f641e..dff4d59 100644 --- a/config/controllers/harmonix_proguitar.cfg +++ b/config/controllers/harmonix_proguitar.cfg @@ -27,3 +27,4 @@ 0xFF00:0x2D 0:8:pedal_connected 0xFF00:0x2F 0:8:counter +0xFF00:0x2F 8:4:state diff --git a/config/controllers/vid_pid.map b/config/controllers/vid_pid.map index af79e89..844fc1e 100644 --- a/config/controllers/vid_pid.map +++ b/config/controllers/vid_pid.map @@ -9,6 +9,9 @@ 0x1BAD 0x3438 harmonix_proguitar.cfg 0x12BA 0x0200 harmonix_guitar.cfg +0x0E6F 0x0249 harmonix_guitar.cfg +0x0E6F 0x024A harmonix_guitar.cfg + 0x1BAD 0x0002 xbox_360.cfg 0x1BAD 0x0004 xbox_360.cfg 0x1BAD 0x3010 xbox_360.cfg @@ -20,6 +23,7 @@ 0x1430 0x4748 gh_guitar.cfg 0x1430 0x474C gh_guitar.cfg +0x12BA 0x074B ghl_guitar.cfg 0x12BA 0x0210 harmonix_drums.cfg 0x12BA 0x0218 harmonix_drums.cfg diff --git a/config/controllers/xbox_360.cfg b/config/controllers/xbox_360.cfg index 20a3d2e..d196e5e 100644 --- a/config/controllers/xbox_360.cfg +++ b/config/controllers/xbox_360.cfg @@ -6,4 +6,6 @@ 0x9:0x5 0:1:O 0x9:0x7 0:1:select 0x9:0x8 0:1:start +0x1:0x33 0:16:whammy +0x1:0x34 0:16:tilt 0x1:0x39 0:4:dpad diff --git a/profiles/controller.map b/profiles/controller.map index e01f12e..a47784b 100644 Binary files a/profiles/controller.map and b/profiles/controller.map differ