It looks like you're new here. If you want to get involved, click one of these buttons!
Here I'll post simple or complex shaders for those who want to learn from them or those who want to use them. Do what you like with them. Feedback is welcome. Each shader will be accompanied with an example project that uses it.
Comments
Sky Gradient
This is a shader that produces a gradient that looks very similar to the sky and can be used for less boring backgrounds.
Difficulty: This shader may be confusing for beginners
Shader
Example Project
Rainbow Circle
This shader produces a circle with a gradient that goes from red - yellow - green - turquoise - blue - purple and is very easy to use.
Difficulty: This shader should only be slightly difficult for beginners to understand
Shader
Example Project
Green Screen
This shader can be used to create a very simple green screen that compares a given colour to each pixel in a photo, and replaces the ones that are too similar
Difficulty: This shader should be fairly easy for beginners
Shader Inputs
sens: float (number), determines the sensitivity of the green screen
texture: sampler2D (image), the main photo (normally the
CAMERA
)overTex: sampler2D (image), the photo in the background
sample: vec4 (color), the colour of the pixels that will be replaced
inactive: bool (boolean), while true, the pixels of texture are not changed
Shader
Example Project
Circular Textures
This shader takes any texture and draws only pixels that are in a circle, creating a circular texture
Difficulty: This shader is very easy to follow and is recommended for beginners
Shader inputs
texture: sampler2D (image), the texture to make circular
circleSize: float (number), the distance a pixel must be from the center before being removed
Shader
Example Project
@Kolosso, this is great!
I like that you also include working examples that are easy to "Paste into new project" - very nice touch.
Thanks, @juce!
This thread is a little old, but I just wanted to post a few more of these.
Voronoi
This shader creates a voronoi pattern that can have many uses. The example project uses a modified version of the shader to use the pattern as a displacement map, for example.
Difficulty: This shader may be more difficult for beginners.
Shader Inputs
aspect: _float (number), This is the aspect ration of the rectangle.
scale: float (number), This scales the pattern. 1.0 is one cell, so a scale of 20.0 will show 20.0 cells.
panX: float (number), This pans the pattern left or right.
panY: float (number), This pans the pattern up or down.
Shader
Example Project
3D Sky Dome (but not really a dome)
I was getting tired of the fact that Craft was the only answer for getting an easy 3D sky. That's why I made this shader. It works similarly to the Craft sky, except with one extra color input to control the gradient easier.
The shader uses raytracing to draw a 3D sky dome. (onto a 2D rectangle) The example below uses it in a 3D scene.
Difficulty: You might want to learn the basics of raytracing before trying to understand this shader.
Shader Inputs
aspect: _float (number), This is the aspect ratio of the screen
zoom: float (number), This is the fov of the camera. The lower the value, the closer the FOV gets to 180 degrees. The higher the value, the fewer degrees.
0.5
is 90 degrees of FOV.1.0
is 45 degrees of FOV. Note that this is on a logarithmic scale.lookAt: vec2 (vec2), This is the direction the camera is facing. Since the sky looks the same, no matter if you look left or right; I've only given it 2 dimensions. X is forward and Y is up. Note that this vec2 needs to be normalized.
horizon: vec4 (color), This is the color of the horizon
sky: vec4 (color), This is the color of the top of the sky
midSky: vec4 (color)_, This is the color between the top of the sky and the horizon.
ground: vec4 (color)_, This is the color of the bottom of the sky.
Shader
Example Project
@Kolosso - absolutely magic, I will learn a lot from these. One thing, error in your SkyDome where the code is trying to load a “Basic Tiles” shader and I have no file of that type. Thanks.
@Bri_G Thanks, I didn't see that. I've updated the code, so it should work now!