Closed andenacitelli closed 3 years ago
Hi. Thank you for the details. First of all, Flat Kit is compatible with the minimum Unity version of 2020.3.21. It is listed on the Asset Store Page. Could you please update to the compatible version of Unity?
Regarding the vertex colors, if enabled, the final shading of the object is multiplied by the mesh’s vertex color values. It is a debug parameter, usually this is not used for changing the look.
Does the lighting work if you check the vertex colors parameter off? Could you please describe what exactly lighting are you expecting from Flat Kit to receive other than Directional light and ambient light? If possible, please share a detailed step-by-step guide on how we could replicate your case to see if something is not working?
If you are asking about the self-shadowing (cel shading), I can see it is set to 'None' on your screenshot. In this case it is set to just flat color. The shadow you've got on your example relates to the cast shadow (from other ojects). If you would like to enable the cel shading, please set the Cel Shading Mode to, for example, Single: then you'll be able to choose the shading color, how big this part is and its edge softness. Please, have a look at this chapter.
Also, please, make sure you skim through [this chapter] about lighting(https://flatkit.dustyroom.com/#312-the-additional-parameters-of-the-shader) of the online documentation.
Another quick question, have you tried setting the alpha of the shadow color to 1?
I've updated to 2020.3.21 - didn't fix anything.
Turning the vertex colors parameter off gives me no change in the lighting situation, and turns my mesh white:
I admittedly am rather inexperienced and am unsure how I would go about assigning colors to the terrain without doing it through vertex color, seeing as my terrain is entirely procedural and color is currently just being assigned via heightmap values. Please feel free to advise on the proper way to do this, or a better way to do this, if you know.
However, setting the alpha of the shadow color was my problem - I really should have figured that out way sooner, thank you. This now gives me shadows like this:
While that isn't perfect insofar as how we want shadows, it's definitely enough direction to start experimenting with the shadow settings of my renderer and similar, so (lighting wise) it's no longer a FlatKit issue.
However, I am looking for a specific kind of shading. I enabled the "Shadow Occlusion" setting on a whim and it produced this kind of lighting/shading I want for all triangles:
That gradual color shift, or small color differences per triangle, are the style I'm going for with my game. However, it only gives me that type of shading whenever the triangle in question isn't directly in view of the light, and is instead on the other side of a mountain or similar. This picture demonstrates pretty well how that shading only kicks in when something isn't directly lit:
You can see that the front edge of the mountain is all the same super light green color, whereas the back of the hill is what I'm going for, where the color is slightly different in each triangle and it leads to a nice effect. Any recommendations as to how I could accomplish that for all triangles with FlatKit, or is that just because FlatKit (correctly) sees those as all fully lit and will thus not try and change their color at all? I've figured out why it's happening as I'm typing this, just curious if you have any input. Otherwise I'll probably try and slightly randomize vertex colors, which will probably make it look as I want it to, if you don't have any ideas.
Another picture of the nice shading:
And regarding cel shading, no, I don't believe that has anything to do with what I'm going for. I messed around with the settings and it seemed to change little to nothing.
Unfortunately there is no single setting to make the mesh faces appear more distinct, the best way is to experiment with all the settings in the material and get a feel on what they are changing. I would suggest starting with the "Shadow Edge Size", "Localized Shading" and the "Height Gradient" parameters. Generally, Flat Kit is tailored for almost an "unlit" look (hence the name "Flat"), but it should be possible to get close to the lowpoly style as well.
On Thu, Nov 4, 2021 at 7:20 PM Anden Acitelli @.***> wrote:
I've updated to 2020.3.21 - didn't fix anything.
Turning the vertex colors parameter off gives me no change in the lighting situation, and turns my mesh white: [image: image] https://user-images.githubusercontent.com/30580900/140384690-c8baa9d6-5ba3-4a30-9fe9-1576a171bf08.png
I admittedly am rather inexperienced and am unsure how I would go about assigning colors to the terrain without doing it through vertex color, seeing as my terrain is entirely procedural and color is currently just being assigned via heightmap values. Please feel free to advise on the proper way to do this, or a better way to do this, if you know.
However, setting the alpha of the shadow color was my problem - I really should have figured that out way sooner, thank you. This now gives me shadows like this: [image: image] https://user-images.githubusercontent.com/30580900/140386440-444b41e3-718b-4a0c-ac72-a85c500f1fba.png
While that isn't perfect insofar as how we want shadows, it's definitely enough direction to start experimenting with the shadow settings of my renderer and similar, so it's no longer a FlatKit issue.
However, I am looking for a specific kind of shading. I enabled the "Shadow Occlusion" setting on a whim and it produced this kind of lighting/shading I want for all triangles: [image: image] https://user-images.githubusercontent.com/30580900/140387082-ec0f6495-0e50-43ec-b60c-2521c8833bef.png
However, it only gives me that type of shading whenever the triangle in question isn't directly in view of the light, and is instead on the other side of a mountain or similar. This picture demonstrates pretty well how that shading only kicks in when something isn't directly lit: [image: image] https://user-images.githubusercontent.com/30580900/140387356-5d13d373-9392-4da6-8adb-2836fc5eb36a.png
You can see that the front edge of the mountain is all the same super light green color, whereas the back of the hill is what I'm going for, where the color is slightly different in each triangle and it leads to a nice effect. Any recommendations as to how I could accomplish that for all triangles with FlatKit, or is that just because FlatKit (correctly) sees those as all fully lit and will thus not try and change their color at all? I've figured out why it's happening as I'm typing this, just curious if you have any input.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Dustyroom/flat-kit-doc/issues/60#issuecomment-961255700, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARZVF6WFKDMS6AFDQZWIIYLUKLFIJANCNFSM5HLYXXSQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
That gives me enough to work with. There's a lot I can do on the programming side regarding vertex colors as well. Thank you for your help and for the awesome shader pack!
Describe the bug I am developing a game world full of procedurally generated meshes, generated one chunk/tile at a time, based off of a Perlin noise heightmap. I am trying to implement FlatKit in order to get a low poly, flat shaded look to my game.
I am using the
Stylized Surface
shader, with the "Use Vertex Colors" option enabled (as I have my vertices set up for non-shared vertices to enable each triangle being a solid color, meaning each triangle has three vertices all set to the same color and the overall triangle is just interpolated between those three). I am using the Universal Render Pipeline.I have been unable to get any lighting working other than the basic ambient light contributed by the skybox and the directional light in the scene. The entire world just shows up garishly bright:
The planes floating in the air, with one casting a shadow onto the other, are to offer additional proof that shadows in general are set up correctly to the best of my ability otherwise.
The relevant shader options:
I have messed around with most options (including disabling vertex colors and experimenting with the FlatKit lighting settings in the shader) and no dice.
I have isolated the issue to be a FlatKit thing, and not an issue with my project configuration or how the scene is set up, as Unity's basic
Lit
shader seems to be giving me these directional shadows just fine:That flat shading where triangles that are next to each other are slightly different colors based on the lighting (almost as if the lighting was determined almost entirely by the angle between the normal vector and the direction of the directional light) is what I'm aiming for, but with color, if that makes any sense.
Another rough example of what I'm going for, if it clarifies anything:
Is this behavior possible with FlatKit, or am I misunderstanding the capabilities of this shader pack?
Unity details: