Commit f926939c authored by Florian Oetke's avatar Florian Oetke
Browse files

Merge branch 'develop' into 'master'

GDW WS18/19

See merge request !1
parents f9699ca1 e85248b7
Pipeline #3151 passed with stage
in 12 minutes and 45 seconds
#version 450
#extension GL_ARB_separate_shader_objects : enable
#extension GL_ARB_shading_language_420pack : enable
layout(location = 0) in Vertex_data {
vec2 tex_coords;
} vertex_out;
layout(location = 0) out vec4 out_color;
layout(set=1, binding = 0) uniform sampler2D color_sampler;
// A Fast, Small-Radius GPU Median Filter by Morgan McGuire: http://casual-effects.com/research/McGuire2008Median/index.html
#define s2(a, b) temp = a; a = min(a, b); b = max(temp, b);
#define mn3(a, b, c) s2(a, b); s2(a, c);
#define mx3(a, b, c) s2(b, c); s2(a, c);
#define mnmx3(a, b, c) mx3(a, b, c); s2(a, b); // 3 exchanges
#define mnmx4(a, b, c, d) s2(a, b); s2(c, d); s2(a, c); s2(b, d); // 4 exchanges
#define mnmx5(a, b, c, d, e) s2(a, b); s2(c, d); mn3(a, c, e); mx3(b, d, e); // 6 exchanges
#define mnmx6(a, b, c, d, e, f) s2(a, d); s2(b, e); s2(c, f); mn3(a, b, c); mx3(d, e, f); // 7 exchanges
void main() {
ivec2 result_sampler_size = textureSize(color_sampler, 0).xy;
ivec2 uv = ivec2(textureSize(color_sampler, 0).xy * vertex_out.tex_coords);
vec3 colors[9];
for(int x=-1; x<=1; x++) {
for(int y=-1; y<=1; y++) {
ivec2 c_uv = uv+ivec2(x,y);
c_uv = clamp(c_uv, ivec2(0,0), result_sampler_size-ivec2(1,1));
colors[(x+1)*3+(y+1)] = texelFetch(color_sampler, c_uv, 0).rgb;
}
}
float min_c = dot(colors[0], colors[0]);
float max_c = min_c;
for(int i=1; i<9; i++) {
float intensity = dot(colors[i], colors[i]);
min_c = min(min_c, intensity);
max_c = max(max_c, intensity);
}
vec3 org = colors[4];
float org_intensity = dot(org, org);
if(min_c<org_intensity && max_c>org_intensity) {
out_color = vec4(org, 1.0);
} else {
// Starting with a subset of size 6, remove the min and max each time
vec3 temp;
mnmx6(colors[0], colors[1], colors[2], colors[3], colors[4], colors[5]);
mnmx5(colors[1], colors[2], colors[3], colors[4], colors[6]);
mnmx4(colors[2], colors[3], colors[4], colors[7]);
mnmx3(colors[3], colors[4], colors[8]);
out_color = vec4(colors[4], 1.0);
}
//out_color = vec4(org, 1.0);
}
blueprint:camera = blueprints/camera.json
blueprint:sponza = blueprints/sponza.json
blueprint:cornell = blueprints/cornell.json
blueprint:sun = blueprints/sun.json
blueprint:cube = blueprints/cube.json
blueprint: = blueprints/*.json
model: = models/
mat: = materials/
model:cube = models/cube.mmf
model: = models/*.mmf
mat: = materials/*.msf
particle: = particles/
particle_def:test_particles = particles/test_particles.json
particle_sys:test_particles = particles/test_particle_system.json
particle_def:test_smoke_particles = particles/test_smoke_particles.json
particle_sys:test_smoke_particles = particles/test_smoke_system.json
{
"Transform":{
},
"Billboard": {
"billboards": [
{
"size": {"w":1, "h":1},
"material_aid": "mat:billboard_material.msf",
"clip_rect": {"x":0, "y":0, "z":1, "w":1},
"dynamic_lighting": true
}
]
}
}
{
"Transform":{
},
"Decal": {
"decals": [
{
"size": {"w":1, "h":1},
"material_aid": "mat:decal_material.msf",
"clip_rect": {"x":0, "y":0, "z":1, "w":1},
"thickness": 0.2,
"color": {"a":0.25}
}
]
}
}
......@@ -3,12 +3,15 @@
},
"Directional_light": {
"source_radius": 0.8,
"intensity": 140000.0,
"intensity": 130000.0,
"temperature": 4500,
"shadow_intensity": 2.0,
"shadow_temperature": 4000,
"shadow_size": 24,
"near_plane": 1.0,
"far_plane": 80,
"update_frequency": 1
"update_frequency": 1,
"light_particles": true
},
"Shadowcaster": {
},
......
{
"Transform":{
"scale": {"x": 0.1, "y": 0.1, "z": 0.1}
},
"Model": {
"aid": "model:cube"
},
"Particle_system": {
"cfg": "particle_sys:test_particles"
}
}
{
"Transform":{
"scale": {"x": 0.1, "y": 0.1, "z": 0.1}
},
"Model": {
"aid": "model:cube"
},
"Particle_system": {
"cfg": "particle_sys:test_smoke_particles"
}
}
{
"albedo_aid": "billboard.ktx",
"emission_aid": "white"
}
{
"substance_id": "emissive",
"albedo_aid": "cube_light.ktx"
"substance_id": "default",
"albedo_aid": "cube_light.ktx",
"emission_aid": "default_white.ktx"
}
{
"albedo_aid": "billboard.ktx",
"normal_aid": "sponza_bricks_normal.ktx"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment