Posts

Showing posts from September, 2021

Custom Render Texture not updating when Double Buffered? WHY?

Image
There are two ways to fix this - one is in the update shader - make sure you have ZTest Always in your subshader block. OR (and I think this is something I was doing by accident, in order to make the custom render textures tile) you can disable depth on the custom render texture itself in the Inspector. This is probably a "well duh" to seasoned shader masters, but I must have spent 3 hours cursing Unity trying to figure out what was wrong. The other reason your CRT might not be updating is if you've set your initialisation to Realtime, which means it's always initialising!     SubShader     {                  Cull Off             ZWrite Off             ZTest Always         Pass         {    Name "update RD"             CGPROGRAM             #pragma vertex CustomRenderTextureVertexShader             #pragma fragment frag                                       ENDCG      

Unity custom render textures

Image
 It seems like Unity's Custom Render Textures provides much of the functionality that I'd want to create strange glitchy/feedback effects. The workflow is a little messy and nested, but we'll break it down here in text, cos I'm lazy to take screenshots. Firstly you have a material, which has a shader (could be anything), but importantly, it uses a texture - our custom render texture. The custom render texture itself takes a few different inputs - it needs a material to update it and "something" to initialise it with. The Initialisation could just be from a texture, but should you require something a bit more flexible, you can assign a material with a shader. Both the update material and intialisation material shaders are a little different to the ones I've been covering here, in terms of structure. This is because they're specifically operating within the custom render texture workflow. Firstly - the initialisation shader - Shader "customRT/init_s