Commit 173ae34d authored by Johannes Braun's avatar Johannes Braun
Browse files

Added Fake Lense flares

parent b73ca4de
...@@ -4,7 +4,7 @@ Size=353,64 ...@@ -4,7 +4,7 @@ Size=353,64
Collapsed=0 Collapsed=0
[Scene] [Scene]
Pos=-5,66 Pos=-5,65
Size=352,837 Size=352,837
Collapsed=0 Collapsed=0
......
<linespace version="1.0"> <linespace version="1.0">
<item name="subdivisions" value="6"/> <item name="subdivisions" value="10"/>
<item name="radial-subdivision" value="50"/> <item name="radial-subdivision" value="50"/>
<item name="generator" value="gpu"/> <item name="generator" value="gpu"/>
</linespace> </linespace>
...@@ -140,7 +140,7 @@ bool traverseLineSpace(const in Mesh mesh, int index, const in Ray local_ray, co ...@@ -140,7 +140,7 @@ bool traverseLineSpace(const in Mesh mesh, int index, const in Ray local_ray, co
Ray loc = local_ray; Ray loc = local_ray;
loc.origin += 0.05f * loc.direction; loc.origin += 0.05f * loc.direction;
float offset = 0;//-1.f;//compMin(mesh.linespace.patch_size); float offset = -100.f;//-1.f;//compMin(mesh.linespace.patch_size);
Ray offset_ray = local_ray; Ray offset_ray = local_ray;
offset_ray.origin += local_ray.direction * offset; offset_ray.origin += local_ray.direction * offset;
...@@ -152,6 +152,9 @@ bool traverseLineSpace(const in Mesh mesh, int index, const in Ray local_ray, co ...@@ -152,6 +152,9 @@ bool traverseLineSpace(const in Mesh mesh, int index, const in Ray local_ray, co
bool swapped = false; bool swapped = false;
uint line_id = lineIndex(offset_ray, mesh, index, tmin, tmax, face_tmin, face_tmax, swapped); uint line_id = lineIndex(offset_ray, mesh, index, tmin, tmax, face_tmin, face_tmax, swapped);
// if(line_id * 2 + 1 > mesh.linespaces[index].line_count)
// return false;
Line line_near = mesh.linespaces[index].lines[line_id * 2]; Line line_near = mesh.linespaces[index].lines[line_id * 2];
Line line_far = mesh.linespaces[index].lines[line_id * 2 + 1]; Line line_far = mesh.linespaces[index].lines[line_id * 2 + 1];
......
#version 430
#extension GL_ARB_shading_language_include : require
#extension GL_ARB_bindless_texture : require
uniform sampler2D base_texture;
uniform sampler2D bloom_texture;
layout(location=0) out vec4 output_color;
const vec3 tints[3] = vec3[3](
vec3(1.f, 0.8f, 0.4f),
vec3(0.7f, 0.9f, 0.5f),
vec3(0.3f, 0.7f, 1.f)
);
void main() {
ivec2 pixel = ivec2(gl_FragCoord.xy);
vec4 color_base = texelFetch(base_texture, pixel, 0);
vec4 color_bloom = texelFetch(bloom_texture, pixel, 0);
ivec2 t_size = ivec2(textureSize(bloom_texture, 0).xy);
vec4 color_bloom_inv = texelFetch(bloom_texture, t_size - ivec2(1) - pixel, 0);
vec2 dir = (vec2(pixel) / vec2(t_size)) * 2 - 1;
output_color = color_base + 0.3f*color_bloom;
for(int i=0; i<3; ++i)
output_color += 0.1f * texelFetch(bloom_texture, t_size/2 + ivec2(vec2(t_size)/2 * dir / ((i+2))), 0) * vec4(tints[i], 1);
}
...@@ -72,7 +72,11 @@ namespace glare::core ...@@ -72,7 +72,11 @@ namespace glare::core
post_process.bufferSwap(); post_process.bufferSwap();
post_process.blur2D(8, 2, post_process.currentBuffer().attachment(gl::Attachment::eColor0)); post_process.blur2D(8, 2, post_process.currentBuffer().attachment(gl::Attachment::eColor0));
post_process.bufferSwap(); post_process.bufferSwap();
post_process.add(composite_texture);
static auto bloom = TextureRenderer::make(files::shader("screenshader/bloom/bloom.frag"));
bloom->shader().uniform("base_texture", composite_texture.textureAddress());
bloom->shader().uniform("bloom_texture", post_process.currentBuffer().attachment(gl::Attachment::eColor0).textureAddress());
bloom->draw();
} }
}); });
......
...@@ -138,8 +138,8 @@ namespace glare::core ...@@ -138,8 +138,8 @@ namespace glare::core
Log_Hint << message; Log_Hint << message;
}); });
//gl::debugMessageControl(gl::DebugSeverity::eNotification, false); gl::debugMessageControl(gl::DebugSeverity::eNotification, false);
//gl::debugMessageControl(gl::DebugSeverity::eLow, false); gl::debugMessageControl(gl::DebugSeverity::eLow, false);
gl::setEnabled(gl::EnableParameter::eMultisample, true); gl::setEnabled(gl::EnableParameter::eMultisample, true);
......
...@@ -57,7 +57,7 @@ namespace glare::raytrace ...@@ -57,7 +57,7 @@ namespace glare::raytrace
m_vertex_buffer->makeResident(gl::Access::eReadOnly); m_vertex_buffer->makeResident(gl::Access::eReadOnly);
m_triangle_buffer->makeResident(gl::Access::eReadOnly); m_triangle_buffer->makeResident(gl::Access::eReadOnly);
int subdiv_grid = 5; int subdiv_grid = 1;
auto subdiv = m_bounds.computeSubdivision(subdiv_grid); auto subdiv = m_bounds.computeSubdivision(subdiv_grid);
int count = subdiv.resolution.x * subdiv.resolution.y * subdiv.resolution.z; int count = subdiv.resolution.x * subdiv.resolution.y * subdiv.resolution.z;
......
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