Quantcast
Channel: Questions in topic: "shader programming"
Viewing all articles
Browse latest Browse all 169

Surface Shader w/ Modified Vertex Shader

$
0
0
Hello, I have been working on some new vertex compression techniques for mobile devices, and I wanted to see if there was a way that I could make my new vertex format compatible with the existing vertex data needed for surface shaders
Looking at compiled surface shaders, I know that for their vertex shader side, they take in an appdata_full struct, which gets passed into your custom vertex shader function. So currently it looks sorta like:
vert_surf(appdata_full v) { ... appdata_full result = vert(v) //Do the rest with result... }
What I'm looking for is if anyone knew a way that you could make it so that you could define a custom vertex format that ends up returning the same data as appdata_full, but accepts a different format as it's input. This way you can take advantage of Unity's robust existing surface shader infrastructure, while providing the flexibility of increasing/decreasing the amount of memory needed per vertex. That would look like:
vert_surf(custom_appdata) { ... appdata_full result = vert(custom_appdata) //Do the rest... }
I'm also open to any other suggestions of ways to do this! I really just want to be able to decompress these vertices in some sort of vertex shader, and then take advantage of the rest of the existing Unity shading pipline (whether it's sufrace shaders or the standard vertex/fragment shader)
Thanks in advance!

Viewing all articles
Browse latest Browse all 169

Trending Articles