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

Incorrect yellow warning mark on shaders #479

Open
bencbartlett opened this issue Aug 16, 2022 · 0 comments
Open

Incorrect yellow warning mark on shaders #479

bencbartlett opened this issue Aug 16, 2022 · 0 comments

Comments

@bencbartlett
Copy link
Collaborator

When you add a shader that imports a uniform, you can get an incorrect warning mark. The only way to remove this mark seems to be to change the uniform source to main stream and then to change it back.

Working example:

  1. Add new paint shader
  2. Copy code below
  3. Click apply changes
  4. Observe the yellow exclamation mark
  5. Edit the shader
  6. Under "ports" change the source for time to main stream. Click apply, then change it back and click apply again.
  7. The yellow exclamation mark disappears.
// Cool zebra pattern looking thing that alternates polarity on the beat
// Ben

uniform float time; // @@Time
uniform float speed; // @@Slider min=0.0 max=10.0 default=5.0

struct BeatInfo {
	float beat;
	float bpm;
	float intensity;
	float confidence;
};
uniform BeatInfo beatInfo; // @@baaahs.BeatLink:BeatInfo

// @return color
// @param uv uv-coordinate
vec4 main(vec2 uv) {
	float t = time * .01 * speed / 5.0;
	vec2 center = vec2(0.,0.);

	float periods = 4.1;
	center.y+=sin(uv.y*periods + t * 51.);
	center.x+=cos(uv.x*periods + t);

	float slantyness = 5.0;
	center.y+=sin(slantyness*(uv.x + uv.y));
	center.x+=sin(slantyness*(uv.x + uv.y));

	float d = distance(uv,center);
	float kFreq = 2.5;

	float k = -sin(d*6.283*kFreq - t);
	int beat = int(beatInfo.beat);
	if (beat % 2 == 0) {
		k *= -1.;
	}

	float e = smoothstep(0., fwidth(k)*1.5, k);
	return vec4(sqrt(max(e, 0.)));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant