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

ISF shader issue: Preview Failed for this shader #366

Closed
aphexcx opened this issue Apr 28, 2021 · 0 comments · Fixed by #370
Closed

ISF shader issue: Preview Failed for this shader #366

aphexcx opened this issue Apr 28, 2021 · 0 comments · Fixed by #370

Comments

@aphexcx
Copy link
Collaborator

aphexcx commented Apr 28, 2021

Log output:

GlslError(message='glow' : undeclared identifier, row=86, fileId=0)
GlslError(message='rate' : undeclared identifier, row=87, fileId=0)
GlslError(message='TIME' : undeclared identifier, row=87, fileId=0)
GlslError(message='intensity' : undeclared identifier, row=104, fileId=0)
GlslError(message='trace' : undeclared identifier, row=108, fileId=0)
GlslError(message='zoom' : undeclared identifier, row=118, fileId=0)
GlslError(message='runtime' : undeclared identifier, row=119, fileId=0)
GlslError(message='offset' : undeclared identifier, row=123, fileId=0)
GlslError(message='offset' : undeclared identifier, row=124, fileId=0)

Code:

/*{
  "CREDIT": "by mojovideotech",
  "CATEGORIES": [
  	"generator",
  	"circuits",
    "2d",
    "fractal",
    "Kaliset"
  ],
  "ISFVSN" : "2",
  "DESCRIPTION": "",
  "INPUTS": [
	{
		"NAME" : 	"zoom",
		"TYPE" : 	"float",
		"DEFAULT" :	1.5,
		"MIN" : 	0.5,
		"MAX" : 	3.0
	},
	{
		"NAME" : 	"offset",
		"TYPE" : 	"float",
		"DEFAULT" :	0.05,
		"MIN" : 	0.01,
		"MAX" : 	0.1
	},
	{
		"NAME" : 	"glow",
		"TYPE" : 	"float",
		"DEFAULT" :	3.0,
		"MIN" : 	0.0,
		"MAX" : 	9.0
	},
	{
		"NAME" : 	"intensity",
		"TYPE" : 	"float",
		"DEFAULT" : 0.00125,
		"MIN" : 	0.0005,
		"MAX" : 	0.0025
	},
	{
		"NAME" : 	"trace",
		"TYPE" : 	"float",
		"DEFAULT" : 40.0,
		"MIN" : 	10.0,
		"MAX" : 	100.0
	},
	{
		"NAME" : 	"runtime",
		"TYPE" : 	"float",
		"DEFAULT" : 24.0,
		"MIN" : 	6.0,
		"MAX" : 	60.0
	},
	{
		"NAME" : 	"rate",
		"TYPE" : 	"float",
		"DEFAULT" : 0.5,
		"MIN" : 	-2.0,
		"MAX" : 	2.0
	}
  ]
}
*/

////////////////////////////////////////////////////////////
// UltimateKaliCircuits  by mojovideotech
//
// based on :
// shadertoy/XlX3Rj  by Kali
//
// Creative Commons Attribution-NonCommercial-ShareAlike 3.0
////////////////////////////////////////////////////////////



#define 	pisq  	9.869604401089359	// pi squared, pi^2
#define 	twpi  	6.283185307179586  	// two pi, 2*pi
#define 	phicu  	4.236067977499791 	// phi cubed, phi^3
#define 	cuphi  	1.173984996705329   // cube root of phi
#define 	rctwpi  0.159154943091895	// reciprocal of twpi, 1/twpi      
#define		r36		0.027777777777778

vec2 center = vec2(0.,0.);
vec3 color = vec3(0.0,0.5,0.0);
float S = glow;
float T = rate*TIME*0.005;

vec2 hash22(vec2 p) { return fract(vec2(21.0, 97.0)*sin(dot(p, vec2(92.0, 61.0)))); }

void formula(vec2 z, float f) 
{
	float m = 0.0; 
	float o, ot2, ot=ot2=10000.0;
	for (int i=0; i<9; i++) {
		z = abs(z)/clamp(dot(z,z), 0.1, 0.5)-f;
		float l = length(z);
		o = min(max(abs(min(z.x, z.y)),-l+0.25), abs(l-0.25));
		ot = min(ot, o);
		ot2 = min(l*0.1, ot2);
		m = max(m, float(i)*(1.0-abs(sign(ot-o))));
	}
	m += 1.0;
	float w = intensity*m*2.0;
	float circ = pow(max(0.0,w-ot2)/w,6.0);
	S += max(pow(max(0.0,w-ot)/w,0.25),circ);
	vec3 col = vec3(hash22(z),f);
    color += col*(0.4+mod(m/9.0-T*trace+ot2*2.0, 1.0)*1.6);
	color += vec3(1.0, 0.7, 0.3)*circ*(10.0-m)*3.0
			 *smoothstep(0.0, 0.5, vec3(f, isf_FragNormCoord));
}

void main()
{
	vec2 pos = 2.0 * gl_FragCoord.xy - RENDERSIZE.xy;
	pos /= max(RENDERSIZE.x,RENDERSIZE.y);
	vec2 uv = pos-center;
	uv *= 4.0-zoom;
	float a = T + mod(T, floor(runtime))*cuphi;
	float b = a*phicu;
	uv *= mat2(cos(b),sin(b),-sin(b),cos(b));
	uv += vec2(sin(a),cos(a*cuphi))*pisq;
	uv *= offset;
	float pix = cuphi/RENDERSIZE.x*offset;
	float c = 1.5+mod(floor(T), 16.0)*0.125;
	for (int aa=0; aa<36; aa++) {
		vec2 aauv = floor(vec2(float(aa)*rctwpi, mod(float(aa), twpi)));
		formula(uv+aauv*pix, c);
	}
	S *= r36, color *= r36;
	vec3 colo = mix(vec3(0.025), color, S)*(1.5-length(pos)); 	
	colo *= vec3(1.2, 1.1, 1.0);
	gl_FragColor = vec4(colo, 1.0);
}


xian added a commit that referenced this issue Apr 30, 2021
xian added a commit that referenced this issue May 1, 2021
xian added a commit that referenced this issue May 1, 2021
xian added a commit that referenced this issue May 1, 2021
* Well-known uniform names used in the assignment expression of a uniform global should be recognized as input ports.
* Non-const expressions in global var assignments aren't supported in all versions of GLSL, so defer their initialization.
@xian xian moved this to Done in sparklemotion Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant