Pesky Problems with Procedural UVs

In my article on Sphere Impostors I talked a bit about two different issues that come up when using procedural UVs calculated in the fragment shader. And showed solutions for both. Unfortunately it seems one of those solutions has an Achilles’ heel.

This article is about some alternative solutions I knew of, and one I didn’t until I was writing this article. And how the one I didn’t know taught me about stuff I didn’t know I didn’t know.

Note: This article is written with Unity in mind and the presented example code is written in HLSL. But the techniques…

Making the Sphere Impostor Feel More Competent

GPU raytracing is all the rage these days, so lets talk about about it! Today we’re going to raytrace a single sphere.

Using a fragment shader.

Yeah, I know. Not super fancy. You can do a search on Shadertoy and get hundreds of examples. There are even several great tutorials out there already for doing sphere impostors, which is what this is. So why would I write another article on it? It’s not even the right kind of GPU raytracing!

Well, because the raytracing part isn’t really the part I’m going to focus on. This article is more about how…

An Exploration of GPU Silhouette Rendering

On almost every project I’ve worked on, at some point someone comes out with a bit of graphic design concept art like this:

Disclaimer: Not Real Concept Art

My usual response is to sigh, and start explaining why we can’t do outlines like that. Or at least start talking to them about the kind of deep modifications to the asset pipeline we would need to make this possible.

Of course my latest project is no different. But this time before I launched into my script on the differences between what Photoshop can do compared to the limitations of real time I had a thought.


Exploring shader based circular progress bars for Unity games

Progress bars are a common element in UIs, and for various reasons it’s not uncommon for then to be circles or arcs. I’m going to go over the common ways most people will end up implementing this. And discuss why I did something else.

The Usual Suspects

Canvas Image

This may be the most common solution. It requires no programming, and is built into Unity’s UI systems, so it’s not surprising it’s the first recommendation you’re likely to find online.

Unity Canvas Image progress bar

This is an Image component with the Image Type set to Fill, with a Radial 360 Fill Method over another Image component for the background…

And how to tell what’s wrong with your content pipeline.

Last Update: 7/17/20

Lets say you have an awesome high poly model an artist has been working on that you’re looking forward to getting into your game. They’ve been showing off screen grabs of the model in their content tools and it looks fantastic. Even after baking the normal maps to a low poly version it still looks great.

Mipmapping is ubiquitous in real time rendering, but has limitations. This article is going to go into what mipmapping is, how it’s used, and how it can be made better.

Warning: this page has about 72MB of Gifs! Medium also has a tendency to not load them properly, so if there’s a large gap or overly blurry image, try reloading the page. Ad blockers may cause problems, no script may make it better. It’s also broken in the official Medium app. Sorry, Medium is just weird.

This article is Unity and MSAA / no-FSAA focused. If you’re intending to use…

Team coloring or otherwise modifying the color of part of an object is a common use case for shaders. It’s also a use case that often has a surprisingly subtle issue that is usually either missed or left unsolved.

Lets say we have a character model and we want to allow a user to modify the team color in game.

The most straight forward solution is to create multiple textures with the team color baked in. If you only have two team colors, this is likely what you’ve already done. But lets say you want to let the players choose…

Triplanar mapping is a great solution for dealing with texturing on complex geometry that is difficult or impossible to use traditional UVs for with out obvious stretching and/or texture seams. It’s also a technique plagued by half hearted and straight up wrong implementations of normal mapping.

edit: Note that the shader code in this article is written for use in Unity. All of the techniques discussed can work with other engines, but modifications will likely be necessary to make them work properly.

Example Unity shaders available here:

Table of Contents

  1. Triplanar Mapping
    “Try Play” What Now?
  2. The Problem
    Not So Normal Mapping

Aliasing is the bane of VR. We have several tools we use to try to remove, or at least reduce aliasing in real time graphics today. Tools like super sampling, temporal anti-aliasing (TAA), and multi sample anti-aliasing (MSAA). They all have their pros and cons, but there’s one tool I don’t feel like gets the use and respect it deserves. That tool is a feature of MSAA, Alpha to Coverage.

This article will be assuming you’re using forward rendering with at least 4x MSAA. If you’ve chosen to use deferred rendering this article will be less useful for you. Some…

Ben Golus

Tech Artist & Graphics Programmer lately focused on Unity VR game dev.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store