Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

feature request for overlay layer:expose native shader of overlay mesh in android plantform

wangxiaoganganwangxiaogangan Posts: 21
Brain Burst
edited September 2019 in Unity Development
First of all, I truly appreciate Oculus's overlay layer tech for media player developers, which make video looks sharper & less judder.
My team has been contributing to develop "view-based media player", the main method uses 24 quadrilateras to combine mesh into what just right cover camera's view. it works well while 24 quads rendered by unity mesh & shader, but we want to introduce this method into overlay, letting overlay renders the 24 quad. 

I check the newest sdk v1.40, the overlay layer tech could coustom their mesh through vertexs & uv & triangle index by OVROverlayMeshGenerator, but there is no way to custom overlay's mesh shader though sdk v1.40. As for as i know, there should be program id created by gles though glCreateShader, which use for overlay mesh shadering.

so, could oculus staff update unity's sdk in future to support changing overlay's mesh shader? Somehitng like i can pass gles style shader into api and got the shader id, so i can modify params by native .so libary and render something very flexibly. 

<div>&nbsp;[dllImport"mylib"]<br></div><div>static extern void ModifyMyShader(int shaderId)

// get shader id though api in unity&nbsp;
void func()</div><div>{
      uint shaderId = createOverlayProgram(string vertexShader, string fragShader);// not unity shader,&nbsp; we use gles native shade here
            // pass it into native libary which share opengl context, so we can modify it
           ModifyMyShader(shaderid)
}

// modify shader though shader id in c++
void func_native(int id)</div><div>{
           GL_CHECK(glUseProgram(id));</div><div>
      texY = GL_CHECK(glGetUniformLocation(id, "TextureY"));
           if (texY != -1)
              GL_CHECK(glUniform1i(texY, 0));
}</div>

Comments

  • ForwardXP_JimForwardXP_Jim Posts: 5
    NerveGear
    You can't change the shader that draws the overlay because the overlay curvature is generated in the overlay's fragment shader and you'd have to include it the new shader.  It doesn't seem like this is something Oculus is interested in exposing.

    You CAN however draw to a render texture using your shader and then have the overlay draw the render texture.  That is how I use the overlay to render our hud while still using Unity UI elements for the hud.
  • whatisorwhatisor Posts: 5
    NerveGear
    That is a pity !.
    We use Overlay to get the best performance.
    If we have to render one more time into Render Texture, it is wasteful.
    Can @OculusSupport reconsider this feature(Expose custom fragment shaders for Overlay)?
Sign In or Register to comment.