Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple function outputs. #157

Open
LukeP0WERS opened this issue Aug 5, 2024 · 1 comment
Open

Multiple function outputs. #157

LukeP0WERS opened this issue Aug 5, 2024 · 1 comment

Comments

@LukeP0WERS
Copy link

Currently my game engine requires multiple function outputs to correctly apply and blend between different materials. So far I have just done this my creating multiple functions for each output, and duplicating a bunch of code so that they all work together. While I don't understand fidgets internals, it makes sense intuitively to me that there could be multiple outputs for functions. This would reduce code duplication and also probably make things faster since there could be shared simplifications. On the other hand, you don't usually want all of the outputs to be calculated with the same inputs or the same number of times (I evaluate the distance function 216x more than the material id and blending functions), so you should be able to choose which outputs you want to actually evaluate code for...

I have no idea how you would go about implementing this, but you seem to be some sort of programming wizard capable of writing functions that optimize themselves at runtime so I wouldn't be surprised if you found a way. Anyhow I wouldn't prioritize it too much since I'm already emulating multiple function outputs without too much difficulty (and the speed improvements might even be negligible in my use case)

@mkeeter
Copy link
Owner

mkeeter commented Aug 30, 2024

Take a look at #163 - it changes the trait Function to support arbitrary numbers of outputs.

(Shape remains a single-output abstraction on top of Function, since it's meant for SDFs specifically)

On the other hand, you don't usually want all of the outputs to be calculated with the same inputs or the same number of times (I evaluate the distance function 216x more than the material id and blending functions), so you should be able to choose which outputs you want to actually evaluate code for...

I have to think more about whether this makes sense; right now, there's no way to select which outputs are evaluated, since they're all baked into the math graph together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants