-
I'm looking for a way to compile a curv file and export it as a glsl shader, maybe also a companion descriptor file for the parametrics, so I can render it in another app. @doug-moen if this doesn't exist can you point me to the code path? Maybe I can help implement it. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Your starting point is to export a *.gpu file, like this:
This feature is not designed for your exact use case, because a |
Beta Was this translation helpful? Give feedback.
-
The function that writes the shape compiler output as a
In that same source file, there is also a function called The code for exporting a
So my first idea is that you could add the ability to export a |
Beta Was this translation helpful? Give feedback.
-
I've got more ideas, but you should describe the requirements for your application in more detail before I respond. |
Beta Was this translation helpful? Give feedback.
-
Thanks. I want to say something about long term support. This willl work in the current release (0.4) and the next release (0.5). However, in some future release, I hope to add support for images, voxel grids and triangle meshes, as Curv values. These can be imported from a file or constructed by a Curv program. At that point, the Also, Curv will be rewritten from an OpenGL app to a WebGPU app (there is native support for WebGPU on Linux, Windows, MacOS, Android, iOS). Hopefully that happens this year; we'll see. The MacOS/iOS version of WebGPU uses Metal as the back end. WebGPU accepts SPIR-V or WGSL input for shaders, and compiles to MSL. My current thought is to continue generating GLSL, as I currently do, then convert to SPIR-V using a library, and then that is transpiled to MSL by the WebGPU library. (Apple will remove OpenGL support at some point, so I can't rely on it existing in the future.) At this point, the GPU programming model will also change. Shapes may no longer be exclusively encoded as fragment shaders. You may not care about any of this, but if you want to update your app to the latest version of Curv a year or two from now, there will be significant changes of a sort that I haven't fully planned out. |
Beta Was this translation helpful? Give feedback.
The function that writes the shape compiler output as a
*.gpu
file is located atIn that same source file, there is also a function called
write_json()
, which isn't currently being used. That might be a solution to your problem, since whatever programming language your app is written in, you will have a JSON parser library available.The code for exporting a
*.gpu
file, which callsViewed_Shape::write_curv()
, is located inSo my first idea is that you could add the ability to export a
*.jcpu
file containing JSON code.