Ronja's tutorials

Posts

September 2, 2018

White Noise

Summary For many effects we want random numbers to generate patterns or other things in our shaders. Directly using those random values generates a pattern we call “white noise”. There are other patterns which have more structure we can generate based on that which we will explore in other tutorials, for example perlin and voronoi noise. For this tutorial we will implement the noise in a surface shader so you should know how to write a basic surface shader).
August 27, 2018

Blur Postprocessing Effect (Box and Gauss)

Summary A effect that’s useful for example to show exhaustion or to make transitions is a blur. To blur the screen we take the average of the surrounding pixels. You can use the effect in many places, but the easiest and most straightforward is probably as a postprocessing effect, so it’s best for you to know how to write postprocessing effects before doing this tutorial. Boxblur The easiest form of a blur is a box blur, it just takes the average of a square area and displays it.
August 18, 2018

Stencil Buffers

Summary The depth buffer helps us compare depths of objects to ensure they occlude each other properly. But theres also a part of the stencil buffer reserved for “stencil operations”. This part of the depth buffer is commonly referred to as stencil buffer. Stencil buffers are mostly used to only render parts of objects while discarding others. The stencil buffer is also used by unity internally for the deferred graphics pipeline, so if you do deferred rendering, some limitations apply.
August 6, 2018

Clipping a Model with a Plane

Summary Another cool effect is to make the surface disappear when it’s beyond a certain plane. To follow this tutorial, it’s best to know how surface shaders work - you can find a tutorial how they work here. Define Plane We start by creating a new C# script which will define the plane we use later and pass it to the shader. It has a material as a public variable which we will pass the plane to.
July 21, 2018

Hull Outlines

Summary So far we only ever wrote a color to the screen once per shader (or let unity generate multiple passes for us via surface shaders). But we have the possibility to draw our mesh multiple times in a single shader. A great way to use this is to draw outlines. First we draw our object as usual and then we draw it again, but we change the vertices a bit so it’s only visible around the original object, drawing a outline.
July 15, 2018

Outlines via Postprocessing

Summary One of my favourite postprocessing effects are outlines. Doing outlines via postprocessing has many advantages. It’s better at detecting edges than the alternative (inverted hull outlines) and you don’t have to change all of your materials to give them the outline effect. To understand how to create outlines via postprocessing it’s best to have understood how to get access to the depth and normals of the scene first. Depth Outlines We start with the shader and C# script from the postprocessing with normals tutorial.
July 8, 2018

Postprocessing with Normal Texture

Summary Another piece of information we can easily get our hands on thats very useful for postprocessing is the normals of the scene. They show in which direction the surface at any given pixel is pointing. To understand how to get and use the normals of the scene it’s best to know how to access the scene depth first, I made a tutorial on how to do that here. Read Depth and Normals We start this tutorials with the files from the depth postprocessing tutorial and expand them as we need.
July 1, 2018

Postprocessing with the Depth Texture

Summary In the last tutorial I explained how to do very simple postprocessing effects. One important tool to do more advanced effects is access to the depth buffer. It’s a texture in which the distance of pixels from the camera is saved in. To understand how postprocessing effects with access to the depth buffer work it’s best to understand how postprocessing works in general in unity. I have a tutorial on that here.
June 23, 2018

Postprocessing Basics

Summary We used all shaders we wrote in this tutorial until now to render models to the screen. Another way shaders are commonly used is to manipulate images with them. That includes the image we’re drawing to the screen as we render our game. When manipulating the render output after we rendered our objects to the screen it’s called postprocessing. Postprocessing still uses the same shader language and structure as shaders that render surfaces, so I’d recommend you to know how to render surfaces first.
June 16, 2018

Vertex Displacement

Summary So far we only used the vertex shader to move vertices from their object coordinates to their clip space coordinates (or to the world space coordinates which we then used for other things). But there are more things we can do with vertex shaders. As a introduction I’m going to show you how to apply a simple sine wave to a model, making it wobble. I will make the shader with a surface shader so you should know the basics of surface shaders, but it works the same with any other type of shader.
  • ««
  • «
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • »
  • »»
© Ronja's tutorials 2021