Skip to content

Commit

Permalink
handle no depth case during depth buffer unpacking
Browse files Browse the repository at this point in the history
  • Loading branch information
msavva committed Mar 26, 2018
1 parent bcf890a commit fafbdc5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions client/js/lib/sim/sensors/DepthSensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,12 @@ DepthSensor.prototype.__getFrame = function(scene) {
}
}

// Convert and negate
var v = - perspectiveDepthToViewZ(camera.near, camera.far, pd);
v = scaleFactor * v;
var v = 0;
if (pd != 0) { // Convert from packed depth buffer value pd to real depth v
v = - perspectiveDepthToViewZ(camera.near, camera.far, pd);
v = scaleFactor * v;
}

d[i] = v;
sum += d[i];
if (!transparent) {
Expand Down

0 comments on commit fafbdc5

Please sign in to comment.