Bug related to Unity Projectors
Posted: Thu Dec 06, 2018 3:02 am
Alright, I've spent multiple days now on this saga to figure out why a projector shader I made (using Amplify) worked perfectly fine when being projected onto the default Unity shader but would not appear on a material using the main Amplify shader I built. Here's the basic breakdown of events in order that led me to discovering this bug:
1. Projector not working on main amplify shader, no problem I'll figure this out easily!
2. Tried everything I could possibly imagine in an attempt to get the projector to work on my shader, including unplugging all of my nodes and changing every possible property, nothing fixed the issue.
3. Tried making a duplicate of the shader (copy/paste then renaming in windows explorer and changing shader name in the editor), still didn't work.
4. Created a brand new shader and copy/pasted all of my nodes from the old shader into it, while also matching everything in the properties settings to make sure it was perfectly identical. THIS FIXED THE ISSUE, BUT WHY???
5. Explored every possible setting in the fixed version in an attempt to break it and figure out what caused the problem in the first place. Ended up discovering that as soon as you change the render type to transparent the shader will no longer work with projectors. This was interesting because my original shader that still wasn't working WAS NOT SET TO TRANSPARENT, IT WAS OPAQUE!!!! Also, after switching the previously working version back to opaque IT WAS NO LONGER WORKING!!!
6. O.K........... so now I know that as soon as a shader gets set to render type: transparent it will never work with projectors ever again even if it's no longer set to be transparent (old one was based on another shader that used opacity so it was flagged as transparent in the past). So now the question is why is this happening and can I fix it?
7. I'm not a programmer and really dislike working in code but for this I made an exception. So what did I find in the tags right under SubShader but this: "IgnoreProjector" = "True". AH-HA, I found the problem, so easy-peesy, I delete that tag, check the shader in my scene and the projector is actually appearing on it WOO-HOO!!! Unfortunately the instant I save my shader in the editor that tag re-appears in the code............FFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUU
8. So now the search begins for what's causing that tag to re-appear after it's been deleted AND the shader isn't set to transparent. There are too many variables with my working shader so now that I've identified the problem and how to re-create it I make a brand new empty shader for testing with zero nodes.
9. I check the code on the empty shader, there is no "IgnoreProjector" = "True" tag and the projector works on it. I set the render type to transparent, the tag appears, projector no longer works, delete the tag, set to opaque, projector works again BUT the instant I save the shader the tag re-appears. So the permanent tag bug happens on an empty shader.
10. Something must be saving that tag information and telling the shader to re-add it, the question is where is that information saved? I tried making a duplicate, deleting the metadata and re-naming in windows and the shader name in the code, still broken. I even made a copy, completely renamed it, e-mailed it to a programmer I worked with and he imported it into a new Unity project on his machine..........still broken, we could not get that tag to stay gone.
11. Final attempt, we looked further into the code and discovered that one of the MANY flags in the commented out section at the bottom of the code was causing the tag to continually be re-added to the code. The only fix I currently have for this issue is to delete all of the commented out code at the bottom. This basically forcibly resets all of those tags to actually match whats in the code above because once you save the shader all of that commented section is automatically re-populated. Unfortunately, because I have no way of identifying the specific true or false tag related to ignore projectors I end up deleting everything which erases all of my nodes/wire connections in the shader editor, thus making it impossible to edit that shader through the node editor ever again.
12. TLDR, if you set a shader to render transparent it will never be compatible with projectors ever again no matter what you do. All I want is for the tags in the code to be properly updated when you update the nodes or properties in the shader editor.
I can send screenshots or anything else if you want, but as I said above you can easily recreate this bug with an empty shader yourself.
1. Projector not working on main amplify shader, no problem I'll figure this out easily!
2. Tried everything I could possibly imagine in an attempt to get the projector to work on my shader, including unplugging all of my nodes and changing every possible property, nothing fixed the issue.
3. Tried making a duplicate of the shader (copy/paste then renaming in windows explorer and changing shader name in the editor), still didn't work.
4. Created a brand new shader and copy/pasted all of my nodes from the old shader into it, while also matching everything in the properties settings to make sure it was perfectly identical. THIS FIXED THE ISSUE, BUT WHY???
5. Explored every possible setting in the fixed version in an attempt to break it and figure out what caused the problem in the first place. Ended up discovering that as soon as you change the render type to transparent the shader will no longer work with projectors. This was interesting because my original shader that still wasn't working WAS NOT SET TO TRANSPARENT, IT WAS OPAQUE!!!! Also, after switching the previously working version back to opaque IT WAS NO LONGER WORKING!!!
6. O.K........... so now I know that as soon as a shader gets set to render type: transparent it will never work with projectors ever again even if it's no longer set to be transparent (old one was based on another shader that used opacity so it was flagged as transparent in the past). So now the question is why is this happening and can I fix it?
7. I'm not a programmer and really dislike working in code but for this I made an exception. So what did I find in the tags right under SubShader but this: "IgnoreProjector" = "True". AH-HA, I found the problem, so easy-peesy, I delete that tag, check the shader in my scene and the projector is actually appearing on it WOO-HOO!!! Unfortunately the instant I save my shader in the editor that tag re-appears in the code............FFFFFFFFFFFFFFFFFFFFFFFFFFFFUUUUUUU
8. So now the search begins for what's causing that tag to re-appear after it's been deleted AND the shader isn't set to transparent. There are too many variables with my working shader so now that I've identified the problem and how to re-create it I make a brand new empty shader for testing with zero nodes.
9. I check the code on the empty shader, there is no "IgnoreProjector" = "True" tag and the projector works on it. I set the render type to transparent, the tag appears, projector no longer works, delete the tag, set to opaque, projector works again BUT the instant I save the shader the tag re-appears. So the permanent tag bug happens on an empty shader.
10. Something must be saving that tag information and telling the shader to re-add it, the question is where is that information saved? I tried making a duplicate, deleting the metadata and re-naming in windows and the shader name in the code, still broken. I even made a copy, completely renamed it, e-mailed it to a programmer I worked with and he imported it into a new Unity project on his machine..........still broken, we could not get that tag to stay gone.
11. Final attempt, we looked further into the code and discovered that one of the MANY flags in the commented out section at the bottom of the code was causing the tag to continually be re-added to the code. The only fix I currently have for this issue is to delete all of the commented out code at the bottom. This basically forcibly resets all of those tags to actually match whats in the code above because once you save the shader all of that commented section is automatically re-populated. Unfortunately, because I have no way of identifying the specific true or false tag related to ignore projectors I end up deleting everything which erases all of my nodes/wire connections in the shader editor, thus making it impossible to edit that shader through the node editor ever again.
12. TLDR, if you set a shader to render transparent it will never be compatible with projectors ever again no matter what you do. All I want is for the tags in the code to be properly updated when you update the nodes or properties in the shader editor.
I can send screenshots or anything else if you want, but as I said above you can easily recreate this bug with an empty shader yourself.