- Home /
Texture lookup in Surface Shader in pixel space
Hi all!
I'm writing a rendering plugin for a physics engine and I wanted to leverage Unity rendering capabilities. I managed to update mesh vertices in native code plugin by writing into a texture and then drawing the updated mesh in a custom shader. For doing so, I needed to access the texture in pixel space using the vertex ID of the current vertex being considered in the Vertex Shader. So, I ended up writing it in GLSL, using gl_VertexID for retrieving the index of the current vertex, and texelFetch for the texture lookup in pixel space. The problem is that in GLSL I need to write the Fragment Shader by myself as well, and that would make no sense since I wanted Unity to deal with the lighting. So, is there a way I could achieve this through Surface Shaders? I hope all of the above makes sense and if it doesn't please feel free to correct me :)
Thanks in advance!