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

Added shapes, uv_grid, uv_rotate, fresnel, and fresnel_glow functions #12

Merged
merged 1 commit into from
Mar 10, 2023

Conversation

Mikeysax
Copy link
Contributor

@Mikeysax Mikeysax commented Mar 10, 2023

Shapes

  • polygon
  • circle
  • square
  • square_stroke
  • square_rounded
  • swirl
  • line

UV

  • uv_grid_tiler
  • uv_rotate

Utility

  • fresnel
  • fresnel_glow

@Mikeysax Mikeysax changed the title Added fresnel and fresnel_glow functions Added shapes, fresnel, and fresnel_glow functions Mar 10, 2023
@Mikeysax Mikeysax changed the title Added shapes, fresnel, and fresnel_glow functions Added shapes, uv_grid, fresnel, and fresnel_glow functions Mar 10, 2023
@Mikeysax Mikeysax changed the title Added shapes, uv_grid, fresnel, and fresnel_glow functions Added shapes, uv_grid, uv_rotate, fresnel, and fresnel_glow functions Mar 10, 2023
README.md Outdated Show resolved Hide resolved
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);
Copy link
Owner

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

Copy link
Contributor Author

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?

Copy link
Owner

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

@paddy-exe paddy-exe added ⭐ enhancement New feature or request 📚 documentation Improvements or additions to documentation labels Mar 10, 2023
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
Copy link
Owner

@paddy-exe paddy-exe left a 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);
Copy link
Owner

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

@paddy-exe paddy-exe merged commit bf0732d into paddy-exe:main Mar 10, 2023
@paddy-exe
Copy link
Owner

paddy-exe commented Mar 10, 2023

Merged! Thanks for this PR :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📚 documentation Improvements or additions to documentation ⭐ enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants