-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Added shapes, uv_grid, uv_rotate, fresnel, and fresnel_glow functions #12
Conversation
float angle = atan(uv.x, uv.y); | ||
float radius = 6.28318530718 / float(sides); | ||
float dist = cos(floor(0.5 + angle / radius) * radius - angle) * length(uv); | ||
float poly = step(width, dist); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also just leave the poly as a float
output same as the other shape functions since they are just SDFs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, change to
float polygon
and return
return step(width, dist);
Is that what you're saying?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, instead just return the poly
or other named shape variables before you put them in a vec4
after that
Added shapes as well Added pi times 2 incase PI is not accessible Added uv_grid Changed circle shader function to something more performant Changed arguments to be more consistent like other shape functions Added uv_rotate Moved grid to shapes Modified shape functions to return floats and moved grid to uv as uv_grid_tiler given it cannot return a float and more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great! thx :D
float angle = atan(uv.x, uv.y); | ||
float radius = 6.28318530718 / float(sides); | ||
float dist = cos(floor(0.5 + angle / radius) * radius - angle) * length(uv); | ||
float poly = step(width, dist); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, instead just return the poly
or other named shape variables before you put them in a vec4
after that
Merged! Thanks for this PR :D |
Shapes
polygon
circle
square
square_stroke
square_rounded
swirl
line
UV
uv_grid_tiler
uv_rotate
Utility
fresnel
fresnel_glow