Exhaustive list of all the built-it variables avaiable in Jitter shaders
Hey everyone,
In the spirit of this topic, I decided to list the built-in variables that Jitter and GLSL have to offer.
These are the variables I know:
VERTEX SHADER:
gl_Position - (vec4) the clip-space output position of the current vertex
gl_VertexID - (int) the index of the vertex currently being processed
gl_InstanceID - (int) the index of the current instance when doing instanced rendering. The instance count always starts at 0
gl_PointSize - (float) the pixel width/height of the point being rasterized. It only has a meaning when rendering point primitives
GEOMETRY SHADER:
gl_PrimitiveIDIn - (int) the current input primitive's ID, based on the number of primitives processed by the geometry shader since the current drawing command started
gl_PointSize - (float) see above
FRAGMENT SHADER:
gl_FragCoord - (vec4) The location of the fragment in window space
gl_FragDepth - (float) The un-normalized distance of a fragment from the camera. By default, this variable equals gl_FragCoord.z, unless you assign a different value to it;
gl_Layer - (int) Corresponds to the @layer attribute
gl_PrimitiveID - (int) all the fragments belonging to the same primitive will be identified by the same number
gl_PointCoord - (vec2) The location within a point primitive that defines the position of the fragment relative to the side of the point. It can take values in the range [0; 1], therefore the center of the point is located at (0.5, 0.5)
I encourage you to reply with the variables I missed, and I'll edit this first post.
Thanks a lot! Hope this may be beneficial to you as much as it is to me
This is great Mateo, thank you. Any suggestions about where to start learning about shaders ? I need to understand how to adapt shaders from shadertoy to jitter, really understanding what is going on.
IMO, the best resource to start coding your own jitter shaders is Amazing Max Stuff:
https://www.youtube.com/c/AmazingMaxStuff/videos
The sahders from shadertoy don't use polygon rendering, but (usually) a technique called ray marching.
So if you want to understand what is going on with those shaders, i'd suggest to give a look to at this video series:
https://www.youtube.com/watch?v=I54IE7bNC8c
That's great, thank you.