Skip to content

matinas/shadersfromscratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shadersfromscratch

Experimenting with Surface Shaders (mainly) as part of a couple of tutorials and courses. Find below the list of all the generated shaders that can be found in Assets/Shaders folder, including an image/video showing the rendered effect for each one.

  • 1. Emission Albedo: very simple shader that shades the geometry based on the albedo and emission colors given as parameter

    1. Emission Albedo
  • 2. Emission Albedo Normal: very simple shader that shades the geometry based on the albedo and emission colors passed as parameter. It also sets the geometry normals based on an additional color parameter

    1. Emission Albedo Normal
  • 3. Skybox Reflection: shades the object with a given diffuse texture plus a given cube map to set the emission based on the reflection vector for each pixel, generating a reflection effect. If the geometry is flat shaded it should behave as a perfect mirror (no interpolation of the reflection vector before sampling the cube map)

    3. Skybox Reflection
  • 4. Skybox Reflection Albedo: shades the object with a given diffuse texture plus a given cube map to set the emission based on the reflection vector for each pixel, generating a reflection effect. If the geometry is flat shaded it should behave as a perfect mirror (no interpolation of the reflection vector before sampling the cube map). In contrast with previous shader it also accepts a color to compose with the reflective one.

    4. Skybox Reflection Albedo 4. Skybox Reflection Albedo (flat)
  • 5. Full Green: takes a texture to use as the albedo colour and just turns up the green channel to full

    5. Full Green
  • 6. Green Texture: quite similar to the previous shader but composes the given texture with a green color

  • 7. Emission Albedo Texture: shades the geometry with a given albedo texture as well as an emmision texture

    7. Emission Albedo Texture
  • 8. Diffuse Normal: shades the geometry with a given albedo texture and a normal map, which bumpinness is driven by another parameter

    8. Diffuse Normal
  • 9. Diffuse Normal Intensity: shades the geometry with a given albedo texture and a normal map, which bumpinness is driven by another parameter. It also includes an additional parameter to turn the brightness over the geometry up and down

    9. Diffuse Normal Intensity
  • 11. Snow: shades the geometry with a given texture and color adding an effect so that part of the geometry gets whitened as it is snow. The direction, color and amount of the simulated snow is configurable through a couple of input parameters

    11. Snow
  • 14. Normal Scaler: shades the geometry with white color but setting the normal with the one given as input so to affect the way the light is calculated

    14. Normal Scaler
  • 15. Normal Visualizer: shades the geometry with the normal vector used as a color, modified to control the amount of bump (X and Y coords) and the intensity/length (Z coord)

    15. Normal Visualizer
  • 16. Skybox Reflection Bump: this shader is a combination of 4 and 9, so it includes reflection based on a cubemap as well as bump mapping based on a given normal map and a few customizable settings (intensity of bump, bump amount, etc)

    16. Skybox Reflection Bump
  • 17. Metallic Reflective Bump: shades the geometry with a metallic reflective bump mapped material. Takes a normal map and a cube map. The normal map is unwrapped onto the surface normals and the cube map is used to set the albedo color.

    17. Metallic Reflective Bump
  • 18. Dot Product Albedo: shades the geometry based on the angle between the normals and the view direction (used to set the color's red channel). It uses a color displacement parameter to allowing to invert the shading

    18. Dot Product Albedo
  • 19. Rim: creates a rim effect highlighting just the borders of the geometry with the given color and intensity parameters

    19. Rim
  • 20. Hard Rim: creates a rim effect highlighting just the borders of the geometry with the given color and intensity parameters, considering also a threshold used to control the start of the rim area

    20. Hard Rim
  • 21. Rim Bands: creates a rim effect highlighting just the borders of the geometry with the given colors and intensity parameters. The color thresholds allows to configure the size of the color bands

    21. Rim Bands
  • 22. Stripes: shades the geometry by sequentially switching between two colors depending on the world position, giving a multicolor horizontal band effect as a result

    22. Stripes
  • 23. Striped Rim: shades the geometry by sequentially switching between two colors depending on the world position, giving a multicolor horizontal band effect as a result. The band is rimmed to the edges depending on the given threshold parameter.

    23. Striped Rim
  • 24. Textured Striped Rim: shades the geometry with a base texture in addition to sequentially switching between two colors depending on the world position, giving a multicolor horizontal band effect as a result. The band is rimmed to the edges depending on the given threshold parameter, and the size of each band is also configurable

    24. Textured Striped Rim
  • 25. Basic Blinn Phong: shades the geometry with specular Blinn Phong lighting based on the input parameters

    25. Basic Blinn Phong
  • 26. PBR Metallic: shades the geometry with the Standard Metallic lighting model (PBR)

    26. PBR Metallic
  • 27. PBR Specular: shades the geometry with the Standard Specular lighting model (PBR)

    27. PBR Specular
  • 28. PBR Specular Emission: shades the geometry with the Standard Specular lighting model (PBR) and makes the geometry to glow only in the areas not blocked in the specular map (non-black areas)

    28. PBR Specular Emission
  • 29. PBR Specular Reversed Map: shades the geometry with the Standard Specular lighting model (PBR) but considering the specular map reversed in comparison with 27 (black areas are shinny and white/gray areas are mostly dull)

    29. PBR Specular Reversed Map
  • 30. Lighting Simple Lambert: shades the geometry with a basic form of a custom Lambert lighting

    30. Lighting Simple Lambert
  • 31. Lighting Simple Blinn-Phong: shades the geometry with a basic form of a custom Blinn Phong lighting

    31. Lighting Simple Blinn-Phong
  • 32. Lighting Toon: shades the geometry based on a main texture as well as a toon shading effect driven by the provided ramp map

    32. Lighting Toon
  • 33. Lighting Toon Albedo: shades the geometry based on a color as well as a toon shading effect driven by the provided ramp map. The toon effect is applied based on both the view and the lights direction (as if two toon effects where applied accumulatively)

    33. Lighting Toon Albedo
  • 34. Lighting Toon Specular: shades the geometry by applying a ramp map to the surface albedo based on the normal and the view direction to determine the UVs. It uses a Blinn-Phong shading to support specular highlights

    34. Lighting Toon Specular
  • 35. Lighting Simple Blinn-Phong Anim: shades the geometry with a basic form of a custom Blinn-Phong lighting including a simple Sin-based color change over time

  • 36. Simple Alpha: shades the geometry using the alpha channel of the main texture to drive the transparency

    36. Simple Alpha
  • 37. Hard Rim Hologram: creates a rim effect highlighting just the borders of the geometry with the given color and intensity parameters, considering also a threshold used to control the start of the rim area. The shading is also done so that the geometry gets more transparent at the center and less transparent at the edges achieving a kind of a hologram effect

    37. Hard Rim Hologram
  • 38. Hard Rim Hologram Anim: same as previous one but the hologram effect fades in and out with time

  • 39. Simple Blend: shades the geometry using a few different blend approaches

  • 40. Decal: shades the geometry using a decal texture. All pixels of the decal texture will be we visible except for the black ones

    40. Decal
  • 41. Billboard: shades the geometry with transparency considering it will be used as part of a billboard so it is drawn from both sides (front-face and back-face, no back-face culling)

  • 42. Decal Over Tex: shades the geometry with a given base texture plus a decal texture drawn right onto the base one

    42. Decal Over Tex
  • 43.1. X-Ray Scanner: writes the geometry to the stencil buffer without considering writing depth and frames buffer. This could be used as a see through hole when combine with the proper shader on another object

  • 43.2. X-Ray Scanner Frame: makes the geometry visible and applies a rim effect only on those areas which are not written on the stencil buffer. Combined with the 43.1. shader (put into another object) it allows to make a frame for the scanner

  • 43.3. X-Ray Passtrough: makes the geometry visible only on those areas which are not written on the stencil buffer. Combined with the 43.1. shader (put into another object) it allows to simulate that the geometry has a see through hole

    43.1_2_3. X-Ray
  • 44.1. Windowed World Viewer: writes the geometry to the stencil buffer given the Ref number, the Comp function to use and the Operation to apply on the buffer. These parameters are passed as an input to the shader so they can be set per-material (they should be set with the values included as comments in the Stencil section). Note that the shader does not write to the Frame Buffer (ColorMarsk 0), it does only fills the stencil

  • 44.2. WindowedWorldObject: writes the geometry considering only what is into the corresponding stencil buffer (given by Ref). The Comp function and the Operation to apply on the buffer are passed as an input to the shader so they can be set per-material (they should be set with the values included as comments in the Stencil section). Note that the shader does write to the Frame Buffer (no ColorMarsk parameter)

    44.1_2. Windowed World
  • 45. Simple VF: a simple vertex shader that colors the geometry per-pixel based on pixel's X position. The interesting thing to note here is that the color assigned corresponds to the vertex screen coords on the frag

  • 46. Simple VF UV Displacement: a simple vertex shader that colors the geometry based on a texture which is offseted using the Sin function

  • 47. Simple VF UV Colouring: a simple vertex shader that colors the geometry based either on a texture or the UV values of the mesh

  • 48. Screen Grab VF: grabs the rendered scene and applies it as a texture to the geometry

    48. Screen Grab VF
  • 49. Diffuse VF: shades the geometry using a simple diffuse Lambert lighting model (as it's a VF shader there are no shadows)

    49. Diffuse VF
  • 50. Diffuse VF Shadow Casting: shades the geometry using a simple diffuse Lambert lighting model including casting shadows to other objects

    50. Diffuse VF Shadow Casting
  • 51. Diffuse VF Shadow Receiving: shades the geometry using a simple diffuse Lambert lighting model including casting shadows to other objects and receiving shadows from othe objects. It also provides the option to alter the color of the received shadows

    51. Diffuse VF Shadow Receiving
  • 52. Normal Extrusion: extrudes the vertices based on the extrude amount parameter

    52. Normal Extrusion
  • 53. Simple Outline: shades the geometry with an outline of the specified color and width. Take into account that this solution, although simple, requires the shader to be set on the Transparency render queue, which might not be desirable

    53. Simple Outline
  • 54. Advanced Outline: shades the geometry with an outline of the specified color and width. In contrast to the previous outline solution it is not required to set it in the Transparent queue so it's more flexible and natural. It also outlines parts of the geometry not outlined by the previous shader

    54. Advanced Outline
  • 55. Glass Effect: shades the geometry with a glass effect that makes all what's behind it a little blurred and distorted

    55. Glass Effect
  • 56. Waves: alters the geometry so to make it wobble given the oscilation frequency, amplitude and speed. It does wobble the geometry in X and Z directions following sin and cos functions respectively

    56. Waves
  • 57. ScrollingWaves: alters the geometry so to make it wobble given the oscilation frequency, amplitude and speed. It does wobble the geometry in X and Z directions following sin and cos functions respectively. It also scrolls the texture applied over the surface based on some scroll input parameters, and includes an additional texture (for example, to represent foam over the water) which also scrolls at a different pace

    57. ScrollingWaves
  • 58. Plasma: shades the geometry with RGB coloured psychodelic circular patterns (akin a plasma effect)

  • 59. Plasma VF: shades the geometry with RGB coloured psychodelic circular patterns (akin a plasma effect) using a VF shader

  • 60. Advanced Hologram: quite similar to 37-38 but it also combines the rimmed hologram effect with a base color plus a base texture. Aditionally, it allows to control the transparency level and even the direction of the transparency (in-out or out-in) and allows to configure a kind of scanline animation so to better simulate the hologram effect as well as simple flickering and wobbling

    60. Advanced Hologram 60. Advanced Hologram

About

Experimenting with ShaderLab Shaders as part of a couple of tutorials, courses and books

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published