Search Unity

Flat Lighting (FL)

Discussion in 'Assets and Asset Store' started by BogdanGochev, Jul 29, 2016.

  1. BogdanGochev

    BogdanGochev

    Joined:
    Sep 17, 2015
    Posts:
    67
    Thank you gamezuk, I have just fixed the issue and will publish the new version. Which have a couple of more fixes.
    If you need a patch before the version is released send me a message/email.
     
  2. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Hi planning to switch to LWR pipeline. Do the flat light surface shaders support LWR ? TY
     
  3. BogdanGochev

    BogdanGochev

    Joined:
    Sep 17, 2015
    Posts:
    67
    Hi, the main shader of Flat Lighting do support LWR.
    The ones that use Unity Surface currently don't work. But the point of LWR is to be more performant and the main flat lighting shaders are more performant that the Unity surfaces.
    That being said, I'm still looking into LWR and in the future I might release a special version of the Unity Surface shaders adapted to LWR as well.
     
    Last edited: Jun 15, 2019
  4. gamezuv

    gamezuv

    Joined:
    Nov 6, 2013
    Posts:
    82
    Cool. I just want to use unity's shadows with your shaders hence I want to use surface shaders. If you can make an option to enable unity shadows on main shader of Flat Lighting...that would be awesome. Thanks.
     
  5. firstuser

    firstuser

    Joined:
    May 5, 2016
    Posts:
    147
    Last edited: Jul 9, 2019
  6. BogdanGochev

    BogdanGochev

    Joined:
    Sep 17, 2015
    Posts:
    67
    That seems quite interesting. I didn't know about Material Property Block, so will explore that idea a bit and definitely add it. I will pm for some details
     
  7. firstuser

    firstuser

    Joined:
    May 5, 2016
    Posts:
    147
    Great, thanks! Sure, happy to help however I can :)
     
  8. nathansisler

    nathansisler

    Joined:
    Sep 21, 2013
    Posts:
    5
    I have a problem on Galaxy Note 10. Looks like the transparent areas in water will render as white using the water shader. I think you mentioned this, have you found any solutions?
     
  9. nathansisler

    nathansisler

    Joined:
    Sep 21, 2013
    Posts:
    5
    I did some more testing and it turns out it's not the but actually the use of the (use symmetrical Colors) variable.
     
  10. NaughtyMoleGames

    NaughtyMoleGames

    Joined:
    Jan 25, 2018
    Posts:
    51
    @BogdanGochev Is this asset still being developed or is it at its end of life? Seems it hasn't had any updates in almost a year, and not much forum traffic either.
     
  11. BogdanGochev

    BogdanGochev

    Joined:
    Sep 17, 2015
    Posts:
    67
    Hi, I have just responded to your email but will paste the response here as well for future references :

    Flat Lighting asset is not being actively developed as it's feature complete. That being said, bug fixes and features request that are relevant to the asset are still being developed and released. The asset as it is already has a lot of features (I can argue that probably has the most features from all the competitors) and I don't want to put too many half baked features on it. I prefer for it to do fewer things but really do them well.
     
    NaughtyMoleGames and firstuser like this.
  12. firstuser

    firstuser

    Joined:
    May 5, 2016
    Posts:
    147
    @PolyCurseGames Bogdan has been AMAZING with both uber-responsive support and adding new features. It's not his fault it's been stable for so long now! :) (use it in production on multiple games)

    Seriously don't hesitate to buy it.
     
    Last edited: Feb 11, 2020
  13. NaughtyMoleGames

    NaughtyMoleGames

    Joined:
    Jan 25, 2018
    Posts:
    51
    firstuser likes this.
  14. NaughtyMoleGames

    NaughtyMoleGames

    Joined:
    Jan 25, 2018
    Posts:
    51
    So, is there a way to increase the limit of 25 lights per scene?
     
  15. BogdanGochev

    BogdanGochev

    Joined:
    Sep 17, 2015
    Posts:
    67
    The limit is hardcoded for performance reasons. I can look into making it dynamically configured, but in the mean time if you tell me what type of light source you want to increase and to what number I can send you a patch.
     
  16. oliv2079

    oliv2079

    Joined:
    Jun 13, 2020
    Posts:
    6
    Hi! I am auto-generating meshes as shown in this video:

    I have a problem though, the colors are "smoothed out" instead of staying flat! :eek:
    In the first picture, the ball in the middles has the exact same material applied and is approximately as low poly as the terrain.
    For some reason, the terrain IS able to work with Flatlighting/Animated/Water, but this shader does not support world space :(
    The second picture shows the terrain with the water shader applied.

    Any ideas?

    Capture.PNG Capture.PNG
     
  17. oliv2079

    oliv2079

    Joined:
    Jun 13, 2020
    Posts:
    6
    Sorry about the giant pictures, I should have used snippets :oops:
     
  18. firstuser

    firstuser

    Joined:
    May 5, 2016
    Posts:
    147
    @oliv2079 are you sure that you assigned normals correctly?
     
  19. oliv2079

    oliv2079

    Joined:
    Jun 13, 2020
    Posts:
    6
    No, I don't know! I'll try to look into that, thank you <3
    I just make the triangles and then just go Recalculatenormals(); and then thought that would work out, do you have an idea of how to fix the normals if those are the problem?
     
  20. oliv2079

    oliv2079

    Joined:
    Jun 13, 2020
    Posts:
    6
    I also have to build models in Probuilder. I can't for example use unity's own sphere
    Capture.PNG
    Then the smoothing happens again

    It's just weird how it works with the water, but not with the normal flattenedlight shader
     
  21. oliv2079

    oliv2079

    Joined:
    Jun 13, 2020
    Posts:
    6
    Here's the same with the water shader
    Capture.PNG
     
  22. firstuser

    firstuser

    Joined:
    May 5, 2016
    Posts:
    147
    Honestly, without looking into it too deeply, this is very very likely a normals related issue on your mesh. The fact that it looks different with a water shader isn't surprising as shaders can do their own normals related logic.

    I think the water shader does it's own normal calculation because it is animating vertices, so that's why it loses the "smoothing" baked into the mesh.

    An easy way to test if your problem is normals related is for example on your current non-smooth probuilder sphere use a smoothing group that contains all the faces. That will make it look "smooth"

    And then take the unity sphere and probuilderize it, and remove all smoothing groups, you will now see it without any "smooth" blending.

    I can't comment on the recalc normals method as in the context of a procedurally generated mesh it can get a bit tricky.

    In any case good news is I don't think it's FL Lighting related at all (you would have this problem with nearly any shader) you just need to read up on normals and smoothing and how all that works more!
     
    BogdanGochev likes this.
  23. oliv2079

    oliv2079

    Joined:
    Jun 13, 2020
    Posts:
    6
    Dude(ette), thank you so much!
    I had the same problem with other shaders and I was sure that I was doing something wrong.
    I seriously need to look more into normals, they seem pretty important when working with shaders xD

    Again, thank you so much for the detailed response, you are awesome <3
     
    firstuser likes this.
  24. BogdanGochev

    BogdanGochev

    Joined:
    Sep 17, 2015
    Posts:
    67
    @firstuser very good explanation, I couldn't explain it better. Also you are very correct about the water shader, it does indeed calculate the normals in the shader.

    @oliv2079 as for the mesh creation and normals calculation, the FL asset is bundled with a utility class to create planes (intended for easier water effect creation). The file is called "FL/Scripts/Editor/CreatePlane.cs" you can check it for "inspiration" as it does create a flat mesh with correctly calculated normals for this asset.
     
    firstuser likes this.
  25. oBlissing

    oBlissing

    Joined:
    Oct 2, 2017
    Posts:
    12
    Hi! I'm just starting out with this asset and after importing the asset I'm getting the following error:

    FlatLighting\Shaders\Editor\FlatLightingShaderEditor.cs(716,40): error CS0117: 'Constants' does not contain a definition for 'Shader'


    I'm on version 2020.3.33f1
     
  26. BogdanGochev

    BogdanGochev

    Joined:
    Sep 17, 2015
    Posts:
    67

    Hi oBlissing, that is an interesting error. Seems like the asset was perhaps not imported correctly.
    Do you have a file named : FlatLighting\Scripts\Constants.cs and does it contain a class called Shader ?

    That file basically contains static strings for the various shader parameters.
     
  27. oBlissing

    oBlissing

    Joined:
    Oct 2, 2017
    Posts:
    12
    Yes, and yes. I've tried to import it again on another computer (but same project) and it gives the same error. Actually it complains about a lot of values missing in
    Constants.cs
    .

    Pasting them all below.

    EDIT: I do have a static class of my own named
    Constants
    , but that shouldn't be a problem since the class in the asset is namespaced, right?

    Code (CSharp):
    1. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(193,50): error CS0117: 'Constants' does not contain a definition for 'Shader'
    2. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(194,52): error CS0117: 'Constants' does not contain a definition for 'Shader'
    3. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(195,56): error CS0117: 'Constants' does not contain a definition for 'Shader'
    4. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(196,56): error CS0117: 'Constants' does not contain a definition for 'Shader'
    5. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(197,56): error CS0117: 'Constants' does not contain a definition for 'Shader'
    6. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(198,48): error CS0117: 'Constants' does not contain a definition for 'Shader'
    7. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(199,47): error CS0117: 'Constants' does not contain a definition for 'Shader'
    8. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(201,54): error CS0117: 'Constants' does not contain a definition for 'Shader'
    9. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(202,47): error CS0117: 'Constants' does not contain a definition for 'Shader'
    10. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(203,45): error CS0117: 'Constants' does not contain a definition for 'Shader'
    11. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(204,46): error CS0117: 'Constants' does not contain a definition for 'Shader'
    12. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(205,58): error CS0117: 'Constants' does not contain a definition for 'Shader'
    13. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(206,50): error CS0117: 'Constants' does not contain a definition for 'Shader'
    14. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(206,111): error CS0117: 'Constants' does not contain a definition for 'Shader'
    15. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(207,53): error CS0117: 'Constants' does not contain a definition for 'Shader'
    16. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(208,54): error CS0117: 'Constants' does not contain a definition for 'Shader'
    17. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(209,53): error CS0117: 'Constants' does not contain a definition for 'Shader'
    18. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(210,53): error CS0117: 'Constants' does not contain a definition for 'Shader'
    19. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(211,50): error CS0117: 'Constants' does not contain a definition for 'Shader'
    20. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(212,39): error CS0117: 'Constants' does not contain a definition for 'Shader'
    21. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(229,62): error CS0117: 'Constants' does not contain a definition for 'Shader'
    22. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(229,123): error CS0117: 'Constants' does not contain a definition for 'Shader'
    23. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(273,39): error CS0117: 'Constants' does not contain a definition for 'Shader'
    24. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(274,40): error CS0117: 'Constants' does not contain a definition for 'Shader'
    25. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(276,39): error CS0117: 'Constants' does not contain a definition for 'Shader'
    26. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(277,40): error CS0117: 'Constants' does not contain a definition for 'Shader'
    27. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(303,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    28. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(307,38): error CS0117: 'Constants' does not contain a definition for 'Shader'
    29. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(328,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    30. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(330,38): error CS0117: 'Constants' does not contain a definition for 'Shader'
    31. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(341,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    32. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(343,38): error CS0117: 'Constants' does not contain a definition for 'Shader'
    33. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(354,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    34. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(356,38): error CS0117: 'Constants' does not contain a definition for 'Shader'
    35. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(367,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    36. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(369,38): error CS0117: 'Constants' does not contain a definition for 'Shader'
    37. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(393,36): error CS0117: 'Constants' does not contain a definition for 'Shader'
    38. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(394,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    39. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(413,36): error CS0117: 'Constants' does not contain a definition for 'Shader'
    40. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(414,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    41. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(475,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    42. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(494,38): error CS0117: 'Constants' does not contain a definition for 'Shader'
    43. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(507,38): error CS0117: 'Constants' does not contain a definition for 'Shader'
    44. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(510,39): error CS0117: 'Constants' does not contain a definition for 'Shader'
    45. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(521,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    46. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(523,38): error CS0117: 'Constants' does not contain a definition for 'Shader'
    47. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(533,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    48. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(535,38): error CS0117: 'Constants' does not contain a definition for 'Shader'
    49. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(545,37): error CS0117: 'Constants' does not contain a definition for 'Shader'
    50. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(547,38): error CS0117: 'Constants' does not contain a definition for 'Shader'
    51. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(561,39): error CS0117: 'Constants' does not contain a definition for 'Shader'
    52. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(562,40): error CS0117: 'Constants' does not contain a definition for 'Shader'
    53. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(574,40): error CS0117: 'Constants' does not contain a definition for 'Shader'
    54. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(575,39): error CS0117: 'Constants' does not contain a definition for 'Shader'
    55. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(580,40): error CS0117: 'Constants' does not contain a definition for 'Shader'
    56. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(581,40): error CS0117: 'Constants' does not contain a definition for 'Shader'
    57. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(621,54): error CS0117: 'Constants' does not contain a definition for 'Shader'
    58. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(622,55): error CS0117: 'Constants' does not contain a definition for 'Shader'
    59. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(626,55): error CS0117: 'Constants' does not contain a definition for 'Shader'
    60. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(627,54): error CS0117: 'Constants' does not contain a definition for 'Shader'
    61. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(640,51): error CS0117: 'Constants' does not contain a definition for 'Shader'
    62. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(641,51): error CS0117: 'Constants' does not contain a definition for 'Shader'
    63. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(658,50): error CS0117: 'Constants' does not contain a definition for 'Shader'
    64. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(666,51): error CS0117: 'Constants' does not contain a definition for 'Shader'
    65. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(716,40): error CS0117: 'Constants' does not contain a definition for 'Shader'
    66. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(720,41): error CS0117: 'Constants' does not contain a definition for 'Shader'
    67. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(726,39): error CS0117: 'Constants' does not contain a definition for 'Shader'
    68. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(727,40): error CS0117: 'Constants' does not contain a definition for 'Shader'
    69. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(729,39): error CS0117: 'Constants' does not contain a definition for 'Shader'
    70. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(730,40): error CS0117: 'Constants' does not contain a definition for 'Shader'
    71. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(737,47): error CS0117: 'Constants' does not contain a definition for 'FlatLightingBakedTag'
    72. Assets/FlatLighting/Shaders/Editor/FlatLightingShaderEditor.cs(746,48): error CS0117: 'Constants' does not contain a definition for 'FlatLightingBakedTag'
    73.  
     
    Last edited: Jul 16, 2022
  28. BogdanGochev

    BogdanGochev

    Joined:
    Sep 17, 2015
    Posts:
    67
    Thanks for the provided information. Actually what you mentioned about the namespaces makes sense.

    The asset Constants class is inside FlatLighting namespace, but FlatLightingShaderEditor class is not, so I wonder if it gets confused and picks your Constants class. Just as an experiment, would you mind renaming your class to something else, like Constants2 and re-import to see if that solves it.
    Alternatively you can edit the FlatLightingShaderEditor.cs with :
    using Constants = FlatLighting.Constants
    to force it to use the asset Constants class from the correct namespace
     
  29. oBlissing

    oBlissing

    Joined:
    Oct 2, 2017
    Posts:
    12
    This solved the errors. Thank you! :)