Follow

idly thinking about what a modern rendering api might look like for python.

you could do some cool things with the ast module to basically define shaders in python and then cross compile.

the rest of it would be a command queue thing written as a c module, and a nice data driven rendering api for setting up a compositing graph.

and some useful boilerplate like 3d model importing etc.

@aeva also if shaders were valid python, then one could simulate a frame with a cpu renderer, and be able to do things like debug with breakpoints

This is sort of a permutation of a more ambitious version of the project wherein you'd have a similar API, but you'd be writing a scheme program that generates C code that implements the described rendering API.

The worth of the scheme one would have been being able to generate language bindings for every imaginable high level language and also be easy to embed into most existing projects.

Downside of the scheme one is that I worry I'll never finish writing it...

I think after work I'll have a look at what the state of real-time 3d is in the python ecosystem these days.

If the niche isn't already well served, this might be a better permutation of the project to start with...?

@aeva yea. How come shader has to be written in C? Why not python?

@JodiTheTigger you have it wrong, shaders would be written in python.

the c bits would just be graphics api boilerplate that need to be outside of python to be fast, tucked away behind a nice python api

@aeva nono. That's what I meant. Shader code not in a c based Lang would be wonderful.

@JodiTheTigger oh! there is no reason that requires C style syntax for shader languages, I think they just tend to because C++ is popular with games people.

Shaders are generally statically typed and compiled because that is fastest, but even that is not a set in stone requirement.

@JodiTheTigger @aeva what i have in mind is just borrowing python's syntax parser and ast, and doing some fancy type inference stuff to compile down to whatever the api needs (glsl, spirv, etc). So, won't be the full language by any stretch of the imagination, but it'll be a lot nicer than writing glsl etc.

Sign in to participate in the conversation
Toot.Cat

On the internet, everyone knows you're a cat — and that's totally okay.