VR Compositor Layers setup
Hello, I am following this doc. and I also check Unity StarterSample that shows example to setup 180/360 video playback. But before going to video, I wanted to try this with an Image. So I added this setup:
and now this is the RawImage with my custom shader:
now coding part:
RawImage rawImage = GameObject.Find("ImagePlayer").gameObject.GetComponent<RawImage>();
OVROverlay overlay = GameObject.Find("ImagePlayer").gameObject.GetComponent<OVROverlay>();
// OVROverlay won't check if the texture changed, so disable to clear old texture
overlay.enabled = false;
overlay.textures[0] = texture2d; //assigned from inspector window
overlay.enabled = true;
Material mat = new Material(rawImage.material);
rawImage.material = mat;
rawImage.texture = overlay.textures[0]; //I guess here the texture is already processed through ovroverlay ??is this the correct way to setup ovroverlay to process images? I tried with underlay and overlay as well but the visual difference is not too different from regular texture in my Quest 2. Perhaps my setup is wrong and the texture never goes through ovroverlay?
Your setup is mixing UI (RawImage) and OVROverlay.
OVROverlay does not render through Unity UI/shaders as it bypasses them and renders as a separate compositor layer.
Fix:
- Don’t use RawImage or custom shaders with OVROverlay
- Don’t assign the texture to rawImage.texture
- Assign texture only to overlay.textures[0]
- Remove/disable the RawImage component entirely
Also check:
- Set overlay.currentOverlayType = Overlay (or Underlay if needed)
- Use External Surface / Texture2D correctly (no material processing)
- Make sure the object has proper transform/quad for display
If you keep RawImage, you’re just seeing normal Unity rendering, not OVROverlay.