Ronja's tutorials

Posts

March 23, 2018

Basic Shader

Summary In the last three tutorials I explained some of the cornerstones of how shaders work. In this one I show you how to fill in the rest. The main thing I didn’t show was actual executed code. Thats because you don’t need much code to get a shader running at first and all of the fancy code is in specialized tutorials. What we have so far Everything here should be explained in one of the previous three tutorials.
March 22, 2018

Variables

Summary After making clear how the shader stages are put together and the rough outline of shaderlab outside of the actual shader code, lets talk about what variables our shader needs to function and how we add them to our code. This includes the variables that we set per material, the variables that are part of the mesh data and the data thats passed from the vertex to the fragment.
March 21, 2018

HLSL

HLSL? Hlsl is the language the “juicy” parts of unity shaders are written in. The parts that contain custom logic and eventually decide what is drawn where on screen. It’s the language Microsoft designed to work with their Direct3D API to write gpu programs. Strictly speaking most Unity shaders are tagged as being written in CG which is short for C for Graphics, but CG shares most of it’s syntax and features with hlsl and was deprecated in 2012, so wrongly referring to it as hlsl leads to you being able to find better results in search engines and not much else.
March 20, 2018

Structure

Shader Structure When talking about shaders I want to start at explaining the rough outline of how shaders are set up so we can understand how to customize them. Most modern shaders have a variable pipeline that consists out of at least a vertex shader and a fragment shader. It’s also possible to add a geometry and tesselation stage to this, but you only rarely need those. The vertex shader (sometimes also called vertex stage or function) takes the data that defines the model and transforms it into screenspace so it can be rendered (using matrix multiplication, but we can just accept that it works for now).
  • ««
  • «
  • 1
  • 2
  • 3
  •  … 
  • 5
  • 6
  • »
  • »»
© Ronja's tutorials 2021