Remove ssr
This commit is contained in:
@@ -481,7 +481,6 @@
|
||||
"Run": "Ausführen",
|
||||
"S": "S",
|
||||
"SSAO": "SSAO",
|
||||
"SSR": "SSR",
|
||||
"Samples": "Samples",
|
||||
"Saturation": "Sättigung",
|
||||
"Save": "Speichern",
|
||||
|
||||
@@ -413,7 +413,6 @@
|
||||
"Run": "Εκτέλεση",
|
||||
"S": "S",
|
||||
"SSAO": "SSAO",
|
||||
"SSR": "SSR",
|
||||
"Samples": "Δείγματα",
|
||||
"Saturation": "Κορεσμός",
|
||||
"Save": "Αποθήκευση",
|
||||
|
||||
@@ -361,7 +361,6 @@
|
||||
"Run": "Ejecutar",
|
||||
"S": "S",
|
||||
"SSAO": "SSAO",
|
||||
"SSR": "SSR",
|
||||
"Saturation": "Saturación",
|
||||
"Save": "Guardar",
|
||||
"Save As...": "Guardar como...",
|
||||
|
||||
@@ -375,7 +375,6 @@
|
||||
"rounded_cube": "cube_arrondi",
|
||||
"Run": "Exécuter",
|
||||
"SSAO": "SSAO",
|
||||
"SSR": "SSR",
|
||||
"Saturation": "Saturation",
|
||||
"Save": "Enregistrer",
|
||||
"Save As...": "Enregistrer sous...",
|
||||
|
||||
@@ -480,7 +480,6 @@
|
||||
"Run": "実行",
|
||||
"S": "S",
|
||||
"SSAO": "スクリーンスペースアンビエントオクルージョン",
|
||||
"SSR": "スクリーンスペース反射",
|
||||
"Samples": "サンプル数",
|
||||
"Saturation": "彩度",
|
||||
"Save": "保存",
|
||||
|
||||
@@ -379,7 +379,6 @@
|
||||
"Run": "Wystartuj",
|
||||
"S": "S",
|
||||
"SSAO": "SSAO",
|
||||
"SSR": "SSR",
|
||||
"Samples": "Próbki",
|
||||
"Saturation": "Saturacja",
|
||||
"Save": "Zapisz",
|
||||
|
||||
@@ -312,7 +312,6 @@
|
||||
"Run": "Rodar",
|
||||
"S": "S",
|
||||
"SSAO": "SSAO",
|
||||
"SSR": "SSR",
|
||||
"Saturation": "Saturação",
|
||||
"Save": "Salvar",
|
||||
"Save As...": "Salvar Como...",
|
||||
|
||||
@@ -304,7 +304,6 @@
|
||||
"Run": "Запуск",
|
||||
"S": "S",
|
||||
"SSAO": "Всеобщая окклюзия в экранном пространстве",
|
||||
"SSR": "Отражения в экранном пространстве",
|
||||
"Saturation": "Насыщение",
|
||||
"Save": "Сохранить",
|
||||
"Save As...": "Сохранить как...",
|
||||
|
||||
@@ -314,7 +314,6 @@
|
||||
"Run": "运行",
|
||||
"S": "S",
|
||||
"SSAO": "屏幕空间环境光遮蔽(SSAO)",
|
||||
"SSR": "屏幕空间反射(SSR)",
|
||||
"Saturation": "饱和度",
|
||||
"Save": "保存",
|
||||
"Save As...": "另存为...",
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
#version 450
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D gbuffer0;
|
||||
uniform vec2 dir_inv;
|
||||
|
||||
#include "std/gbuffer.glsl"
|
||||
|
||||
in vec2 tex_coord;
|
||||
out vec4 frag_color;
|
||||
|
||||
void main() {
|
||||
float roughness = textureLod(gbuffer0, tex_coord, 0.0).b;
|
||||
if (roughness >= 0.8) { // No reflections
|
||||
frag_color.rgb = textureLod(tex, tex_coord, 0.0).rgb;
|
||||
return;
|
||||
}
|
||||
|
||||
frag_color.rgb = textureLod(tex, tex_coord + dir_inv * 2.5, 0.0).rgb;
|
||||
frag_color.rgb += textureLod(tex, tex_coord + dir_inv * 1.5, 0.0).rgb;
|
||||
frag_color.rgb += textureLod(tex, tex_coord, 0.0).rgb;
|
||||
frag_color.rgb += textureLod(tex, tex_coord - dir_inv * 1.5, 0.0).rgb;
|
||||
frag_color.rgb += textureLod(tex, tex_coord - dir_inv * 2.5, 0.0).rgb;
|
||||
frag_color.rgb /= vec3(5.0, 5.0, 5.0);
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
#version 450
|
||||
|
||||
uniform sampler2D tex;
|
||||
uniform sampler2D gbufferD;
|
||||
uniform sampler2D gbuffer0;
|
||||
uniform sampler2D gbuffer1;
|
||||
uniform mat4 P;
|
||||
uniform mat3 V3;
|
||||
uniform vec2 camera_proj;
|
||||
|
||||
#include "std/math.glsl"
|
||||
#include "std/gbuffer.glsl"
|
||||
|
||||
in vec3 view_ray;
|
||||
in vec2 tex_coord;
|
||||
out vec4 frag_color;
|
||||
|
||||
const float ssr_ray_step = 0.04;
|
||||
const float ssr_min_ray_step = 0.05;
|
||||
const float ssr_search_dist = 5.0;
|
||||
const float ssr_falloff_exp = 5.0;
|
||||
const float ssr_jitter = 0.6;
|
||||
const int num_binary_search_steps = 7;
|
||||
const int max_steps = 18;
|
||||
|
||||
vec3 hit_coord;
|
||||
float depth;
|
||||
|
||||
vec2 get_projected_coord(const vec3 hit) {
|
||||
vec4 projected_coord = mul(vec4(hit, 1.0), P);
|
||||
projected_coord.xy /= projected_coord.w;
|
||||
projected_coord.xy = projected_coord.xy * 0.5 + 0.5;
|
||||
#ifdef GLSL
|
||||
#else
|
||||
projected_coord.y = 1.0 - projected_coord.y;
|
||||
#endif
|
||||
return projected_coord.xy;
|
||||
}
|
||||
|
||||
float get_delta_depth(const vec3 hit) {
|
||||
depth = textureLod(gbufferD, get_projected_coord(hit), 0.0).r * 2.0 - 1.0;
|
||||
vec3 view_pos = get_pos_view(view_ray, depth, camera_proj);
|
||||
return view_pos.z - hit.z;
|
||||
}
|
||||
|
||||
vec4 binary_search(vec3 dir) {
|
||||
float ddepth;
|
||||
vec3 start = hit_coord;
|
||||
for (int i = 0; i < num_binary_search_steps; i++) {
|
||||
dir *= 0.5;
|
||||
hit_coord -= dir;
|
||||
ddepth = get_delta_depth(hit_coord);
|
||||
if (ddepth < 0.0) hit_coord += dir;
|
||||
}
|
||||
// Ugly discard of hits too far away
|
||||
if (abs(ddepth) > ssr_search_dist / 500) return vec4(0.0, 0.0, 0.0, 0.0);
|
||||
return vec4(get_projected_coord(hit_coord), 0.0, 1.0);
|
||||
}
|
||||
|
||||
vec4 ray_cast(vec3 dir) {
|
||||
dir *= ssr_ray_step;
|
||||
for (int i = 0; i < max_steps; i++) {
|
||||
hit_coord += dir;
|
||||
if (get_delta_depth(hit_coord) > 0.0) return binary_search(dir);
|
||||
}
|
||||
return vec4(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec4 g0 = textureLod(gbuffer0, tex_coord, 0.0);
|
||||
float roughness = g0.b;
|
||||
if (roughness == 1.0) {
|
||||
frag_color.rgb = vec3(0.0, 0.0, 0.0);
|
||||
return;
|
||||
}
|
||||
|
||||
float d = textureLod(gbufferD, tex_coord, 0.0).r * 2.0 - 1.0;
|
||||
if (d == 1.0) {
|
||||
frag_color.rgb = vec3(0.0, 0.0, 0.0);
|
||||
return;
|
||||
}
|
||||
|
||||
vec2 enc = g0.rg;
|
||||
vec3 n;
|
||||
n.z = 1.0 - abs(enc.x) - abs(enc.y);
|
||||
n.xy = n.z >= 0.0 ? enc.xy : octahedron_wrap(enc.xy);
|
||||
n = normalize(n);
|
||||
|
||||
vec3 view_normal = mul(n, V3);
|
||||
vec3 view_pos = get_pos_view(view_ray, d, camera_proj);
|
||||
vec3 reflected = normalize(reflect(view_pos, view_normal));
|
||||
hit_coord = view_pos;
|
||||
|
||||
vec3 dir = reflected * (1.0 - rand(tex_coord) * ssr_jitter * roughness) * 2.0;
|
||||
// * max(ssr_min_ray_step, -view_pos.z)
|
||||
vec4 coords = ray_cast(dir);
|
||||
|
||||
vec2 delta_coords = abs(vec2(0.5, 0.5) - coords.xy);
|
||||
float screen_edge_factor = clamp(1.0 - (delta_coords.x + delta_coords.y), 0.0, 1.0);
|
||||
|
||||
float reflectivity = 1.0 - roughness;
|
||||
float intensity = pow(reflectivity, ssr_falloff_exp) *
|
||||
screen_edge_factor *
|
||||
clamp(-reflected.z, 0.0, 1.0) *
|
||||
clamp((ssr_search_dist - length(view_pos - hit_coord)) *
|
||||
(1.0 / ssr_search_dist), 0.0, 1.0) *
|
||||
coords.w;
|
||||
|
||||
intensity = clamp(intensity, 0.0, 1.0);
|
||||
vec3 reflcol = textureLod(tex, coords.xy, 0.0).rgb;
|
||||
reflcol = clamp(reflcol, 0.0, 1.0);
|
||||
frag_color.rgb = reflcol * intensity * 0.5;
|
||||
}
|
||||
@@ -553,11 +553,6 @@ function box_preferences_show() {
|
||||
context_raw.hssao.selected = config_raw.rp_ssao;
|
||||
}
|
||||
|
||||
context_raw.hssr = ui_handle(__ID__);
|
||||
if (context_raw.hssr.init) {
|
||||
context_raw.hssr.selected = config_raw.rp_ssr;
|
||||
}
|
||||
|
||||
context_raw.hbloom = ui_handle(__ID__);
|
||||
if (context_raw.hbloom.init) {
|
||||
context_raw.hbloom.selected = config_raw.rp_bloom;
|
||||
@@ -640,10 +635,6 @@ function box_preferences_show() {
|
||||
if (context_raw.hssao.changed) {
|
||||
config_apply();
|
||||
}
|
||||
ui_check(context_raw.hssr, tr("SSR"));
|
||||
if (context_raw.hssr.changed) {
|
||||
config_apply();
|
||||
}
|
||||
ui_check(context_raw.hbloom, tr("Bloom"));
|
||||
if (context_raw.hbloom.changed) {
|
||||
config_apply();
|
||||
|
||||
@@ -54,7 +54,6 @@ function config_save() {
|
||||
json_encode_f32("window_scale", config_raw.window_scale);
|
||||
json_encode_f32("rp_supersample", config_raw.rp_supersample);
|
||||
json_encode_bool("rp_ssao", config_raw.rp_ssao);
|
||||
json_encode_bool("rp_ssr", config_raw.rp_ssr);
|
||||
json_encode_bool("rp_bloom", config_raw.rp_bloom);
|
||||
json_encode_bool("rp_motionblur", config_raw.rp_motionblur);
|
||||
json_encode_bool("rp_gi", config_raw.rp_gi);
|
||||
@@ -147,7 +146,6 @@ function config_init() {
|
||||
///else
|
||||
config_raw.rp_ssao = true;
|
||||
///end
|
||||
config_raw.rp_ssr = false;
|
||||
config_raw.rp_supersample = 1.0;
|
||||
config_raw.version = manifest_version;
|
||||
config_raw.sha = config_get_sha();
|
||||
@@ -246,7 +244,6 @@ function config_import_from(from: config_t) {
|
||||
|
||||
function config_apply() {
|
||||
config_raw.rp_ssao = context_raw.hssao.selected;
|
||||
config_raw.rp_ssr = context_raw.hssr.selected;
|
||||
config_raw.rp_bloom = context_raw.hbloom.selected;
|
||||
config_raw.rp_gi = context_raw.hvxao.selected;
|
||||
config_raw.rp_supersample = config_get_super_sample_size(context_raw.hsupersample.position);
|
||||
@@ -394,7 +391,6 @@ type config_t = {
|
||||
// Render path
|
||||
rp_supersample?: f32;
|
||||
rp_ssao?: bool;
|
||||
rp_ssr?: bool;
|
||||
rp_bloom?: bool;
|
||||
rp_motionblur?: bool;
|
||||
rp_gi?: bool;
|
||||
|
||||
@@ -85,7 +85,6 @@ type context_t = {
|
||||
fov_handle?: ui_handle_t;
|
||||
undo_handle?: ui_handle_t;
|
||||
hssao?: ui_handle_t;
|
||||
hssr?: ui_handle_t;
|
||||
hbloom?: ui_handle_t;
|
||||
hsupersample?: ui_handle_t;
|
||||
hvxao?: ui_handle_t;
|
||||
|
||||
@@ -383,43 +383,6 @@ function render_path_base_draw_deferred_light() {
|
||||
///end
|
||||
}
|
||||
|
||||
function render_path_base_draw_ssr() {
|
||||
if (config_raw.rp_ssr != false) {
|
||||
if (map_get(_render_path_cached_shader_contexts, "shader_datas/ssr_pass/ssr_pass") == null) {
|
||||
{
|
||||
let t: render_target_t = render_target_create();
|
||||
t.name = "bufb";
|
||||
t.width = 0;
|
||||
t.height = 0;
|
||||
t.format = "RGBA64";
|
||||
render_path_create_render_target(t);
|
||||
}
|
||||
render_path_load_shader("shader_datas/ssr_pass/ssr_pass");
|
||||
render_path_load_shader("shader_datas/ssr_blur_pass/ssr_blur_pass_x");
|
||||
render_path_load_shader("shader_datas/ssr_blur_pass/ssr_blur_pass_y3_blend");
|
||||
}
|
||||
let targeta: string = "bufb";
|
||||
let targetb: string = "gbuffer1";
|
||||
|
||||
render_path_set_target(targeta);
|
||||
render_path_bind_target("tex", "tex");
|
||||
render_path_bind_target("_main", "gbufferD");
|
||||
render_path_bind_target("gbuffer0", "gbuffer0");
|
||||
render_path_bind_target("gbuffer1", "gbuffer1");
|
||||
render_path_draw_shader("shader_datas/ssr_pass/ssr_pass");
|
||||
|
||||
render_path_set_target(targetb);
|
||||
render_path_bind_target(targeta, "tex");
|
||||
render_path_bind_target("gbuffer0", "gbuffer0");
|
||||
render_path_draw_shader("shader_datas/ssr_blur_pass/ssr_blur_pass_x");
|
||||
|
||||
render_path_set_target("tex");
|
||||
render_path_bind_target(targetb, "tex");
|
||||
render_path_bind_target("gbuffer0", "gbuffer0");
|
||||
render_path_draw_shader("shader_datas/ssr_blur_pass/ssr_blur_pass_y3_blend");
|
||||
}
|
||||
}
|
||||
|
||||
// function render_path_base_draw_motion_blur() {
|
||||
// if (config_raw.rp_motionblur != false) {
|
||||
// render_path_set_target("buf");
|
||||
|
||||
@@ -179,7 +179,6 @@ function render_path_deferred_draw_deferred() {
|
||||
///end
|
||||
render_path_base_draw_deferred_light();
|
||||
render_path_base_draw_bloom();
|
||||
render_path_base_draw_ssr();
|
||||
// draw_motion_blur();
|
||||
// draw_histogram();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user