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
- MotionVector Effect: Object “disappears” when paused
- [GreaseMonkey] Unity Forum Fixer
- UnityHub: Make Hub application background Translucent
- Customize SpriteShapeRenderer quality (but has issues)
- Editor tool: Copy selected gameobject’s names into clipboard as rows (for Excel)
- Editor tool: Replace string in selected gameobject’s names
- UnityHub: Enable built-in Login Dialog (no more browser login/logout issues!)
- Use TikTok-TTS in Unity (with WebRequest)
- Create Scene Thumbnail Image using OnSceneSaved & OnPreviewGUI
- webgl+javascript TTS
- Using Moonsharp (LUA) + Unity Webgl
- Using 3D gameobject prefabs with Unity Tilemap + NavMesh Surface
Recent Comments
- [Asset Store] Point Cloud Viewer & Tools on
- [Asset Store] Point Cloud Viewer & Tools on
- Vector3 maths for dummies! on
- UnityHub: Make Hub application background Translucent on
- UnityHub: Make Hub application background Translucent on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- Install Android SDK+JDK+NDK for Unity (without AndroidStudio or Unity Hub) on
- [Asset Store] Point Cloud Viewer & Tools on
Unity Project for the Leap Motion Virtual Reality Planetarium
https://github.com/leapmotion-examples/VR-Planetarium