I've managed to stumble my way through to a working (debug) prototype of a Ptex Shader. It "works" but I've been developing it with a very specific purpose in mind: converting the Moana dataset Ptex files to UDIMs. As a result, and due in large part to my inexperience with C++ and the SDK, this prototype is missing pretty much all of the features it would require to be a production ready shader I'm not doing proper error checking and it's quite possible I've written a memory leak or two in here
Most telling: the plug-in is crashing when I switch the build to release. Debug is working, but I am unfortunately clueless when it comes to debugging
This Ptex shader doesn't work under several conditions that would need to be addressed if I were working on this for other people to use in production:
- Doesn't work if the mesh has been subdivided (no correction for the change to polygon indices and coordinates)
- Similarly doesn't work as an input for sub-polygon displacement
- Only reads .ptex files whose filenames match objects that the shader is being evaluated on
- Only works on Windows
- Only works with a Debug build
- Not designed as a general purpose shader, specifically built to work with the Moana dataset
With all of those caveats out of the way, I've uploaded the source to Google Drive in the hopes that folks will point out the idiotic things I've done so that I can improve and also so that someone more capable might pick this up and carry it through to a real shader
P.S. For anyone working on Windows that doesn't yet know: I highly recommend picking up vcpkg. If I'd had to build Ptex from scratch I don't think I'd even have gotten this far.