Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Game DLL requesting 256.00 mb of memory
- main: app path: F:\Users\BoltKey\Downloads\LudumDareToBeMessy\LudumDareToBeMessy
- main: data path: F:\Users\BoltKey\Downloads\LudumDareToBeMessy\LudumDareToBeMessy\data
- main: user path: F:\Users\BoltKey\Downloads\LudumDareToBeMessy\LudumDareToBeMessy
- processor architecture: x64
- processor count: 4
- processor type: x8664
- physical memory: 8,452,575,232 total / 2,133,983,232 available
- virtual memory: 2,147,352,576 total / 2,061,193,216 available
- drive: C:\ () 5,609,824,256 available out of 119,664,537,600 total
- drive: D:\ (Terra Mystica) 882,934,521,856 available out of 1,000,202,039,296 total
- drive: E:\ (System Reserved) 82,964,480 available out of 366,997,504 total
- drive: F:\ (Old Disk) 5,611,270,144 available out of 159,671,906,304 total
- drive: G:\ (G:\)
- display: \\.\DISPLAY1 (xy: 0, 0 / wh: 2560, 1440) refresh: 60 hz primary
- main: initializing 256.00 mb of memory
- OpenGL: creating DC
- OpenGL: setting pixel format
- OpenGL: creating OpenGL context
- OpenGL: setting context to current
- OpenGL: Vsync: false
- OpenGL: setting viewport
- OpenGL: version 4.5.0 NVIDIA 353.30
- OpenGL: vendor NVIDIA Corporation
- OpenGL: renderer GeForce GT 610/PCIe/SSE2
- OpenGL: shader version 4.50 NVIDIA
- OpenGL: extensions GL_AMD_multi_draw_indirect GL_ARB_arrays_of_arrays GL_ARB_base_instance GL_ARB_blend_func_extended GL_ARB_buffer_storage GL_ARB_clear_buffer_object GL_ARB_clear_texture GL_ARB_clip_control GL_ARB_color_buffer_float GL_ARB_compatibility GL_ARB_compressed_texture_pixel_storage GL_ARB_conservative_depth GL_ARB_compute_shader GL_ARB_compute_variable_group_size GL_ARB_conditional_render_inverted GL_ARB_copy_buffer GL_ARB_copy_image GL_ARB_cull_distance GL_ARB_debug_output GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_derivative_control GL_ARB_direct_state_access GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_indirect GL_ARB_draw_elements_base_vertex GL_ARB_draw_instanced GL_ARB_enhanced_layouts GL_ARB_ES2_compatibility GL_ARB_ES3_compatibility GL_ARB_ES3_1_compatibility GL_ARB_explicit_attrib_location GL_ARB_explicit_uniform_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_layer_viewport GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_no_attachments GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_get_program_binary GL_ARB_get_texture_sub_image GL_ARB_gpu_shader5 GL_ARB_gpu_shader_fp64 GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_indirect_parameters GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_internalformat_query2 GL_NV_internalformat_sample_query GL_ARB_invalidate_subdata GL_ARB_map_buffer_alignment GL_ARB_map_buffer_range GL_ARB_multi_bind GL_ARB_multi_draw_indirect GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_query GL_ARB_occlusion_query2 GL_ARB_pipeline_statistics_query GL_ARB_pixel_buffer_object GL_ARB_point_parameters GL_ARB_point_sprite GL_ARB_program_interface_query GL_ARB_provoking_vertex GL_ARB_robust_buffer_access_behavior GL_ARB_robustness GL_ARB_sample_shading GL_ARB_sampler_objects GL_ARB_seamless_cube_map GL_ARB_separate_shader_objects GL_ARB_shader_atomic_counters GL_ARB_shader_bit_encoding GL_ARB_shader_draw_parameters GL_ARB_shader_group_vote GL_ARB_shader_image_load_store GL_ARB_shader_image_size GL_ARB_shader_objects GL_ARB_shader_precision GL_ARB_query_buffer_object GL_ARB_shader_storage_buffer_object GL_ARB_shader_subroutine GL_ARB_shader_texture_image_samples GL_ARB_shader_texture_lod GL_ARB_shading_language_100 GL_ARB_shading_language_420pack GL_ARB_shading_language_include GL_ARB_shading_language_packing GL_ARB_shadow GL_ARB_sparse_buffer GL_ARB_sparse_texture GL_ARB_stencil_texturing GL_ARB_sync GL_ARB_tessellation_shader GL_ARB_texture_barrier GL_ARB_texture_border_clamp GL_ARB_texture_buffer_object GL_ARB_texture_buffer_object_rgb32 GL_ARB_texture_buffer_range GL_ARB_texture_compression GL_ARB_texture_compression_bptc GL_ARB_texture_compression_rgtc GL_ARB_texture_cube_map GL_ARB_texture_cube_map_array GL_ARB_texture_env_add GL_ARB_texture_env_combine GL_ARB_texture_env_crossbar GL_ARB_texture_env_dot3 GL_ARB_texture_float GL_ARB_texture_gather GL_ARB_texture_mirror_clamp_to_edge GL_ARB_texture_mirrored_repeat GL_ARB_texture_multisample GL_ARB_texture_non_power_of_two GL_ARB_texture_query_levels GL_ARB_texture_query_lod GL_ARB_texture_rectangle GL_ARB_texture_rg GL_ARB_texture_rgb10_a2ui GL_ARB_texture_stencil8 GL_ARB_texture_storage GL_ARB_texture_storage_multisample GL_ARB_texture_swizzle GL_ARB_texture_view GL_ARB_timer_query GL_ARB_transform_feedback2 GL_ARB_transform_feedback3 GL_ARB_transform_feedback_instanced GL_ARB_transform_feedback_overflow_query GL_ARB_transpose_matrix GL_ARB_uniform_buffer_object GL_ARB_vertex_array_bgra GL_ARB_vertex_array_object GL_ARB_vertex_attrib_64bit GL_ARB_vertex_attrib_binding GL_ARB_vertex_buffer_object GL_ARB_vertex_program GL_ARB_vertex_shader GL_ARB_vertex_type_10f_11f_11f_rev GL_ARB_vertex_type_2_10_10_10_rev GL_ARB_viewport_array GL_ARB_window_pos GL_ATI_draw_buffers GL_ATI_texture_float GL_ATI_texture_mirror_once GL_S3_s3tc GL_EXT_texture_env_add GL_EXT_abgr GL_EXT_bgra GL_EXT_bindable_uniform GL_EXT_blend_color GL_EXT_blend_equation_separate GL_EXT_blend_func_separate GL_EXT_blend_minmax GL_EXT_blend_subtract GL_EXT_compiled_vertex_array GL_EXT_Cg_shader GL_EXT_depth_bounds_test GL_EXT_direct_state_access GL_EXT_draw_buffers2 GL_EXT_draw_instanced GL_EXT_draw_range_elements GL_EXT_fog_coord GL_EXT_framebuffer_blit GL_EXT_framebuffer_multisample GL_EXTX_framebuffer_mixed_formats GL_EXT_framebuffer_multisample_blit_scaled GL_EXT_framebuffer_object GL_EXT_framebuffer_sRGB GL_EXT_geometry_shader4 GL_EXT_gpu_program_parameters GL_EXT_gpu_shader4 GL_EXT_multi_draw_arrays GL_EXT_packed_depth_stencil GL_EXT_packed_float GL_EXT_packed_pixels GL_EXT_pixel_buffer_object GL_EXT_point_parameters GL_EXT_polygon_offset_clamp GL_EXT_provoking_vertex GL_EXT_rescale_normal GL_EXT_secondary_color GL_EXT_separate_shader_objects GL_EXT_separate_specular_color GL_EXT_shader_image_load_store GL_EXT_shader_integer_mix GL_EXT_shadow_funcs GL_EXT_stencil_two_side GL_EXT_stencil_wrap GL_EXT_texture3D GL_EXT_texture_array GL_EXT_texture_buffer_object GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_latc GL_EXT_texture_compression_rgtc GL_EXT_texture_compression_s3tc GL_EXT_texture_cube_map GL_EXT_texture_edge_clamp GL_EXT_texture_env_combine GL_EXT_texture_env_dot3 GL_EXT_texture_filter_anisotropic GL_EXT_texture_integer GL_EXT_texture_lod GL_EXT_texture_lod_bias GL_EXT_texture_mirror_clamp GL_EXT_texture_object GL_EXT_texture_shared_exponent GL_EXT_texture_sRGB GL_EXT_texture_sRGB_decode GL_EXT_texture_storage GL_EXT_texture_swizzle GL_EXT_timer_query GL_EXT_transform_feedback2 GL_EXT_vertex_array GL_EXT_vertex_array_bgra GL_EXT_vertex_attrib_64bit GL_EXT_import_sync_object GL_IBM_rasterpos_clip GL_IBM_texture_mirrored_repeat GL_KHR_context_flush_control GL_KHR_debug GL_KHR_robust_buffer_access_behavior GL_KHR_robustness GL_KTX_buffer_region GL_NV_bindless_multi_draw_indirect GL_NV_bindless_multi_draw_indirect_count GL_NV_blend_equation_advanced GL_NV_blend_square GL_NV_command_list GL_NV_compute_program5 GL_NV_conditional_render GL_NV_copy_depth_to_color GL_NV_copy_image GL_NV_depth_buffer_float GL_NV_depth_clamp GL_NV_draw_texture GL_NV_ES1_1_compatibility GL_NV_ES3_1_compatibility GL_NV_explicit_multisample GL_NV_fence GL_NV_float_buffer GL_NV_fog_distance GL_NV_fragment_program GL_NV_fragment_program_option GL_NV_fragment_program2 GL_NV_framebuffer_multisample_coverage GL_NV_geometry_shader4 GL_NV_gpu_program4 GL_NV_gpu_program4_1 GL_NV_gpu_program5 GL_NV_gpu_program5_mem_extended GL_NV_gpu_program_fp64 GL_NV_gpu_shader5 GL_NV_half_float GL_NV_light_max_exponent GL_NV_multisample_coverage GL_NV_multisample_filter_hint GL_NV_occlusion_query GL_NV_packed_depth_stencil GL_NV_parameter_buffer_object GL_NV_parameter_buffer_object2 GL_NV_path_rendering GL_NV_pixel_data_range GL_NV_point_sprite GL_NV_primitive_restart GL_NV_register_combiners GL_NV_register_combiners2 GL_NV_shader_atomic_counters GL_NV_shader_atomic_float GL_NV_shader_buffer_load GL_NV_shader_storage_buffer_object GL_NV_texgen_reflection GL_NV_texture_barrier GL_NV_texture_compression_vtc GL_NV_texture_env_combine4 GL_NV_texture_multisample GL_NV_texture_rectangle GL_NV_texture_shader GL_NV_texture_shader2 GL_NV_texture_shader3 GL_NV_transform_feedback GL_NV_transform_feedback2 GL_NV_uniform_buffer_unified_memory GL_NV_vertex_array_range GL_NV_vertex_array_range2 GL_NV_vertex_attrib_integer_64bit GL_NV_vertex_buffer_unified_memory GL_NV_vertex_program GL_NV_vertex_program1_1 GL_NV_vertex_program2 GL_NV_vertex_program2_option GL_NV_vertex_program3 GL_NVX_conditional_render GL_NVX_gpu_memory_info GL_NV_shader_thread_group GL_KHR_blend_equation_advanced GL_SGIS_generate_mipmap GL_SGIS_texture_lod GL_SGIX_depth_texture GL_SGIX_shadow GL_SUN_slice_accum GL_WIN_swap_hint WGL_EXT_swap_control
- opengl: made texture (id: 1; fbo: 0; dim: 8 x 8)
- opengl: made texture (id: 2; fbo: 0; dim: 8 x 8)
- opengl: made texture (id: 3; fbo: 0; dim: 1024 x 128)
- zt_textureMake (from file data) took 5.380960 ms to execute
- asset_manager: loading directory: F:\Users\BoltKey\Downloads\LudumDareToBeMessy\LudumDareToBeMessy\data
- Loaded asset: textures/gui.png (41)
- loading texture asset: textures/gui.png (41)
- stbi_load_from_memory took 57.998302 ms to execute
- opengl: made texture (id: 4; fbo: 0; dim: 1024 x 1024)
- zt_textureMake (from asset) took 79.374290 ms to execute
- Loaded asset: textures/gui.spr (42)
- sprite manager: loading: textures/gui.spr (42)
- GuiManager allocated size: 26.75 mb
- opengl: made texture (id: 6; fbo: 1; dim: 1280 x 720)
- zt_textureMakeRenderTarget took 42.525894 ms to execute
- opengl: made texture (id: 11; fbo: 0; dim: 4 x 4)
- main: loading default shader: shader-bright
- main: loading default shader: shader-blur-horz
- main: loading default shader: shader-blur-vert
- opengl: made texture (id: 12; fbo: 6; dim: 1280 x 720)
- zt_textureMakeRenderTarget took 4.913545 ms to execute
- opengl: made texture (id: 13; fbo: 8; dim: 1280 x 720)
- zt_textureMakeRenderTarget took 3.091875 ms to execute
- opengl: made texture (id: 14; fbo: 10; dim: 1280 x 720)
- zt_textureMakeRenderTarget took 10.114751 ms to execute
- opengl: made texture (id: 15; fbo: 12; dim: 1280 x 720)
- zt_textureMakeRenderTarget took 5.744351 ms to execute
- Loaded asset: fonts/primary.fnt (27)
- loading texture asset: fonts/primary.png (28)
- stbi_load_from_memory took 11.748623 ms to execute
- opengl: made texture (id: 16; fbo: 0; dim: 512 x 512)
- zt_textureMake (from asset) took 19.822004 ms to execute
- main: Game initialized successfully
- main: Thread job queue initialized
- screen: 1280/720; native: 1280/720
- Loaded asset: textures/materials/floor.albedo.png (43)
- loading texture asset: textures/materials/floor.albedo.png (43)
- stbi_load_from_memory took 46.603085 ms to execute
- opengl: made texture (id: 17; fbo: 0; dim: 1024 x 1024)
- zt_textureMake (from asset) took 155.856430 ms to execute
- main: loading default shader: shader-unlit
- main: loading default shader: shader-solid
- Loaded asset: textures/materials/menu.albedo.png (44)
- loading texture asset: textures/materials/menu.albedo.png (44)
- stbi_load_from_memory took 43.434372 ms to execute
- opengl: made texture (id: 18; fbo: 0; dim: 1024 x 1024)
- zt_textureMake (from asset) took 165.586426 ms to execute
- Loaded asset: textures/materials/pallete.albedo.png (45)
- loading texture asset: textures/materials/pallete.albedo.png (45)
- stbi_load_from_memory took 80.513557 ms to execute
- opengl: made texture (id: 19; fbo: 0; dim: 1024 x 1024)
- zt_textureMake (from asset) took 106.962326 ms to execute
- Loaded asset: textures/materials/pallete.emissive.png (46)
- loading texture asset: textures/materials/pallete.emissive.png (46)
- stbi_load_from_memory took 36.243114 ms to execute
- opengl: made texture (id: 20; fbo: 0; dim: 1024 x 1024)
- zt_textureMake (from asset) took 65.569595 ms to execute
- Loaded asset: textures/materials/test_grid.albedo.png (47)
- loading texture asset: textures/materials/test_grid.albedo.png (47)
- stbi_load_from_memory took 41.928936 ms to execute
- opengl: made texture (id: 21; fbo: 0; dim: 1024 x 1024)
- zt_textureMake (from asset) took 76.716545 ms to execute
- Loaded asset: shaders/default.zts (35)
- Loaded asset: shaders/default_pbr.zts (36)
- glLinkProgram failed. Reason: Fragment info
- -------------
- 0(266) : error C5208: Sampler needs to be a uniform (global or parameter to main), need to inline function or resolve conditional expression
- 0(280) : error C5208: Sampler needs to be a uniform (global or parameter to main), need to inline function or resolve conditional expression
- OpenGL: Unable to compile and link shader program.
- Failed vertex shader:
- #version 330 core
- layout (location = 0) in vec3 _ztvv_position;
- layout (location = 1) in vec2 _ztvv_uv;
- layout (location = 2) in vec3 _ztvv_normal;
- layout (location = 3) in vec4 _ztvv_color;
- layout (location = 4) in vec4 _ztvv_tangent;
- layout (location = 5) in vec4 _ztvv_bitangent;
- out PixelInput
- {
- vec4 position;
- vec3 frag_pos;
- vec4 frag_pos_light_space;
- vec3 normal;
- vec2 uv;
- vec4 color;
- vec4 frag_pos_view;
- vec3 normal_view;
- } _output;
- uniform mat4 model;
- uniform mat4 view;
- uniform mat4 projection;
- uniform mat4 light_matrix;
- void main()
- {
- mat4 model_mat = model;
- _output.position = projection * view * model_mat * vec4(_ztvv_position, 1.0);
- _output.frag_pos = vec3(model_mat * vec4(_ztvv_position, 1.0));
- _output.normal = mat3(model_mat) * _ztvv_normal;
- _output.uv = _ztvv_uv;
- _output.color = _ztvv_color;
- _output.frag_pos_light_space = light_matrix * vec4(_output.frag_pos, 1.0);
- _output.frag_pos_view = view * model_mat * vec4(_ztvv_position, 1);
- _output.normal_view = mat3(view) * mat3(model_mat) * _ztvv_normal;
- gl_Position = _output.position;
- }
- Failed fragment shader:
- #version 330 core
- layout (location = 0) out vec4 _ztfs_frag_color;
- layout (location = 1) out vec4 _ztfs_frag_position;
- layout (location = 2) out vec4 _ztfs_frag_normal;
- in PixelInput
- {
- vec4 position;
- vec3 frag_pos;
- vec4 frag_pos_light_space;
- vec3 normal;
- vec2 uv;
- vec4 color;
- vec4 frag_pos_view;
- vec3 normal_view;
- } _input;
- struct PointLight
- {
- vec3 pos;
- float intensity;
- vec3 ambient_color;
- int shadowmap_use;
- float far_plane;
- };
- struct SpotLight
- {
- vec3 pos;
- float intensity;
- vec3 direction;
- float cutoff_in;
- float cutoff_out;
- vec3 ambient_color;
- int shadowmap_use;
- float far_plane;
- };
- uniform vec3 view_pos;
- uniform float emissive_strength;
- uniform vec3 light_pos;
- uniform float light_ambient;
- uniform float light_intensity;
- uniform vec4 light_color;
- uniform PointLight point_lights[4];
- uniform int point_lights_count;
- uniform SpotLight spot_lights[4];
- uniform int spot_lights_count;
- uniform sampler2D diffuse_tex;
- uniform sampler2D specular_tex;
- uniform sampler2D normal_tex;
- uniform sampler2D emissive_tex;
- uniform samplerCube irradiance_map_tex;
- uniform samplerCube prefilter_map_tex;
- uniform sampler2D brdf_lut_tex;
- uniform sampler2D directional_light_shadowmap;
- uniform samplerCube point_lights_shadowmap[4];
- uniform samplerCube spot_lights_shadowmap[4];
- vec3 fresnelSchlick(float cos_theta, vec3 v)
- {
- return v + (1.0 - v) * pow(1.0 - cos_theta, 3.0);
- }
- vec3 fresnelSchlickRoughness(float cos_theta, vec3 v, float roughness)
- {
- return v + (max(vec3(1.0 - roughness), v) - v) * pow(1.0 - cos_theta, 3.0);
- }
- float distributionGGX(vec3 n, vec3 h, float roughness)
- {
- float a = roughness * roughness;
- float a2 = a * a;
- float n_dot_h = max(dot(n, h), 0.0);
- float n_dot_h2 = n_dot_h * n_dot_h;
- float nom = a2;
- float denom = (n_dot_h2 * (a2 - 1.0) + 1.0);
- denom = 3.14159265359 * denom * denom;
- return nom / denom;
- }
- float geometrySchlickGGX(float n_dot_v, float roughness)
- {
- float r = (roughness + 1.0);
- float k = (r * r) / 8.0;
- float nom = n_dot_v;
- float denom = n_dot_v * (1.0 - k) + k;
- return nom / denom;
- }
- float geometrySmith(vec3 n, vec3 v, vec3 l, float roughness)
- {
- float n_dot_v = max(dot(n, v), 0.0);
- float n_dot_l = max(dot(n, l), 0.0);
- float ggx2 = geometrySchlickGGX(n_dot_v, roughness);
- float ggx1 = geometrySchlickGGX(n_dot_l, roughness);
- return ggx1 * ggx2;
- }
- vec3 normalCalculation(vec2 uv)
- {
- vec3 tangent_normal = texture(normal_tex, uv).xyz;
- if (tangent_normal == vec3(1))
- {
- tangent_normal = _input.normal;
- return tangent_normal;
- }
- else
- {
- tangent_normal = tangent_normal * 2.0 - 1.0;
- }
- vec3 Q1 = dFdx(_input.position.xyz);
- vec3 Q2 = dFdy(_input.position.xyz);
- vec2 st1 = dFdx(uv);
- vec2 st2 = dFdy(uv);
- vec3 normal = normalize(_input.normal);
- vec3 T = normalize(Q1 * st2.y - Q2 * st1.y);
- vec3 B = -normalize(cross(normal, T));
- mat3 TBN = mat3(T, B, normal);
- return normalize(TBN * tangent_normal);
- }
- float shadowCalculation(vec3 light_dir, vec3 normal)
- {
- vec3 proj_coords = _input.frag_pos_light_space.xyz / _input.frag_pos_light_space.w;
- proj_coords = proj_coords * 0.5 + 0.5;
- if (proj_coords.x < 0.0 || proj_coords.x > 1.0 || proj_coords.y < 0.0 || proj_coords.y > 1.0)
- {
- return 0.0;
- }
- float current_depth = proj_coords.z;
- if (current_depth > 1.0 || current_depth < 0.0)
- {
- return 0.0;
- }
- float bias = 0.005;
- float shadow = 0.0;
- vec2 texel_size = 1.0 / textureSize(directional_light_shadowmap, 0);
- const int samples = 3;
- for (int x = -samples; x <= samples; ++x)
- {
- for (int y = -samples; y <= samples; ++y)
- {
- float pcf_depth = texture(directional_light_shadowmap, proj_coords.xy + vec2(x, y) * texel_size).r;
- shadow += (((current_depth - bias) > pcf_depth) ? (1.0) : (0.0));
- }
- }
- shadow /= (float(samples) * 2.0 + 1.0) * (float(samples) * 2.0 + 1.0);
- return shadow;
- }
- float shadowCalculationPointLight(PointLight light, samplerCube depth_tex, vec3 normal)
- {
- if (light.shadowmap_use == 0)
- {
- return 0;
- }
- vec3 frag_to_light = (_input.frag_pos - light.pos) * vec3(1, -1, -1);
- float current_depth = length(frag_to_light);
- float shadow = 0;
- float offset = 0.1;
- float bias = 0.05;
- int samples = 20;
- vec3 sample_offset_dir[20] = vec3[]( vec3(1, 1, 1), vec3(1, -1, 1), vec3(-1, -1, 1), vec3(-1, 1, 1), vec3(1, 1, -1), vec3(1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1), vec3(1, 1, 0), vec3(1, -1, 0), vec3(-1, -1, 0), vec3(-1, 1, 0), vec3(1, 0, 1), vec3(-1, 0, 1), vec3(1, 0, -1), vec3(-1, 0, -1), vec3(0, 1, 1), vec3(0, -1, 1), vec3(0, -1, -1), vec3(0, 1, -1) );
- float sample_offset_radius = 0.05;
- for (int i = 0; i < samples; ++i)
- {
- float closest_depth = texture(depth_tex, frag_to_light + sample_offset_dir[i] * sample_offset_radius).r;
- closest_depth *= light.far_plane;
- if (current_depth - bias > closest_depth)
- {
- shadow += 1;
- }
- }
- shadow /= float(samples);
- return shadow;
- }
- float shadowCalculationSpotLight(SpotLight light, samplerCube depth_tex, vec3 normal)
- {
- if (light.shadowmap_use == 0)
- {
- return 0;
- }
- vec3 frag_to_light = (_input.frag_pos - light.pos) * vec3(1, -1, -1);
- float current_depth = length(frag_to_light);
- float shadow = 0;
- float offset = 0.1;
- float bias = 0.05;
- int samples = 20;
- vec3 sample_offset_dir[20] = vec3[]( vec3(1, 1, 1), vec3(1, -1, 1), vec3(-1, -1, 1), vec3(-1, 1, 1), vec3(1, 1, -1), vec3(1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1), vec3(1, 1, 0), vec3(1, -1, 0), vec3(-1, -1, 0), vec3(-1, 1, 0), vec3(1, 0, 1), vec3(-1, 0, 1), vec3(1, 0, -1), vec3(-1, 0, -1), vec3(0, 1, 1), vec3(0, -1, 1), vec3(0, -1, -1), vec3(0, 1, -1) );
- float sample_offset_radius = 0.05;
- for (int i = 0; i < samples; ++i)
- {
- float closest_depth = texture(depth_tex, frag_to_light + sample_offset_dir[i] * sample_offset_radius).r;
- closest_depth *= light.far_plane;
- if (current_depth - bias > closest_depth)
- {
- shadow += 1;
- }
- }
- shadow /= float(samples);
- return shadow;
- }
- vec3 calculateLighting(vec3 light_dir, vec3 view_dir, vec3 normal, vec3 f0, vec3 light_pos, vec3 world_pos, vec3 light_color, float light_intensity, float shadow, vec3 albedo, float metallic, float roughness, bool directional)
- {
- vec3 H = normalize(view_dir + light_dir);
- vec3 radiance;
- if (directional)
- {
- float distance = 1;
- float attenuation = 1.0 / (distance * distance);
- radiance = light_color * attenuation * (1 - shadow) * light_intensity;
- }
- else
- {
- float distance = length(light_pos - world_pos);
- float attenuation = 1.0 / (distance * distance);
- radiance = light_color * attenuation * (1 - shadow) * light_intensity;
- }
- float NDF = distributionGGX(normal, H, roughness);
- float G = geometrySmith(normal, view_dir, light_dir, roughness);
- vec3 F = fresnelSchlick(max(dot(H, view_dir), 0.0), f0);
- vec3 nominator = NDF * G * F;
- float denominator = 4 * max(dot(normal, view_dir), 0.0) * max(dot(normal, light_dir), 0.0) + 0.001;
- vec3 specular = (nominator / denominator);
- vec3 kS = F;
- vec3 kD = vec3(1.0) - kS;
- kD *= 1.0 - metallic;
- float NdotL = max(dot(normal, light_dir), 0.0);
- return (kD * albedo / 3.14159265359 + specular) * radiance * NdotL;
- }
- void main()
- {
- vec3 world_pos = _input.frag_pos;
- vec3 view_dir = normalize(view_pos - world_pos);
- vec3 albedo = pow(texture(diffuse_tex, _input.uv).rgb, vec3(2.2));
- float metallic = texture(specular_tex, _input.uv).g;
- float roughness = texture(specular_tex, _input.uv).r;
- float ao = .005;
- vec3 normal = normalCalculation(_input.uv);
- vec3 reflection = reflect(-view_dir, normal);
- vec3 F0 = vec3(0.04);
- F0 = mix(F0, albedo, metallic);
- vec3 Lo = vec3(0.0);
- if (true)
- {
- vec3 light_dir = normalize(light_pos);
- float shadow = shadowCalculation(light_dir, normal);
- vec4 light_color = light_color;
- Lo += calculateLighting(light_dir, view_dir, normal, F0, light_pos, vec3(0), light_color.rgb, light_intensity, shadow, albedo, metallic, roughness, true);
- }
- if (true)
- {
- for (int i = 0; i < 4; ++i)
- {
- if (i >= point_lights_count)
- {
- break;
- }
- PointLight light = point_lights[i];
- vec3 light_dir = normalize(light.pos - world_pos);
- float shadow = shadowCalculationPointLight(light, point_lights_shadowmap[i], normal);
- Lo += calculateLighting(light_dir, view_dir, normal, F0, light.pos, world_pos, light.ambient_color, light.intensity, shadow, albedo, metallic, roughness, false);
- }
- }
- if (true)
- {
- for (int i = 0; i < 4; ++i)
- {
- if (i >= spot_lights_count)
- {
- break;
- }
- SpotLight light = spot_lights[i];
- vec3 light_dir = normalize(light.pos - world_pos);
- float shadow = shadowCalculationSpotLight(light, spot_lights_shadowmap[i], normal);
- Lo += calculateLighting(light_dir, view_dir, normal, F0, light.pos, world_pos, light.ambient_color, light.intensity, shadow, albedo, metallic, roughness, false);
- }
- }
- vec3 F = fresnelSchlickRoughness(max(dot(normal, view_dir), 0.0), F0, roughness);
- vec3 kS = F;
- vec3 kD = 1.0 - kS;
- kD *= 1.0 - metallic;
- vec3 irradiance = texture(irradiance_map_tex, normal).rgb;
- vec3 diffuse = irradiance * albedo * light_ambient;
- const float MAX_REFLECTION_LOD = 4.0;
- vec3 prefilteredColor = textureLod(prefilter_map_tex, reflection, roughness * MAX_REFLECTION_LOD).rgb;
- vec2 brdf = texture(brdf_lut_tex, vec2(max(dot(normal, view_dir), 0.0), roughness)).xy;
- vec3 specular = prefilteredColor * (F * brdf.x + brdf.y);
- vec3 ambient = (kD * diffuse + specular) * ao;
- vec3 emissive = texture(emissive_tex, _input.uv).rgb;
- vec3 color = ambient + Lo;
- color += (emissive * emissive_strength);
- _ztfs_frag_color = vec4(color, 1.0);
- _ztfs_frag_position = _input.frag_pos_view;
- _ztfs_frag_normal = vec4(normalize(_input.normal_view), 1);
- }
- Unable to make shader 'shaders/default_pbr.zts' (Unable to compile OpenGL shader program)
- Unable to load shader (shaders/default_pbr.zts). (null).
- Loaded asset: shaders/default_pbr_anim.zts (37)
- glLinkProgram failed. Reason: Fragment info
- -------------
- 0(266) : error C5208: Sampler needs to be a uniform (global or parameter to main), need to inline function or resolve conditional expression
- 0(280) : error C5208: Sampler needs to be a uniform (global or parameter to main), need to inline function or resolve conditional expression
- OpenGL: Unable to compile and link shader program.
- Failed vertex shader:
- #version 330 core
- layout (location = 0) in vec3 _ztvv_position;
- layout (location = 1) in vec2 _ztvv_uv;
- layout (location = 2) in vec3 _ztvv_normal;
- layout (location = 3) in vec4 _ztvv_color;
- layout (location = 4) in vec4 _ztvv_tangent;
- layout (location = 5) in vec4 _ztvv_bitangent;
- layout (location = 6) in ivec4 _ztvv_bones;
- layout (location = 7) in vec4 _ztvv_weights;
- out PixelInput
- {
- vec4 position;
- vec3 frag_pos;
- vec4 frag_pos_light_space;
- vec3 normal;
- vec2 uv;
- vec4 color;
- vec4 frag_pos_view;
- vec3 normal_view;
- } _output;
- uniform mat4 model;
- uniform mat4 view;
- uniform mat4 projection;
- uniform mat4 light_matrix;
- uniform mat4 bones[200];
- uniform int bones_count;
- void main()
- {
- mat4 model_mat = model;
- if (bones_count > 0)
- {
- mat4 bone_mat = bones[_ztvv_bones.x] * _ztvv_weights.x;
- bone_mat += bones[_ztvv_bones.y] * _ztvv_weights.y;
- bone_mat += bones[_ztvv_bones.z] * _ztvv_weights.z;
- bone_mat += bones[_ztvv_bones.w] * _ztvv_weights.w;
- model_mat = model * bone_mat;
- }
- _output.position = projection * view * model_mat * vec4(_ztvv_position, 1.0);
- _output.frag_pos = vec3(model_mat * vec4(_ztvv_position, 1.0));
- _output.normal = mat3(model_mat) * _ztvv_normal;
- _output.uv = _ztvv_uv;
- _output.color = _ztvv_color;
- _output.frag_pos_light_space = light_matrix * vec4(_output.frag_pos, 1.0);
- _output.frag_pos_view = view * model_mat * vec4(_ztvv_position, 1);
- _output.normal_view = mat3(view) * mat3(model_mat) * _ztvv_normal;
- gl_Position = _output.position;
- }
- Failed fragment shader:
- #version 330 core
- layout (location = 0) out vec4 _ztfs_frag_color;
- layout (location = 1) out vec4 _ztfs_frag_position;
- layout (location = 2) out vec4 _ztfs_frag_normal;
- in PixelInput
- {
- vec4 position;
- vec3 frag_pos;
- vec4 frag_pos_light_space;
- vec3 normal;
- vec2 uv;
- vec4 color;
- vec4 frag_pos_view;
- vec3 normal_view;
- } _input;
- struct PointLight
- {
- vec3 pos;
- float intensity;
- vec3 ambient_color;
- int shadowmap_use;
- float far_plane;
- };
- struct SpotLight
- {
- vec3 pos;
- float intensity;
- vec3 direction;
- float cutoff_in;
- float cutoff_out;
- vec3 ambient_color;
- int shadowmap_use;
- float far_plane;
- };
- uniform vec3 view_pos;
- uniform float emissive_strength;
- uniform vec3 light_pos;
- uniform float light_ambient;
- uniform float light_intensity;
- uniform vec4 light_color;
- uniform PointLight point_lights[4];
- uniform int point_lights_count;
- uniform SpotLight spot_lights[4];
- uniform int spot_lights_count;
- uniform sampler2D diffuse_tex;
- uniform sampler2D specular_tex;
- uniform sampler2D normal_tex;
- uniform sampler2D emissive_tex;
- uniform samplerCube irradiance_map_tex;
- uniform samplerCube prefilter_map_tex;
- uniform sampler2D brdf_lut_tex;
- uniform sampler2D directional_light_shadowmap;
- uniform samplerCube point_lights_shadowmap[4];
- uniform samplerCube spot_lights_shadowmap[4];
- vec3 fresnelSchlick(float cos_theta, vec3 v)
- {
- return v + (1.0 - v) * pow(1.0 - cos_theta, 3.0);
- }
- vec3 fresnelSchlickRoughness(float cos_theta, vec3 v, float roughness)
- {
- return v + (max(vec3(1.0 - roughness), v) - v) * pow(1.0 - cos_theta, 3.0);
- }
- float distributionGGX(vec3 n, vec3 h, float roughness)
- {
- float a = roughness * roughness;
- float a2 = a * a;
- float n_dot_h = max(dot(n, h), 0.0);
- float n_dot_h2 = n_dot_h * n_dot_h;
- float nom = a2;
- float denom = (n_dot_h2 * (a2 - 1.0) + 1.0);
- denom = 3.14159265359 * denom * denom;
- return nom / denom;
- }
- float geometrySchlickGGX(float n_dot_v, float roughness)
- {
- float r = (roughness + 1.0);
- float k = (r * r) / 8.0;
- float nom = n_dot_v;
- float denom = n_dot_v * (1.0 - k) + k;
- return nom / denom;
- }
- float geometrySmith(vec3 n, vec3 v, vec3 l, float roughness)
- {
- float n_dot_v = max(dot(n, v), 0.0);
- float n_dot_l = max(dot(n, l), 0.0);
- float ggx2 = geometrySchlickGGX(n_dot_v, roughness);
- float ggx1 = geometrySchlickGGX(n_dot_l, roughness);
- return ggx1 * ggx2;
- }
- vec3 normalCalculation(vec2 uv)
- {
- vec3 tangent_normal = texture(normal_tex, uv).xyz;
- if (tangent_normal == vec3(1))
- {
- tangent_normal = _input.normal;
- return tangent_normal;
- }
- else
- {
- tangent_normal = tangent_normal * 2.0 - 1.0;
- }
- vec3 Q1 = dFdx(_input.position.xyz);
- vec3 Q2 = dFdy(_input.position.xyz);
- vec2 st1 = dFdx(uv);
- vec2 st2 = dFdy(uv);
- vec3 normal = normalize(_input.normal);
- vec3 T = normalize(Q1 * st2.y - Q2 * st1.y);
- vec3 B = -normalize(cross(normal, T));
- mat3 TBN = mat3(T, B, normal);
- return normalize(TBN * tangent_normal);
- }
- float shadowCalculation(vec3 light_dir, vec3 normal)
- {
- vec3 proj_coords = _input.frag_pos_light_space.xyz / _input.frag_pos_light_space.w;
- proj_coords = proj_coords * 0.5 + 0.5;
- if (proj_coords.x < 0.0 || proj_coords.x > 1.0 || proj_coords.y < 0.0 || proj_coords.y > 1.0)
- {
- return 0.0;
- }
- float current_depth = proj_coords.z;
- if (current_depth > 1.0 || current_depth < 0.0)
- {
- return 0.0;
- }
- float bias = max(0.005 * (1.0 - dot(normal, light_dir)), 0.005);
- float shadow = 0.0;
- vec2 texel_size = 1.0 / textureSize(directional_light_shadowmap, 0);
- const int samples = 3;
- for (int x = -samples; x <= samples; ++x)
- {
- for (int y = -samples; y <= samples; ++y)
- {
- float pcf_depth = texture(directional_light_shadowmap, proj_coords.xy + vec2(x, y) * texel_size).r;
- shadow += (((current_depth - bias) > pcf_depth) ? (1.0) : (0.0));
- }
- }
- shadow /= (float(samples) * 2.0 + 1.0) * (float(samples) * 2.0 + 1.0);
- return shadow;
- }
- float shadowCalculationPointLight(PointLight light, samplerCube depth_tex, vec3 normal)
- {
- if (light.shadowmap_use == 0)
- {
- return 0;
- }
- vec3 frag_to_light = (_input.frag_pos - light.pos) * vec3(1, -1, -1);
- float current_depth = length(frag_to_light);
- float shadow = 0;
- float offset = 0.1;
- float bias = 0.05;
- int samples = 20;
- vec3 sample_offset_dir[20] = vec3[]( vec3(1, 1, 1), vec3(1, -1, 1), vec3(-1, -1, 1), vec3(-1, 1, 1), vec3(1, 1, -1), vec3(1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1), vec3(1, 1, 0), vec3(1, -1, 0), vec3(-1, -1, 0), vec3(-1, 1, 0), vec3(1, 0, 1), vec3(-1, 0, 1), vec3(1, 0, -1), vec3(-1, 0, -1), vec3(0, 1, 1), vec3(0, -1, 1), vec3(0, -1, -1), vec3(0, 1, -1) );
- float sample_offset_radius = 0.05;
- for (int i = 0; i < samples; ++i)
- {
- float closest_depth = texture(depth_tex, frag_to_light + sample_offset_dir[i] * sample_offset_radius).r;
- closest_depth *= light.far_plane;
- if (current_depth - bias > closest_depth)
- {
- shadow += 1;
- }
- }
- shadow /= float(samples);
- return shadow;
- }
- float shadowCalculationSpotLight(SpotLight light, samplerCube depth_tex, vec3 normal)
- {
- if (light.shadowmap_use == 0)
- {
- return 0;
- }
- vec3 frag_to_light = (_input.frag_pos - light.pos) * vec3(1, -1, -1);
- float current_depth = length(frag_to_light);
- float shadow = 0;
- float offset = 0.1;
- float bias = 0.05;
- int samples = 20;
- vec3 sample_offset_dir[20] = vec3[]( vec3(1, 1, 1), vec3(1, -1, 1), vec3(-1, -1, 1), vec3(-1, 1, 1), vec3(1, 1, -1), vec3(1, -1, -1), vec3(-1, -1, -1), vec3(-1, 1, -1), vec3(1, 1, 0), vec3(1, -1, 0), vec3(-1, -1, 0), vec3(-1, 1, 0), vec3(1, 0, 1), vec3(-1, 0, 1), vec3(1, 0, -1), vec3(-1, 0, -1), vec3(0, 1, 1), vec3(0, -1, 1), vec3(0, -1, -1), vec3(0, 1, -1) );
- float sample_offset_radius = 0.05;
- for (int i = 0; i < samples; ++i)
- {
- float closest_depth = texture(depth_tex, frag_to_light + sample_offset_dir[i] * sample_offset_radius).r;
- closest_depth *= light.far_plane;
- if (current_depth - bias > closest_depth)
- {
- shadow += 1;
- }
- }
- shadow /= float(samples);
- return shadow;
- }
- vec3 calculateLighting(vec3 light_dir, vec3 view_dir, vec3 normal, vec3 f0, vec3 light_pos, vec3 world_pos, vec3 light_color, float light_intensity, float shadow, vec3 albedo, float metallic, float roughness, bool directional)
- {
- vec3 H = normalize(view_dir + light_dir);
- vec3 radiance;
- if (directional)
- {
- float distance = 1;
- float attenuation = 1.0 / (distance * distance);
- radiance = light_color * attenuation * (1 - shadow) * light_intensity;
- }
- else
- {
- float distance = length(light_pos - world_pos);
- float attenuation = 1.0 / (distance * distance);
- radiance = light_color * attenuation * (1 - shadow) * light_intensity;
- }
- float NDF = distributionGGX(normal, H, roughness);
- float G = geometrySmith(normal, view_dir, light_dir, roughness);
- vec3 F = fresnelSchlick(max(dot(H, view_dir), 0.0), f0);
- vec3 nominator = NDF * G * F;
- float denominator = 4 * max(dot(normal, view_dir), 0.0) * max(dot(normal, light_dir), 0.0) + 0.001;
- vec3 specular = (nominator / denominator);
- vec3 kS = F;
- vec3 kD = vec3(1.0) - kS;
- kD *= 1.0 - metallic;
- float NdotL = max(dot(normal, light_dir), 0.0);
- return (kD * albedo / 3.14159265359 + specular) * radiance * NdotL;
- }
- void main()
- {
- vec3 world_pos = _input.frag_pos;
- vec3 view_dir = normalize(view_pos - world_pos);
- vec3 albedo = pow(texture(diffuse_tex, _input.uv).rgb, vec3(2.2));
- float metallic = texture(specular_tex, _input.uv).g;
- float roughness = texture(specular_tex, _input.uv).r;
- float ao = .005;
- vec3 normal = normalCalculation(_input.uv);
- vec3 reflection = reflect(-view_dir, normal);
- vec3 F0 = vec3(0.04);
- F0 = mix(F0, albedo, metallic);
- vec3 Lo = vec3(0.0);
- if (true)
- {
- vec3 light_dir = normalize(light_pos);
- float shadow = shadowCalculation(light_dir, normal);
- vec4 light_color = light_color;
- Lo += calculateLighting(light_dir, view_dir, normal, F0, light_pos, vec3(0), light_color.rgb, light_intensity, shadow, albedo, metallic, roughness, true);
- }
- if (true)
- {
- for (int i = 0; i < 4; ++i)
- {
- if (i >= point_lights_count)
- {
- break;
- }
- PointLight light = point_lights[i];
- vec3 light_dir = normalize(light.pos - world_pos);
- float shadow = shadowCalculationPointLight(light, point_lights_shadowmap[i], normal);
- Lo += calculateLighting(light_dir, view_dir, normal, F0, light.pos, world_pos, light.ambient_color, light.intensity, shadow, albedo, metallic, roughness, false);
- }
- }
- if (true)
- {
- for (int i = 0; i < 4; ++i)
- {
- if (i >= spot_lights_count)
- {
- break;
- }
- SpotLight light = spot_lights[i];
- vec3 light_dir = normalize(light.pos - world_pos);
- float shadow = shadowCalculationSpotLight(light, spot_lights_shadowmap[i], normal);
- Lo += calculateLighting(light_dir, view_dir, normal, F0, light.pos, world_pos, light.ambient_color, light.intensity, shadow, albedo, metallic, roughness, false);
- }
- }
- vec3 F = fresnelSchlickRoughness(max(dot(normal, view_dir), 0.0), F0, roughness);
- vec3 kS = F;
- vec3 kD = 1.0 - kS;
- kD *= 1.0 - metallic;
- vec3 irradiance = texture(irradiance_map_tex, normal).rgb;
- vec3 diffuse = albedo * light_ambient;
- const float MAX_REFLECTION_LOD = 4.0;
- vec3 prefilteredColor = textureLod(prefilter_map_tex, reflection, roughness * MAX_REFLECTION_LOD).rgb;
- vec2 brdf = texture(brdf_lut_tex, vec2(max(dot(normal, view_dir), 0.0), roughness)).xy;
- vec3 specular = prefilteredColor * (F * brdf.x + brdf.y);
- vec3 ambient = (kD * diffuse + specular) * ao;
- vec3 emissive = texture(emissive_tex, _input.uv).rgb;
- vec3 color = ambient + Lo;
- color += (emissive * emissive_strength);
- _ztfs_frag_color = vec4(color, 1.0);
- _ztfs_frag_position = _input.frag_pos_view;
- _ztfs_frag_normal = vec4(normalize(_input.normal_view), 1);
- }
- Unable to make shader 'shaders/default_pbr_anim.zts' (Unable to compile OpenGL shader program)
- Unable to load shader (shaders/default_pbr_anim.zts). (null).
- Loaded asset: shaders/menu.zts (38)
- opengl: made texture (id: 22; fbo: 13; dim: 4096 x 4096)
- zt_textureMakeRenderTarget took 10.027925 ms to execute
- Loaded asset: textures/environment.hdr (40)
- loading texture asset: textures/environment.hdr (40)
- stbi_loadf_from_memory took 414.231842 ms to execute
- opengl: made texture (id: 23; fbo: 0; dim: 2048 x 1024)
- zt_textureMake (from asset) took 622.804077 ms to execute
Advertisement
Add Comment
Please, Sign In to add comment