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

Adding the new createShader example #6134 #1364

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

thantr
Copy link

@thantr thantr commented May 24, 2023

for issue #6134

Changes:
Added the new createshader/Julia set example to the EN, ES, zh-Hans folders

Copy link
Contributor

@davepagurek davepagurek left a comment

Choose a reason for hiding this comment

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

Thanks for making this! I just left some minor formatting comments, otherwise this is a cool example!

Just to double-check, @limzykenneth are these files all we need to add to the examples page?

`;


let canvas;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think from here to line 110 everything is indented an extra time, do you mind de-indenting this part?


let screenSize;
let samples;
let targetC;
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be good adding a comment on targetC and currentC explaining what they'll be used for (how they relate to the c we pass into the shader, and probably the fact that it's two components because it's a complex number)

// Check to see how many iterations it takes for Z to be greater than the value 3 and setting it a colour accordingly,
for (int i = 0; i < iter_cap; ++i) {
if (dot(z, z) > 3.0) {
// If the series escapes, we calculatae 'value based on the iteration number of iterations it took that value to escape
Copy link
Contributor

Choose a reason for hiding this comment

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

tiny changes here: calculate has a typo, and did you want to say 'value' in quotes here to match line 64?

// Define the screen size as a 2D vector
vec2 screenSize = vec2(710.0, 400.0);
// Get normalized screen space coordinates for the current pixel,
vec2 normd_pixel = (gl_FragCoord.xy/screenSize - 0.5) * 2.0;
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like it's visually a bit off center, maybe we could tweak a bit more to center this a bit?

image

@limzykenneth
Copy link
Member

hi and ko will both need a copy of the example as well (they are not documented in the contributor docs as that is a bit outdated).

// Uniforms are data that is the same for all pixels processed by the shader.
uniform vec2 c; // Complex number for fractal calculation
uniform vec2 screenSize; // Dimensions of the screen
uniform float hue; // Color hue
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this goes unused, maybe we can take it out or make use of it?

@Qianqianye
Copy link
Contributor

Thanks @thantr for working on it. We'd like to follow up on this PR. Please let us know if you need any support responding to @davepagurek's comments. Thank you.

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

Successfully merging this pull request may close these issues.

None yet

4 participants