diff options
author | Juan Linietsky <reduzio@gmail.com> | 2017-06-01 22:38:07 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2017-06-01 22:38:07 -0300 |
commit | e79d7149ea751e32312cb8625548085d4537c591 (patch) | |
tree | 1f5341a8191b6db1ccbb3320191d8114a36a9f3e | |
parent | c03131fc9f7aef119f864cc266330855134feb62 (diff) |
GI probes working back again
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 8 | ||||
-rw-r--r-- | scene/3d/gi_probe.cpp | 7 |
2 files changed, 9 insertions, 6 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 5c65e10dbe..f35e04c5e4 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -672,7 +672,7 @@ LIGHT_SHADER_CODE diffuse+= light_color * diffuse_color * lightScatter * viewScatter * energyFactor; } #else - + //lambert diffuse += dotNL * light_color * diffuse_color; #endif @@ -1020,7 +1020,7 @@ void reflection_process(int idx, vec3 vertex, vec3 normal,vec3 binormal, vec3 ta #ifdef USE_GI_PROBES -uniform mediump sampler3D gi_probe1; //texunit:-11 +uniform mediump sampler3D gi_probe1; //texunit:-10 uniform highp mat4 gi_probe_xform1; uniform highp vec3 gi_probe_bounds1; uniform highp vec3 gi_probe_cell_size1; @@ -1028,7 +1028,7 @@ uniform highp float gi_probe_multiplier1; uniform highp float gi_probe_bias1; uniform bool gi_probe_blend_ambient1; -uniform mediump sampler3D gi_probe2; //texunit:-10 +uniform mediump sampler3D gi_probe2; //texunit:-11 uniform highp mat4 gi_probe_xform2; uniform highp vec3 gi_probe_bounds2; uniform highp vec3 gi_probe_cell_size2; @@ -1345,7 +1345,7 @@ FRAGMENT_SHADER_CODE { //read radiance from dual paraboloid vec3 ref_vec = reflect(-eye_vec,normal); //2.0 * ndotv * normal - view; // reflect(v, n); - ref_vec=normalize((radiance_inverse_xform * vec4(ref_vec,0.0)).xyz); + ref_vec=normalize((radiance_inverse_xform * vec4(ref_vec,0.0)).xyz); vec3 radiance = textureDualParabolod(radiance_map,ref_vec,lod) * bg_energy; specular_light = radiance; diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 96311236ef..3542b8b876 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -885,7 +885,7 @@ Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_colo Vector<Color> ret; - if (p_image.is_null()) { + if (p_image.is_null() || p_image->empty()) { ret.resize(bake_texture_size * bake_texture_size); for (int i = 0; i < bake_texture_size * bake_texture_size; i++) { @@ -894,9 +894,11 @@ Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_colo return ret; } + p_image = p_image->duplicate(); if (p_image->is_compressed()) { print_line("DECOMPRESSING!!!!"); + p_image->decompress(); } p_image->convert(Image::FORMAT_RGBA8); @@ -1277,6 +1279,7 @@ void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<Multi xform.basis.scale(p_aabb.size * 0.5); p_multimesh->set_instance_transform(idx, xform); Color col = Color(p_baker->bake_cells[p_idx].albedo[0], p_baker->bake_cells[p_idx].albedo[1], p_baker->bake_cells[p_idx].albedo[2]); + //Color col = Color(p_baker->bake_cells[p_idx].emission[0], p_baker->bake_cells[p_idx].emission[1], p_baker->bake_cells[p_idx].emission[2]); p_multimesh->set_instance_color(idx, col); idx++; @@ -1464,7 +1467,7 @@ GIProbe::GIProbe() { subdiv = SUBDIV_128; dynamic_range = 4; energy = 1.0; - bias = 0.4; + bias = 1.8; propagation = 1.0; extents = Vector3(10, 10, 10); color_scan_cell_width = 4; |