Probe fixes

This commit is contained in:
luboslenco 2018-12-21 11:37:10 +01:00
parent eca85d6817
commit a7d14cb444
5 changed files with 12 additions and 4 deletions

View file

@ -4,9 +4,9 @@
#include "std/gbuffer.glsl"
uniform samplerCube probeTex;
uniform sampler2D gbufferD;
uniform sampler2D gbuffer0;
uniform sampler2D gbuffer1;
uniform sampler2D gbufferD;
uniform mat4 invVP;
uniform vec3 probep;
uniform vec3 eye;

View file

@ -39,6 +39,9 @@ void main() {
vec3 wp = getPos2(invVP, depth, texCoord);
vec4 pp = probeVP * vec4(wp.xyz, 1.0);
vec2 tc = (pp.xy / pp.w) * 0.5 + 0.5;
#ifdef HLSL
tc.y = 1.0 - tc.y;
#endif
vec2 enc = g0.rg;
vec3 n;

View file

@ -172,7 +172,7 @@ class Inc {
// Resize shadow map
var l = path.light;
if (l.data.raw.type == "sun" && l.data.raw.shadowmap_size != config.rp_shadowmap_cascade) {
l.data.raw.shadowmap_size = config.rp_shadowmap;
l.data.raw.shadowmap_size = config.rp_shadowmap_cascade;
var rt = path.renderTargets.get("shadowMap");
if (rt != null) {
rt.unload();
@ -180,7 +180,8 @@ class Inc {
}
}
else if (l.data.raw.shadowmap_size != config.rp_shadowmap_cube) {
rt = path.renderTargets.get("shadowMapCube");
l.data.raw.shadowmap_size = config.rp_shadowmap_cube;
var rt = path.renderTargets.get("shadowMapCube");
if (rt != null) {
rt.unload();
path.renderTargets.remove("shadowMapCube");

View file

@ -675,7 +675,6 @@ class RenderPathDeferred {
path.drawShader("shader_datas/deferred_light/deferred_light_VoxelAOvar") :
path.drawShader("shader_datas/deferred_light/deferred_light");
#end
path.setDepthFrom("tex", "gbuffer0"); // Re-bind depth
#if rp_probes
if (!path.isProbe) {
@ -685,6 +684,7 @@ class RenderPathDeferred {
if (!p.visible || p.culled) continue;
path.currentProbeIndex = i;
path.setTarget("tex");
path.bindTarget("_main", "gbufferD");
path.bindTarget("gbuffer0", "gbuffer0");
path.bindTarget("gbuffer1", "gbuffer1");
path.bindTarget(p.raw.name, "probeTex");
@ -698,6 +698,8 @@ class RenderPathDeferred {
}
#end
path.setDepthFrom("tex", "gbuffer0"); // Re-bind depth
// #if rp_volumetriclight
// {
// path.setTarget("bufvola");

View file

@ -25,6 +25,8 @@ def make(context_id):
frag.main = frag.main[:frag.main.rfind('fragColor')]
frag.write('\n')
frag.add_uniform('vec3 lightColor', link='_lightColor')
frag.write('float visibility = 1.0;')
frag.write('vec4 premultipliedReflect = vec4(vec3(direct * lightColor * visibility + indirect * occlusion) * opacity, opacity);')
frag.write('float fragZ = wvpposition.z / wvpposition.w;')