Skip to content

Commit

Permalink
Changed calculation for range clipping (#325)
Browse files Browse the repository at this point in the history
* changed calculation for depht

Signed-off-by: Tomas Lorente <[email protected]>

* Ian comments

Signed-off-by: Tomas Lorente <[email protected]>

* test fix

Signed-off-by: Tomas Lorente <[email protected]>

* fix test

Signed-off-by: Tomas Lorente <[email protected]>

* updated tests and migration

Signed-off-by: Tomas Lorente <[email protected]>

* tweak to migration guide

Signed-off-by: Ian Chen <[email protected]>

Co-authored-by: Ian Chen <[email protected]>
  • Loading branch information
Lobotuerk and iche033 authored Aug 3, 2021
1 parent 16014e7 commit afa2270
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ release will remove the deprecated code.
`Node::UserData` now returns no data for keys that don't exist (prior to Rendering 6.x, if
`Visual::UserData` was called with a key that doesn't exist, an `int` was returned by default).
1. **depth_camera_fs.glsl** and **depth_camera_final_fs.glsl**
+ Far clipping changed from clipping by depth to clipping by range, i.e. distance to point, so that the data generated will never exceed the specified max range of the camera.
## Ignition Rendering 4.0 to 4.1
## ABI break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void main()
// to be outside of min/max range

// clamp xyz
if (point.x > far - tolerance)
if (!isinf(point.x) && length(point) > far - tolerance)
{
if (isinf(max))
{
Expand Down
2 changes: 1 addition & 1 deletion ogre2/src/media/materials/programs/depth_camera_fs.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void main()
}

// clamp xyz and set rgb to background color
if (point.x > far - tolerance)
if (length(point) > far - tolerance)
{
if (isinf(max))
{
Expand Down

0 comments on commit afa2270

Please sign in to comment.