-
Notifications
You must be signed in to change notification settings - Fork 10
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
Pass custom instance data to sdf shader function (to allow single-shader parametrized shapes) #3
Comments
Hey. Just letting you know, that I've had a go at doing this with const generics and it's working great for me but my implementation probably isn't ergonomic enough for general use. Basically I added a Just some notes:
|
For some shapes, for instance rectangles, circles, rounded rectangels, it makes a lot of sense to be able to send per instance data into the sdf function so you could change side length/radius without compiling a new shader.
I'm not really sure what the best way to implement this would be... One simple way could be to just have a couple of floats of "user data" that will just always be passed around. It may come with a performance cost, though.
Perhaps some way to toggle it with shader defs would be good, and then have it be an optional component
SdfParameters(Vec4)
so we don't pay the price for it when not used.The text was updated successfully, but these errors were encountered: