2 Important questions about Shaders

Hello dear friends
hope you doing well

I have 2 questions about shaders and SparkSL

  1. How can we convert iChannelResolution[0] to SparkSL?
    I mean i know we should type texture.size but there are some cases that the number inside iChannelResolution brackets is not 0 like this picture below, should we still replace it with texture.size?
    and .size should be typed like that or should we replace size with .xy?

Screenshot_1
Screenshot_2

  1. What is the difference between these 3 types of uv sampling?
    texture(iChannel0,uv) | textureLod(iChannel3,uv,0.) | (textureSize(iChannel1,0)
    we know the first one is simply can be converted like this: iChannel0.sample(uv) , but how about the other two?

Thank you so much for your help.

I think the zero in iChannelResolution[0] is just selecting one of the available channels, which you do implicitly in spark by referencing the texture you want the size of.

Spark has a sampleLod method but it only works on mipmapped textures. The camera texture is not mipmapped so you won’t see any difference if you try using this method on it.

textureSize() is how to get the size of an LOD sampled texture. I don’t know any equivalent in spark.

https://registry.khronos.org/OpenGL-Refpages/gl4/html/textureSize.xhtml

2 Likes