cancel
Showing results for 
Search instead for 
Did you mean: 

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

wangxiaogangan
Explorer
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. 

 [dllImport"mylib"]
static extern void ModifyMyShader(int shaderId)

// get shader id though api in unity 
void func()
{
uint shaderId = createOverlayProgram(string vertexShader, string fragShader);// not unity shader,  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)
{
GL_CHECK(glUseProgram(id));

texY = GL_CHECK(glGetUniformLocation(id, "TextureY"));
if (texY != -1)
GL_CHECK(glUniform1i(texY, 0));
}

2 REPLIES 2

ForwardXP_Jim
Explorer
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.

whatisor
Explorer
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)?