Numbers do not show anything special yet. u is the uv, and x is the value previously saved. In the first argument 6.28 * u * x, 6.28 is an approximation of \(2 \pi\). 015 will result in r = 1, iResolution.x = 9.6, iResolution.y = 5.4. iResolution is 640x360 on my computer monitor’s shadertoy window, so multiplying it by r and. The elements of x in the first part are fixed values except r. 015, // Number of potential drops (in a grid) p = 6. Line 8 in Rain drops on screen is as follows. Because it uses only one-fourth the size of the random texture, it has a similar effect to that of the 64圆4 random texture. If we want to see a similar effect to the referenced code, we can uncomment line 7. The code we referenced used a 64圆4 random texture, and we used a 256x256 random texture. This is due to the difference in random texture used. The result of the text looks a bit smoother than the result of the code referenced above. Using the r channel and the g channel in the texture1 random value, we change the uv value of texture0 to create a distorted effect. texture0 used the landscape texture used above, and texture1 used a random texture. The above code was created by referring to “Simple Texture Distort” by mikiex. Gl_FragColor = texture2D(texture0, uv + distorter) The original codealso uses textureLod which gives you direct access to the LOD, but in the OpenGL ES 2.0 specification, textureLod is only available in the vertex shader( related link), we will not use textureLod here because this code is only used to blur the background image.Īs mentioned earlier, you can also receive random textures as input. If there is no change to 0.0, and you uncomment line 9, 1.5 will be applied as bias and you will see that the image is blurred. This is the value added to the mipmap level when calculating the texture’s LOD. Texture2D can also contain the third argument bias. But how do we use tiling techniques to fill the rest of the area? We can easily solve this problem by multipling the value we want to repeat for uv, then using fract, which removes the integer part from the real number. If you uncomment line 7, we can see that the image is displayed in a narrow area. uv range changed from 0.0 ~ 1.0 to 0.0 ~ 0.5, so the bottom left texture is displayed only. If you uncomment line 6, the image will be enlarged. The second argument, uv, fixes the pixels in the entire screen in the range of 0.0 to 1.0, so the screen will be completely filled with textures. In texture2D, the first argument is the texture to display, and the second argument is the texture’s coordinates. gl_FragColor = texture2D(texture0, uv, 1.5) gl_FragColor = texture2D(texture0, fract(uv * 2.0)) gl_FragColor = texture2D(texture0, uv * 2.0) gl_FragColor = texture2D(texture0, uv * 0.5) Vec2 uv = gl_FragCoord.xy / resolution.xy
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |