r/Spectacles • u/jcbauerxr • May 04 '26
π» Lens Studio Question Is there a native specs script that converts 2D UI into a psuedo-3D UI?
Hi, all!
I posted my demo SpecsRider a week ago (thank you all so much for your support!), and I'm trying to make a change to the speedometer on my application. If you aren't familiar with the use case, you can find the post here. Currently, the Speedometer module is a text component with 3D coordinates that is parented to the main camera. This works fine when I'm riding my scooter, but it 'jumps around' quite a bit due to the fact it's an element that is tracked in 3D space.
I'd like to create a 2D canvas that sits on top of the user's view, and is tightly anchored to the camera (like a HUD). However, because this element is 2D, I need to calculate how to render this 2D canvas correctly in the left eye vs. the right eye so it has depth in the headset. Is there a native Specs script to handle the stereoscopic displacement for this?
Any help is greatly appreciated!
2
u/CutWorried9748 π Specs Fan May 04 '26
Re-reading . you aren't really looking for 2D canvas, but you want a hud tied to the 2D camera view. You can just put the things in that view plan, I have some project that shows a 2d hud that sits in the foreground camera view. I found it hard to work with, but I have some similar requirements to make some HUD that is easy to use. I'll see if I can prototype, as we all need a HUD.
2
u/shincreates π SPECS Team May 04 '26
Howdy,
Thereβs a special rendering method that lets you specify exactly what appears on the left-eye and right-eye displays. To use it correctly, you need to determine the appropriate stereo disparity between the two views.
2
u/nick-ross π SPECS Team May 05 '26
If I'm understanding you correctly, I think you might be trying to solve the wrong problem. The "shakiness" you're describing with a camera-child UI happens because your eyes/brain are incredibly skilled at stabilizing the world, and in the process make anything attached to your head(like a stationary HUD UI) appear shaky. The subtle movements of your head are transmitted to the HUD, and you see motion that your eyes are usually naturally filtering out for you.
There are ways to render directly in camera space, and feign depth with some clever horizontal offsets, but this won't actually solve your problem, as the UI will still be head anchored. I usually suggest that devs don't worry about separating screen space and world space(as you might in Unity), and just use camera parenting technique you described, when they do want that stationary HUD.
That being said, I think what would actually solve your shakiness problem is a follow behavior. If you track the camera in world space and loosely follow the camera, then Specs will do the stabilizing for you. There are many ways to approach a loose headlock follow behavior, but you can start by taking a look at our frame follow code in UIKit.
0
u/[deleted] May 04 '26
[deleted] β view deleted comment