Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Standard shader with vertex colors

Discussion in 'Shaders' started by defaxer, Apr 5, 2015.

  1. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    340
    Hey, great, usefull shader. I'm getting these errors - and i have no idea what that means :
    (Edit : i'm using scale and gpu instancing)

    Code (CSharp):
    1. Shader error in 'Standard Specular (Vertex Color)': Duplicated input semantics can't change type, size, or layout ('TEXCOORD8'). at Assets/UnityVC/UnityVC.cginc(199) (on d3d11)
    2.  
    3. Shader error in 'Standard Specular (Vertex Color)': output TEXCOORD8 used more than once at Assets/UnityVC/UnityVC.cginc(199) (on d3d11)
     
  2. MasoInar

    MasoInar

    Joined:
    Feb 20, 2014
    Posts:
    125
    Hi,

    Which unity version you are using and what is your target platform? If I have some time, I can check if I can replicate your issue?
     
  3. Gruguir

    Gruguir

    Joined:
    Nov 30, 2010
    Posts:
    340
    Hey @MasoInar sorry, i'm watching this thread but didn't get notification...
    Ut 2017.2.0F3 - Standalone - DX11
     
  4. iansnyder

    iansnyder

    Joined:
    Dec 22, 2012
    Posts:
    27
    @MasoInar Thanks so much for this! Exactly what I was looking for tonight, and it worked right away for me :) Kudos!
     
  5. KayH

    KayH

    Joined:
    Jan 6, 2017
    Posts:
    107
    @MasoInar Thanks for updating this shader to the latest Unity version. I downloaded the version from this url:

    https://github.com/H-man/UnityVertexColors

    But unfortunately it doesn't seem to work on Android. I get the following errors:

    Shader error in 'Standard (Vertex Color)': 'posWorld' : no such field in structure; 'constructor' : can't convert; 'FragmentSetup' : unable to suitably promote arguments to function at Assets/UnityVC/UnityVC.cginc(152) (on gles)

    Compiling Vertex program with DIRECTIONAL _ALPHABLEND_ON _METALLICGLOSSMAP _VERTEXCOLOR
    Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_MOBILE UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA


    Shader error in 'Standard (Vertex Color)': invalid subscript 'posWorld' 'FragmentSetup': no matching 5 parameter function at Assets/UnityVC/UnityVC.cginc(152) (on gles3)

    Compiling Vertex program with DIRECTIONAL _ALPHABLEND_ON _METALLICGLOSSMAP _VERTEXCOLOR
    Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_MOBILE UNITY_HARDWARE_TIER2 UNITY_COLORSPACE_GAMMA


    Shader error in 'Standard (Vertex Color)': invalid subscript 'posWorld' 'FragmentSetup': no matching 5 parameter function at Assets/UnityVC/UnityVC.cginc(152) (on vulkan)

    Compiling Vertex program with DIRECTIONAL _ALPHABLEND_ON _METALLICGLOSSMAP _VERTEXCOLOR
    Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_MOBILE UNITY_HARDWARE_TIER2 UNITY_COLORSPACE_GAMMA


    Shader error in 'Standard (Vertex Color)': 'posWorld' : no such field in structure; 'constructor' : can't convert; 'FragmentSetup' : unable to suitably promote arguments to function at Assets/UnityVC/UnityVC.cginc(368) (on gles)

    Compiling Vertex program with DIRECTIONAL _ALPHABLEND_ON _METALLICGLOSSMAP _VERTEXCOLOR
    Platform defines: UNITY_NO_DXT5nm UNITY_NO_RGBM UNITY_ENABLE_REFLECTION_BUFFERS UNITY_FRAMEBUFFER_FETCH_AVAILABLE UNITY_NO_CUBEMAP_ARRAY UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 SHADER_API_MOBILE UNITY_HARDWARE_TIER3 UNITY_COLORSPACE_GAMMA

    It runs fine in the editor. I'm on version 2017.2.1f1.
     
    VOTRUBEC likes this.
  6. petersvp

    petersvp

    Joined:
    Dec 20, 2013
    Posts:
    60

    I am getting this same error on WebGL
     
  7. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    In 2018.1 beta7, I resolved the shader compilation error by updating fragForwardAdd_VC in UnityVC.cginc to:

    Code (CSharp):
    1. half4 fragForwardAdd_VC(VertexOutputForwardAdd_VC i) : SV_Target
    2. {
    3.  UNITY_APPLY_DITHER_CROSSFADE(i.pos.xy);
    4.  FRAGMENT_SETUP_FWDADD(s)
    5.  UNITY_LIGHT_ATTENUATION(atten, i, s.posWorld)
    6.  UnityLight light = AdditiveLight(IN_LIGHTDIR_FWDADD(i), atten);
    7.  UnityIndirect noIndirect = ZeroIndirect();
    8.  half4 c = UNITY_BRDF_PBS(s.diffColor, s.specColor, s.oneMinusReflectivity, s.smoothness, s.normalWorld, -s.eyeVec, light, noIndirect);
    9.  c *= i.color;
    10.  UNITY_APPLY_FOG_COLOR(i.fogCoord, c.rgb, half4(0,0,0,0)); // fog towards black in additive pass
    11.  return OutputForward(c, s.alpha);
    12. }
     
  8. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    Just for everyone's reference, (including mine), 2018.1.0b12 broke the shader again.

    To fix it, I updated UnityVC.cginc lines 72, 190 & 275. from half3 to float3.

    The new UnityCG.cginc has been updated a lot in the last beta update though. So I'm not sure how long we'll be able to just keep patching this aging shader... I wish I new more shader programming otherwise I'd give it a crack myself.
     
  9. MasoInar

    MasoInar

    Joined:
    Feb 20, 2014
    Posts:
    125
    Yeah, I gave it up as it seems that in every new version we need to change something. Maybe with upcoming shader node editor there's an easy way to add vertex colors to standard shader.
     
    VOTRUBEC likes this.
  10. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    There was a thread for Stadard Asset suggestions.
    I suggested things, you should go there and post.

    https://forum.unity.com/threads/sta...now-what-you-think.516595/page-2#post-3404760

    WillGoldstone took notice, I sent him an email that he requested.
    Then never heard back.

    That was a month ago.

    I do appreciate the volunteer help.
    I'm still on 5.5.2 just because it works, but I would like to try Jobs at some point.

    If someone makes a working version you really need to post the 2 files.
    Because we dont know what version of a file you just modified.
    Its super easy to put something on DropBox or anywhere.

    Shader Node editior - yeah I was hoping the same thing.


    Thanks for helping!
    Tzan
     
    Last edited: Mar 26, 2018
    MasoInar and VOTRUBEC like this.
  11. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
  12. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    VertexColourShaderGraph.png
    Well, I added the correct packages through the package manager within Unity, and then did this yesterday. It's picked up the vertex colours I created in Blender, and placed it directly into a PBR material. So, I think we have our answer...
     
  13. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    Cool, thanks for testing that.
    Hopefully this new system is something they keep instead of junking after a few years.
     
    VOTRUBEC likes this.
  14. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    When that graph makes a shader, then you look at it in the Inspector, does it have a slot for a Detail Texture?
    I dont see how to use a Detail Texture in the graph stuff.
     
  15. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    Ok guys and girls, it looks like I may have jumped the gun. Especially for my situation. The Shader Graph requires the Scriptable Render Pipeline (Lightweight is the only one currently tried and tested) to be installed. All good and fine. Until you realise that the LWSRP forces disabling of certain features (AO in my case seemed to be ignored). I'm targeting iPhone 5S's and above, so I don't mind a few Post Processing Stack v2 features. That's when the whole thing comes crumbling down. The shader I posted above STILL doesn't render the vertex colours on the actual device (iOS with Metal), even though it works correctly in the Editor. I suspect this might be a Shader Graph issue, because, working in the editor implies it should work correctly on the device. I will be adding a comment to the Shader Graph team to see what they say.

    In the meantime, I masochistically downloaded the latest shaders for 2018.1.b13, and got Vertex Colour working on the Standard Shader. It works for me, on an iPhone. I'll package up the files (there's a few now because Unity have abstracted a lot of their code in the new shaders), and post here shortly. YMMV though. I'm using Forward Rendering on an iPhone with Metal in Linear mode, and haven't tried Deferred. I've also noticed that there's a few lighting quirks when using a vertex colour intensity of anything less than one. The vertex colours are correct, and the light amount looks correct, but (and this is my ignorance showing), it seems to lose any HDR values...? My "Bloom" stops working on the model for areas that are intensely bright. I might go through the code and make sure I haven't made any obvious mistakes.

    I'll be sure to post the files shortly and after I've tried to fix the lighting issue. If anyone wants them sooner than I get around to posting them, just ping me and I'll send what I've got as is.
     
    xCyborg and Tzan like this.
  16. MasoInar

    MasoInar

    Joined:
    Feb 20, 2014
    Posts:
    125
    This is kind of disappointing. It shouldn't need much effort for unity to make and include standard shader variant that supports vertex colors..
     
    VOTRUBEC likes this.
  17. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    Especially considering that when using software like Blender, Vertex Painting is a completely viable method of assigning colours to models. Add to the fact that LowPoly is an huge artistic movement, it still amazes me that we have to jump through so many hoops, when the data is already there in the FBX! Why are they insisting that we unwrap the model, then paint a texture, to simulate vertex colours? I'm preaching to the choir, I know, but it's still frustrating. And then when they seem to include the support through the Shader Graph, it doesn't actually work on the device! Hahaha.. if it weren't so laborious, it'd be funny.
     
    MasoInar likes this.
  18. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    heh, It's been like 2years since I posted in this thread, but I'm glad I'm not the only one that wonders why Unity just overlook these things and doesn't official support these types of things better. ...as you say it is very useful and fits alot of artistic trends ..and...

    I think Unity seem to be completely oblivious to alot of things being said on the forums that go in threads like these, sometimes I wonder if not deliberately.

     
  19. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Did you post about that issue on the Shader graph thread? That certainly sounds like a bug. You shouldn't just dismiss it and forget about it. It needs to be fixed. Also, did you check the Asset file with the SRP settings? some graphical options can be turned on an off, and by default the Light weight pipeline template disables a lot of things (but you can re-enable them in the settings asset). Though, personally I wouldn't use 2018.1 until it's out of beta... (just a little longer though).
     
  20. Alverik

    Alverik

    Joined:
    Apr 15, 2016
    Posts:
    417
    Well, I love the way models can look when rendered using vertex colors (and skip UVing the object, lol), but to be honest that's not a very commonly used technique... Vertex colors are used more often in VFX techniques and vertex animation. A few people use vertex colors for actual rendering if they like the look or want more performance in mobile (though, using the standard shader along with it kinda misses the point, since it's slightly slower than custom made shaders). But if you want a hand drawn effect most people will think of toon shaders, not vertex colors... so maybe adding the effect is just low priority for Unity. I don't know if there's even an actual feature request for vertex colors in the standard shader either... most likely, the shader graph will really be the way to go in the future if you need to render using vertex colors.
     
    Last edited: Apr 5, 2018
  21. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    I kinda agree, though low priority because sometimes you have to make the features/tooling etc to then show people how something can be really useful first. Also it's probably not used often because not many developers find the tools for even painting vertex colors on models in Unity, something that should be provided in the toolbox, you literately have to go and find the tools for that separately. Like this one I ended up using myself https://forum.unity.com/threads/rel...es-splat-map-shaders-flow-maps-ao-etc.384787/

    Still this shader was the best I could find and even then I had problems with it.. actually ended up not using it despite wanting to because of the reasons stated in the first post I made on this thread. Kinda sad to see it's still having more problems with the newer changes being made in Unity. The whole scriptable render pipeline changes going on is just adding to the complication I guess.. "shader graph will really be the way to go in the future if you need to render using vertex colors" I guess so, honestly I just like to see something work and then I know I can use it, because I'm not into shader coding at all. Even shader graphs is only something I'll loosely make changes to (usually a lot more changes because its more visual to see changes) rather than try build up an entirely new shader from scratch because its not something I spend much time with.

    I think with probuilder tools being integrated into Unity it might get this area more support, pretty sure probuidler comes with some 'basic' vertex painting tools and accompanying vertex color shaders.. I think, probably nothing advanced yet sadly :)
     
    Alverik likes this.
  22. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    Yep, posted a question/bug-report to the shader graph thread on GitHub.

    Personally I've been using 2018.1 for a while now because of the .NET 4.6 support. I'm also using Azure, so I can use the same code across the server and Unity new, which is bloody helpful, and cuts coding down immensely. Off topic, I know, but ...
     
    Alverik likes this.
  23. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    I've been talking to our new artist, and he loves the vertex colouring in Blender. It means he doesn't have to hand draw the materials nearly as much. And, it's a style we (the team I'm working with) like.

    As an example, here's a test in-editor render using the new shader I updated from the latest Standard Shader and cginc files. One is at full Intensity, and the other is at 1/3 Intensity. I figured out my problem with losing the HDR data, I was using fixed4 instead of half4 in the shader code, which is what the initial shader here did. So now it's working beautifully in Editor and on the iPhone.

    Alas, this doesn't solve the Shader Graph / Light-Weight SRP issue yet...
     

    Attached Files:

    Alverik likes this.
  24. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    Ok, so here is the new shader... I THINK it's working correctly. There's no warranty implied, and "use at own risk" applies, blah, blah. But to be honest, because I'm not a shader "guru", any issues, bugs or updates, I and everyone here would love to hear from you...
     

    Attached Files:

  25. SpaceAndDream

    SpaceAndDream

    Joined:
    Dec 3, 2009
    Posts:
    14
    @VOTRUBEC: crazy, crazy timing.

    A teammate had been struggling for a few days to have this vertex color standard shader compile with GLes for Android, to no avail. As we got together to pour over the problem this very morning, I thought I'd go see if any the community had had any luck with the issue... and you posted the files becore we even had breakfast. Thank you very much, the synchronicity is stunning!

    Update, 5 minutes after OP: seems like we're not able to build on Android, but working on it and we'll post the solution if we find it.

    Final update: It seems the require gles3.1 flag needs to be checked in your build settings for it properly compile. Although we could not confirm for sure. It seems there's a big black can of worms somewhere in there.

    It works now... let's what future updates to 2018 bring up. :)
     
    Last edited: Apr 6, 2018
    Harinezumi, Alverik and VOTRUBEC like this.
  26. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    Well, you guessed it. 2018.2.b01 has introduced changes to the shader code files. Nothing drastic. But it looks like the default #pragma target is now 3.0. DX9 looks like it's been dropped judging by the comments in the files.

    So, instead of uploading a zip every time, I'll just link a GitHub repository.

    Enjoy! = )

    https://github.com/Votrubec/VertexShader
     
    MasoInar and Tzan like this.
  27. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    628
    @VOTRUBEC Thanks, did they get back to you on the Shadergraph bug? If not, can I just modify some lines in the Standard Shader? why all the cgincs and Editor files?
     
  28. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    Grabbed it.
    Thanks!
     
  29. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    Hi xCyborg, I'm the first to admit that shader coding is not my forte. So, my brute force attempt was to simply replicate the Unity standard shader, in toto, and modify the standard files, adding the "colour" parameter where needed. I noticed that the shader files in Unity 2017+ were a lot more detailed than the previous Unity 5.x files. There were structures in separate files that needed to be updated.

    I have absolutely no doubt that all files could be condensed to a single file, or that I've gone overboard. But I also reasoned that any changes to the official Unity shader would be easier to spot if the two sets of files more closely resembled each other.

    The Editor file also includes the extra "Intensity" parameter, while allows the designer to determine how much of the vertex colour is actually applied to the object. In the two images in my previous post, you can see the result of 1.0 Intensity and 0.3 Intensity.

    In regards to the Shader Graph issue, I received a response two or three days ago, asking if I could supply a test project they could run that demonstrated the issue. I thought that a little strange, considering it was a basic project with the appropriate packages added, and a single model with vertex colouring added. So, I'll get around to jumping through that hoop. I'll also test to see whether or not the new SRP/Shader Graph has the same issue when running on iOS. It might have already been fixed. I just haven't gotten around to building a test yet. In fact, I'll do that now, and see if it's still an issue in 2018.2.0b1. The Light Weight SRP doesn't support the Post Processing v2 Ambient Occlusion though, so even if the Shader Graph vertex colour solution works on iOS, I'm still not likely to use it.

    As I'm targeting iOS exclusively, all my efforts have been to get it working on that platform with Metal API. So, it may or may not work on different devices and graphics APIs.
     
    Alverik likes this.
  30. Alvarezmd90

    Alvarezmd90

    Joined:
    Jul 21, 2016
    Posts:
    149
    I am so glad this exists. Great stuff! :)
     
    Last edited: Apr 26, 2018
    VOTRUBEC and ASFghost like this.
  31. assertivist

    assertivist

    Joined:
    Aug 21, 2016
    Posts:
    3
    Just wanted to pile on and say that I also look for vertex color support in an engine like Unity.

    @VOTRUBEC I've applied your shader with success on Windows. I'm waiting to hear back from my macOS and linux testers. But I assume since you've got it working with iOS that it should work on macOS as well... We'll see. Thank you so much for sharing this with us.
     
    VOTRUBEC likes this.
  32. cxode

    cxode

    Joined:
    Jun 7, 2017
    Posts:
    268
    @VOTRUBEC Thank you so much for sharing this shader. I'm trying to get it to work, but in both 2018.1f2 and 2018.2b2 I get this error:

    Shader error in 'Standard_VC': invalid subscript 'uv2' at Assets/UnityStandardMeta_VC.cginc(23) (on d3d11)
    Thankfully, the shader seems to work fine. However, it's under the category "failed to compile" when selecting a shader for a material in the inspector. What's going on? Should I be worried about this?

    Edit: when I try to build a project with the shader, I get tons of errors saying "The type or namespace 'MaterialProperty' could not be found" and the build fails :(
     
    Last edited: May 4, 2018
  33. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    What platform and graphics API are you targeting? I'm running 2018.2.0b1, so I'm wondering if 2018.2.0b2 has changed the shaders yet again. From memory, uv2 is defined if UNITY_PASS_META is set.

    As for MaterialProperty, that's in the Shader GUI (Standard_VCShaderGUI.cs). Did you move that file out of the Editor folder, because it shouldn't be included in a build (Unity won't include files in Editor folder in builds).
     
    cxode likes this.
  34. cxode

    cxode

    Joined:
    Jun 7, 2017
    Posts:
    268
    @VOTRUBEC ah, that was it, thank you so much! Somehow my Editor folder got renamed to "Editor 1" when I was importing the assets. Renaming it fixed the issue and allowed me to build without issue :) The build was for Windows 64 bit on dx11.
     
  35. GaZnoDrone

    GaZnoDrone

    Joined:
    Mar 3, 2015
    Posts:
    28
    the material is just pink on 2017.3.0f . Whats the problem. Please help.
    I get This error:
    Shader error in 'Standard (Vertex Color)': invalid subscript 'tangentToWorldAndPackedData' at Assets/Shaders/UnityVC/UnityVC.cginc(119) (on d3d11)

    Compiling Vertex program with DIRECTIONAL
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
     
    Last edited: May 11, 2018
    Alvarezmd90 likes this.
  36. Alvarezmd90

    Alvarezmd90

    Joined:
    Jul 21, 2016
    Posts:
    149
    Which version of Unity are you running? I recommend you to look through the topic more thoroughly. I'm using the 5.6 version from Github.
     
    Last edited: May 11, 2018
  37. Alvarezmd90

    Alvarezmd90

    Joined:
    Jul 21, 2016
    Posts:
    149
    Lol to be honest. While I've only been importing files with existent Vertex colours.. I have run into a problem.
    My question is, which program is best for painting vertex colours with alpha? It seems Blender doesn't support it frickin' 2018.
     
  38. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    I looked in to Alpha colour values in Blender as well! I couldn't believe there was no option to save the colours as RGBA! There is a hack specifically for Unity, that saves the colour into one vertex colour group, and the alpha into another group, or something like that, and when it's imported in to Unity it merges the two groups into a single colour, but I saw what a train wreck it was and never tried it.

    If you find a good solution, I'd love to hear it. Even if it means modelling in Blender, then colouring in another program.
     
    Alvarezmd90 likes this.
  39. Alvarezmd90

    Alvarezmd90

    Joined:
    Jul 21, 2016
    Posts:
    149
    Last edited: May 14, 2018
    yahodahan and Alverik like this.
  40. krassemanne

    krassemanne

    Joined:
    Jun 27, 2015
    Posts:
    8
    Ugh, reading this thread makes me sad. I also want a vertex color shader but it seems to be impossible to get it to work during upgrades. I'll just give up and generate a texture instead, which is possible in my solution.

    Thank you all for sharing this so I can give up in time!
     
  41. leci

    leci

    Joined:
    Nov 19, 2012
    Posts:
    8
    I'm not giving up. Many modern games still use vertex colors for different techniques...

    What about having the RGB channels of a texture for detail, normals, AO, while assigning color with Vertex color?

    We have a nice contendant software that allows this kind of trickery, so Unity should be also capable of.
     
  42. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    400

    I have the same issue in 2017.3.1f1
     
  43. Lynxed

    Lynxed

    Joined:
    Dec 9, 2012
    Posts:
    121
    Same issue in 2018.1.1f1
     
  44. VOTRUBEC

    VOTRUBEC

    Joined:
    Dec 17, 2014
    Posts:
    98
    Which shader version are you using? There's currently three(?) in this thread. The original one, the one that Masolnar update and has on Git, and the one I hacked together that currently works on 2018.
     
  45. Lambastard

    Lambastard

    Joined:
    Feb 12, 2013
    Posts:
    5
    Running 2017.3.1f1 Personal Edition, I get the following error:

    Shader error in 'Standard_VC': unrecognized identifier 'UNITY_LIGHTING_COORDS' at Assets/Resources/Shaders/VertexColoredDefaxer/UnityStandardCore_VC.cginc(368) (on d3d11)

    Compiling Vertex program with DIRECTIONAL SHADOWS_SCREEN _VERTEXCOLOR_OFF
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_RGBM_ENCODING


    Your shader is pretty ace when it works, so I'm sad that it keeps breaking with every other update.
     
  46. strawberrydoll

    strawberrydoll

    Joined:
    Jan 15, 2014
    Posts:
    43
    Sorry to semi-necro this thread, I've been using this shader and it broke from my large jump from Unity 5.3 to 2018.2.8f1 (I required a few of the new features)
    I've managed to fix it so it works with 2018.2.8f1, this is an small change from Votrubec's github so all credit should go to them. It's attached to this post so you might need to sign in to see the link.
     

    Attached Files:

  47. Tzan

    Tzan

    Joined:
    Apr 5, 2009
    Posts:
    733
    Thanks for helping!
     
  48. tripknotix

    tripknotix

    Joined:
    Apr 21, 2011
    Posts:
    744
    Did you start from a 2018.2.8f1 base? or from 5.3 base?
     
  49. strawberrydoll

    strawberrydoll

    Joined:
    Jan 15, 2014
    Posts:
    43
    I started from Votrubec's github which is available at https://github.com/Votrubec/VertexShader and updated the relevant shaders using the 2018.2.8f1 built-in shaders on the Unity download page as a point of reference. I completely replaced the previous 5.3 shaders.
     
  50. bossa_dave

    bossa_dave

    Joined:
    Jan 5, 2018
    Posts:
    2
    Even with the latest fixes, this shader was broken for me in 2018.2.8f1

    However, I realised you can achieve the same thing _very_ simply with the new shader graph and its probably less likely to break between versions!