I am working on a VR project where we wanted to replicate that glossy background UI much like it is in the Vision Pro.
We are kind of already doing that with Cubemaps on our regular 3D meshes (or anything that renders using a Mesh Renderer). In our shaders we are using unity_SpecCube0, that seem to always give you the probe your object is in. The same doesn’t work for UI components though.
I am interested to know, if possible, how is this setup? Can we possibly make it work for Unity UI components?
PS: We use cubemaps so we can bake everything and save GPU bandwidth. For our needs (and as far as we tested), no screen space solution is viable.
unity_SpecCube0 works for MeshRenderers because Unity assigns the right probe based on the object’s position, but UI elements don’t work that way. you can use a world-space canvas, which lets your UI behave like a 3D object and actually get probe reflections. what’s left is making sure you’re aligning that worldspace canvas with the camera to simulate a “camera-space” canvas – assuming that’s what you want
I assume you’re using UI elements like RawImage which allows you to set a material
if you’re trying to get that glossy/frosted Vision Pro-style look, you might also want to blur the cubemap a bit or use a transparent shader to blend with a base color
Hello, thanks for your reply. Your assumptions are correct, we are using an Image component where we assign a material using a custom shader. All of our canvases are set to world-space.
I think I don’t understand the aligning the canvas with the camera part, could you elaborate this a bit further?
EDIT: I may have understood what you meant. The thing is I only managed to make a cubemap work on the UI shader by setting it manually. Meaning I declare a property to hold the cubemap and assign it to the shader. This of course requires me to upload these textures again to the GPU.
Sidenote: Unity conveniently generates cubemap textures mips in a special way, we could easily get that glossy effect by just blending through the mip levels.