Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add renderer for hydra #94

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

Merged
PWhiddy merged 4 commits into shader-park:main from emptyflash:main
Feb 8, 2023
Merged

Add renderer for hydra #94

PWhiddy merged 4 commits into shader-park:main from emptyflash:main
Feb 8, 2023

Conversation

Copy link
Contributor

@emptyflash emptyflash commented Feb 7, 2023
edited
Loading

The biggest change here is duplicating minimalHeader and fragFooter and tweaking the GLES version (regl doesn't support 300) and tweaking things to work in that version.

Basic API example:

const {sculptToHydraRenderer} = await import("https://local.emptyfla.sh/shader-park-core.esm.js")
sculptToHydraRenderer(()=>{
 sphere(nsin(time))
}).out(o0)

Full demo: https://hydra.ojack.xyz/?sketch_id=Lovo7ySixRsokMQI

PWhiddy reacted with hooray emoji
Copy link
Member

@PWhiddy PWhiddy left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first glance everything looks good!
Hopefully the amount of code duplication between targets wasn't too annoying, we wanted to make sure that too much structure didn't make it difficult to implement new targets.

Generally we'd prefer to build the dist packages ourselves, but in this case it should be fine.

And don't mind the GA tests not passing, we need to fix those.

Thanks again!
I'll let @torinmb take a took too and then we should be good to merge.

@@ -504,7 +512,7 @@ vec4 sphericalDistribution( vec3 p, float n )

float k = max(2.0, floor( log(n * PI * sqrt(5.0) * (1.0 - cosTheta*cosTheta))/ log(PHI+1.0)));
float Fk = pow(PHI, k)/sqrt(5.0);
vec2 F = vec2( round(Fk), round(Fk * PHI) ); // k, k+1
vec2 F = vec2( floor(Fk + 0.5), floor(Fk * PHI + 0.5) ); // k, k+1
Copy link
Member

@PWhiddy PWhiddy Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this for webgl1 compatibility? We did migrate shaderpark to webgl2 a while ago.

Copy link
Contributor Author

@emptyflash emptyflash Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this was the only thing in sculptureStarterCode that I needed to change, so I chose to avoid duplicating the entire thing here.

Copy link
Member

@PWhiddy PWhiddy Feb 8, 2023
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I suspect it's possible there may be other places in the library that could have issues with webg1 besides this line. But I'm happy to merge now and just fix them later if they show up.

Copy link
Contributor Author

@emptyflash emptyflash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PWhiddy I can always undo the dist changes, figured they might be done adhoc since they're committed

@@ -504,7 +512,7 @@ vec4 sphericalDistribution( vec3 p, float n )

float k = max(2.0, floor( log(n * PI * sqrt(5.0) * (1.0 - cosTheta*cosTheta))/ log(PHI+1.0)));
float Fk = pow(PHI, k)/sqrt(5.0);
vec2 F = vec2( round(Fk), round(Fk * PHI) ); // k, k+1
vec2 F = vec2( floor(Fk + 0.5), floor(Fk * PHI + 0.5) ); // k, k+1
Copy link
Contributor Author

@emptyflash emptyflash Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this was the only thing in sculptureStarterCode that I needed to change, so I chose to avoid duplicating the entire thing here.

@PWhiddy PWhiddy merged commit c70047b into shader-park:main Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@PWhiddy PWhiddy PWhiddy approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /