Arrays & Shaders in Unity 5.4+

This post shows how to use arrays and shaders in Unity 5.4. Back in January I already covered this topic in an article called Arrays & shaders: Heatmaps in Unity. My original approach exposed an undocumented feature that allowed to pass arrays to shaders. Since then, Unity 5.4 has introduced proper support in its API. This tutorial replaces the previous article. If you have read the previous tutorial, you do not need any changes to your shader code and you can skip to Step 2.

Continue reading

3D Printer Shader Effect – Part 2

This is the second part of the tutorial that will recreate the 3D printer effect seen in games such as Astroneer and Planetary Annihilation.

a1

This is a two part tutorials:

A link to download the Unity package (code, shader and 3D models) is provided at the end of the tutorial.

Continue reading

3D Printer Shader Effect – Part 1

This tutorial will recreate the 3D printer effect seen in games such as Astroneer and Planetary Annihilation. It’s an interesting effect that shows an object in the process of being created. Despite looking simple, there are many challenges that are far from being trivial.

a1

This is a two part tutorials:

A link to download the Unity package (code, shader and 3D models) is provided at the end of the tutorial.

Continue reading

Volumetric Rendering: Signed Distance Functions

This tutorial explains how to create complex 3D shapes inside volumetric shaders. Signed Distance Functions (often referred as Fields) are mathematical tools used to describe geometrical shapes such as sphere, boxes and tori. Compared to traditional 3D models made out of triangles, signed distance functions provide virtually infinite resolution, and are amenable to geometric manipulation. The following animation, from formulanimation tutorial :: making a snail, shows how a snail can be created using simpler shapes:

A snail created by Signed Distance Fields.

You can find here all the other posts in this series:

Continue reading

Volumetric Rendering: Surface Shading

Volumetric Rendering: Surface Shading

This third instalment on Volumetric Rendering will explain how to shade volumes in a realistic fashion. This essential step is what gives threedimensionality to the flat, unlit shapes that have been generated so far with raymarching.

geom1

You can find here all the other posts in this series:

Continue reading

Volumetric Rendering: Raymarching

Volumetric Rendering: Raymarching

This post continues the tutorial on volumetric rendering, introducing one of the most used techniques: raymarching.

You can find here all the other posts in this series:

Continue reading

Volumetric Rendering

Volumetric Rendering

This is the first part of a Unity tutorial dedicated to Volumetric Rendering, raymarching and signed distance fields. These techniques allow us to overcome the biggest limitation of modern 3D engines, which only let us render the outer shell of an object. Volumetric rendering enables the creation of realistic materials that interact with light in a complex way, such as fog, smoke, water and glass. Beautifully crafted effects such as NMZ‘s Plasma Globe (below) would simply be impossible without volumetric rendering.

v1

These techniques are not complicated, but require a lot of steps in order to replicate the aforementioned effects. This tutorial has got you covered.

  • Part 1: Volumetric Rendering | An introduction on what rendering volume means, and how it can be done in Unity;
  • Part 2: Raymarching | Focuses on the the implementation of distance-aided raymarching, the de-fact standard technique to render volumes;
  • Part 3: Surface Shading | A comprehensive guide on how to shade volumes realistically;
  • Part 4: Signed Distance Functions | An in depth discussion on the mathematical tools that allow us to generate and combine arbitrary volumes;
  • Part 5: Ambient Occlusion | How to implement realistic and efficient ambient occlusion in your volumes;
  • 🚧 Part 6: Hard and Soft Shadows | How to add real shadows to your volumes;

This first part will provide a general introduction to volumetric rendering, and end with a simple shader that will be the base of all our future iterations:

A full Unity package will be available soon. You may want to consider subscribing to the mailing list to stay updated.

Continue reading

LCD Display Shader Effect

This tutorial will show how to create a realistic shader that simulate the look and feeling of LCD displays. Developer Monomi Park has recently announced (link) a new update to their game Slime Rancher. One of the most intriguing cosmetic effect that is going to be added is a special LCD shader that makes monitors look pixelated when you’re close to them. The effect was so cool that I simply had to recreate it.

tumblr_inline_o4922sDwOm1t02419_500

Continue reading

How to Simulate Cellular Automata with Shaders

This post will show how to simulate cellular automata using shaders. The popular cellular automaton developed by John Conway, Game of Life, will be used as an example for this tutorial. To learn how to set up your project, check out the first two parts of this tutorial: How to Use Shaders For Simulations and How to Simulate Smoke with Shaders.

life

Continue reading

How to Simulate Smoke with Shaders

This post will show how to simulate the diffusion of smoke using shaders. This part of the tutorial focuses on the Maths and the code necessary to recreate the smoke effect. To learn how to set up your project, check out the first part: How to Use Shaders For Simulations.

texture6

Continue reading