17
2015
Leap Motion PassThrough Threshold Shader

You can add adjustable threshold to Leap Motion passthrough shader, so that your hands are more visible (less transparent) in the overlay image.
TUTORIAL
– Download unity examples package, https://developer.leapmotion.com/downloads/unity
– Import package to Unity
– Open “PassthroughWithTracking.scene”
– Select “Quad” from hierarchy
– Enable [x] Overlay image (in LeapImageRetriever script component)
– Edit shader file: “LeapIRUndistorted_foreground.shader”
Add these customisations to the shader:
// FIND LINE
_MainTex ("Base (A=Opacity)", 2D) = ""
// INSERT AFTER IT
_Threshold ("Threshold", Float) = 0.1
// FIND LINE
uniform float4 _Color;
// INSERT AFTER IT
uniform float _Threshold;
// FIND LINE
color.a *= a;
// REPLACE WITH
color = float4(a,a,a,step(_Threshold,a)) * _Color;
– Save, now test the scene and adjust threshold value from inspector if needed (try adjusting material color value also).
Notes:
– LeapImageRetriever script re-assigns the shader at start, so your inspector threshold value might resets to default..?
– Adjust material color for skincolor in the inspector
More info:
– step() : http://http.developer.nvidia.com/Cg/step.html
– Leap+Oculus : https://www.leapmotion.com/product/vr
– [x] Allow images must be enabled in Leap Control panel : https://developer.leapmotion.com/gallery/oculus-passthrough
Related Posts
1 Comment + Add Comment
Leave a comment
Recent posts
- Favorites in PackageManager
- LudumDare59 : Signal
- Unity Editor: Tree Generator
- Leaf/Foliage Generator Tools (Runs in Browser)
- Testing Unity AI Beta
- Ways to Support UnityCoder Development
- Using UI Slider to Create 5-Star Rating Element
- Game Music Library For Unity (editor plugin)
- Fontastic : Easily Test Fonts in Unity Editor!
- GeoTiff Importer & Terrain Generator for Unity
- Create Baked DropShadow for UI images
- .JP2 Ortho Image Converter to PNG/JPG/TIFF
Recent Comments
- on Mesh Exploder (sources)
- on Sprite Sheet Flip Book Shader
- on Sprite Sheet Flip Book Shader
- on [Asset Store] PolygonCollider2D Optimizer
- on Trajectory Test Scene 2.0
- on Vector3 maths for dummies!
- on UnityHub 3.6.0: Remove Version Control & Cloud Dashboard columns
- on Using RenderDoc with Unity (graphics debugger)
Coin:
CUgDSbRqFcAumDSAcdKDvuXsw26VdkJe8C8WGUQHBAGS
An article by












Unity Project for the Leap Motion Virtual Reality Planetarium
https://github.com/leapmotion-examples/VR-Planetarium