Improve light probe

This commit is contained in:
luboslenco 2019-01-15 20:49:03 +01:00
parent f34430e02a
commit ecfa16fa97
2 changed files with 13 additions and 3 deletions

View file

@ -45,7 +45,10 @@ void main() {
n = normalize(n);
vec3 v = wp - eye;
vec3 r = reflect(v, n);
#ifdef HLSL
r.y = -r.y;
#endif
float intensity = clamp((1.0 - roughness) * dot(wp - probep, n), 0.0, 1.0);
fragColor.rgb = texture(probeTex, reflect(v, n)).rgb * intensity;
fragColor.rgb = texture(probeTex, r).rgb * intensity;
}

View file

@ -35,6 +35,7 @@ class Inc {
static var pointIndex = 0;
static var spotIndex = 0;
static var lastFrame = -1;
public static function init(_path:RenderPath) {
path = _path;
@ -110,7 +111,13 @@ class Inc {
public static function drawShadowMap() {
#if (rp_shadowmap)
#if rp_probes
// Share shadow map with probe
if (lastFrame == RenderPath.active.frame) return;
lastFrame = RenderPath.active.frame;
#end
pointIndex = 0;
spotIndex = 0;
for (l in iron.Scene.active.lights) {