I wanted to understand two questions i have been feeling helpless about.
I would appreciate if you can fill these voids.
1. iFrame in shadertoy :
I understand its a shader playback frame which is a uniform int data type.
So essentially in a use case we write :
if(iFrame < 5)
I want to understand how do we make sense of this in spark AR ?
How do we get the shader playback frame in spark AR ?
TexelFetch in shadertoy : I would really appreciate if you can explain this one with an example.
What does texelFetch(iVec2(uv), 0) mean ?
How is it different from texture.sample(vec2) ?
What is the difference between iVec2 and vec2, in sparkSL how do we make iVec2 ?
“Texel” is short for texture-element or texture-pixel. Sampling a texel means that you are working on pixels as opposed to vertices. I think by default, the fragment stage works on screen pixels, but texel sampling works on pixels in the texture itself. The screen pixels could be much less than expected, based on geometry orientation and distance from the camera. I’m sort of guessing on this
In computer graphics, a texel, texture element, or texture pixel is the fundamental unit of a texture map. Textures are represented by arrays of texels representing the texture space, just as other images are represented by arrays of pixels.
Texels can also be described by image regions that are obtained through simple procedures such as thresholding. Voronoi tesselation can be used to define their spatial relationships—divisions are made at the midpoints between the centroids of each texel and...
Here’s how you can track the current frame number, purely in patches:
Then you can pass that into the SL shader. The main difference is that
int isn’t supported as an input type in Spark SL, so you need to use
Here’s a doc on ivec2 data type.
I think you can convert a float into an int by doing something like this: