Im trying some gls shader but it throws error

Hey guys im new to gls shaders
here is something which im trying from shader toy but it throws boolean expression error can any one guide me so that i can understand what is going on in this

If you’re new to shaders, maybe you want to give a read on , it can really help to understand this world (I hope you’re comfortable with mathematics :sweat_smile:)


that’s really helpful i will surely go through that one. Can you see the code or point me in a direction why the code is breaking…

Sorry I can’t help, this shader looks quite complicated, and I’m more than a n00b on this topic.

Fwiw, I can get it to compile by making some changes

  1. Modify the main method:
void main()
  gl_FragColor = render_aa(gl_FragCoord.xy, campos);    
  1. Delete the conditional block starting with if (traceinf.objnr==1), Lines ~314-354. Alternatively, remove the #ifdefs here, and replace nb_refr with a hardcoded 1.

  2. In the render_aa method, replace the two loop’s conditional variables aasamples with a hardcoded 1.


Regarding changes #2 and #3, the compiler believes there are syntax errors, but I’m unable to understand why. It really looks like a GLSL compiler bug related to const values, however, with GLSL there can often be more esoteric possibilities. i.e. Example 1, Example 2, etc

Regardless, even with those changes and successful compile, the result is black. Shaders of this complexity are hard to debug, and it’s generally best to try one small thing at a time and build up.

Perhaps you can link to the shader toy you are trying to replicate so others know the result you are expecting.


Wow that’s pretty cool @kaliatech , even I’m confused with the blackness, even tried with other samples which turned out to be black. This is one of the examples in shader toy which I wanted to replicate

Here is the PG
and the shader toy is Shader - Shadertoy BETA

If you open up the dev console in your browser when running your PG, you should see something like this error:

GL_INVALID_OPERATION: Uniform size does not match uniform method.

You are passing in iResolution as a vec2, but declared it as a vec3. Change your declaration to this:

uniform vec2      iResolution;

… and you will see that it almost starts working:

If you rotate around, you will see some of the facets are starting to render. It looks like the projection is off to me, but that would take more research.

Fwiw, although at this point I think you probably only need to figure out the projection, I’ve found this sometimes helpful (and depressing) when trying to port ShaderToys:

1 Like

Hello @sai_chaitanya just checking in, was your question answered?