Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[VR/Vive] Simple outline glow image effect in VR

Discussion in 'AR/VR (XR) Discussion' started by guto-thomas, May 6, 2017.

  1. guto-thomas

    guto-thomas

    Joined:
    Mar 12, 2012
    Posts:
    25
    Hello everyone,

    I've been struggling with this for a while.

    What I'm trying to accomplish is creating an outline glow effect, which can be done fairly easily in non-VR applications.

    My current problem is specifically when 'merging' the two images. The outline and the actual rendered image. The effect always look 'ghosty'. When a move the camera, the movement of the glow also doesn't match correctly.

    The workflow I have so far is the following:

    I've tried it with both 'Single pass stereo rendering' on and off.

    -Create a camera child of the 'eye camera' which will be responsible for rendering the objects that must glow. Render this to a texture*.
    -Apply a blur to the rendered texture and then subtract this from the original, to get the glow outline.
    -Composite the 'source' of the OnRenderImage function with the glow outline and render this directly to the destination (screen).
    -When composing, I'm using the function to adjust the UV (UnityStereoScreenSpaceUVAdjust) in both texture samples (the outline and the source). I'm also using the same uv for both. Is that correct?

    *Is a render texture rendered with 'single pass stereo' as well? That is, does the render texture contain both left and right eye renders?

    The problem seems to be specifically with the glow outline, as the VR image is output correctly, except for the glow.

    I suppose two thing may be wrong in my approach:
    -One is with regard to the render texture. See (*) above. The glow camera may be rendering just one eye.
    -I'm not sampling the texture correctly in the composition pass.

    Any hints on how I can work around this?

    I'm using Unity 5.4.3 and the last SteamVR version.

    Thank you very much.