GI probes working back again

This commit is contained in:
Juan Linietsky 2017-06-01 22:38:07 -03:00
parent c03131fc9f
commit e79d7149ea
2 changed files with 9 additions and 6 deletions

View file

@ -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;

View file

@ -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;