![]() The grass blades will be colored via a gradient map using their custom-assigned vertex colors and they’ll also have an additional color from the wind, giving a glossy impression as they sway around.The grass blades will sway based on a displacement texture, resembling motion via wind.Depending on the distance from the camera, the shader will generate less grass blades, for some minor optimization.The shader also calculates new UV coordinates for the generated grass blades.The set maximum number of grass blades for now is 15. The shader generates a variable number of grass blades per triangle in random positions, heights and orientations.Shader overviewīefore checking out the code, I’ll first do a quick rundown of what this specific shader does and how it does it. It goes without saying that in order to follow some concepts of this shader it’s quite important to check the previous tutorial first, as I won’t be going too much in depth in some of the more basic concepts I already covered. Besides, I learned how to do some of the lighting stuff from that tutorial myself. In the next part we’ll add that stuff and some more, but if you’re in a hurry to see how to add these stuff, I highly suggest Roystan’s grass shader tutorial. The shader I’ll be showing here is more on the stylized side, and is actually completely unlit and unresponsive to shadows. The result obviously depends on the work you put in the effect. In the previous tutorial we saw some stuff around geometry shaders, which have a lot of really interesting applications, and grass shaders is one of the most popular ones! Grass shaders, like water shaders, can be infinitely fun and you can pursue any level of physical accuracy you want, from something toony or stylized to something realistic af.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |