0
Not a bug

post process shaders break after changing anything

Dickie McCarthy 9 years ago updated by Freya Holmér (Developer) 9 years ago 9
I can't seem to find any documentation anywhere on post processing with shader forge so this may be an unintended use of SF, but trying to recreate how I'd do post processes in Unreal. 

Start off simple, just throw in the camera's depth, all hunky dory.

Image 349

now the problem comes as soon as I edit/compile that shader again, see the simple edit below
Image 350

screen goes entirely black and there's nothing which can be done about it.
change all the settings, put them back the way they were, nothing,

The only work around seems to be to make a duplicate of the shader, rename it's reference in shader forge and then reapply it seems to work ... untill you want to edit it.

Any advice? I'll post the C# I'm using incase that's anything to do with it

using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
[RequireComponent (typeof(Camera))]

public class MaskPost : MonoBehaviour {

public Material mat;
void OnRenderImage (RenderTexture source, RenderTexture destination){

Graphics.Blit(source,destination,mat);
}
}

Answer

Answer
Not a bug
I'm guessing this has more to do with the C# side rather than the shader itself, so I'm closing this!
Hope it works out anyhow :)
Under review
That's odd - does it only happen when you use it as a post effect, or when you use it on a mesh too?
Right, super peculiar development, if the material is applied to a mesh it's fine, compiles and works as a material and post process effect. As soon as no mesh in the scene has this material applied to it goes back to compiling to all black
Answer
Not a bug
I'm guessing this has more to do with the C# side rather than the shader itself, so I'm closing this!
Hope it works out anyhow :)
Yea I'm not sure what's wrong but as soon as I tried to record this the problem went away without me changing anything... typical, thanks for the help
Hmm actually I take that back I still can't seem to access the depth channel, everything else is fine but trying to use the MainTex's alpha channel or the depth node seems to get zero results, this is definitely the shader
This could be a forward vs deferred thing. If you have a forward camera, you need to make sure it renders a depth map too
hmm it is deffered and as in the top picture it does have a depth texture, until it doesn't for some reason
Ah I take it back, Unity was saying it was rendering a depth texture for the camera when It wasn't, indeed not a bug