草地渲染系列
Grass Rendering Series

原始链接: https://hexaquo.at/pages/grass-rendering-series-part-1-theory/

本文介绍一个关于草地渲染的多部分系列教程,强调在深入实现之前理解草地视觉属性的重要性。关键特性包括单个叶片上的镜面高光产生的光泽度和半透明特性,这需要与不透明表面不同的渲染方法。 草地的外观还受到高度和颜色不均匀性的影响,自阴影也极大地提升了视觉细节。文章接下来探讨了在3D图形中描绘草地的方法:纹理贴图到地形(适用于短草),广告牌(在平面面上渲染草地图像,效率高,但近看可能显得扁平),以及完整的几何体(单个3D叶片,能够提供最逼真的效果,尤其适用于高草)。现代硬件允许使用完整的几何体来渲染草地,从而实现诸如《对马岛之魂》中看到的那些效果。下一部分将介绍如何在Godot中创建和着色完整的几何体草地。

Hacker News上关于“草地渲染系列”的帖子总结如下: 该帖子链接到一系列关于草地渲染技术的文章。一些评论者提供了额外的资源:Acerola的关于草地渲染的YouTube系列视频和SimonDev的视频教程,后者因其清晰性而受到赞扬,并启发了一个Lua/GLSL草地实现。 一位用户表达了对具有多种草类的游戏的兴趣,并将其与现实世界的牧场生态系统进行了比较。其他人指出,即使使用了先进的渲染技术,例如对单个草叶进行风和物理模拟,游戏中也普遍缺乏动态的自然环境。Remedy关于《Alan Wake 2》植被系统的演讲被分享作为一个资源。该帖子还提到了对植被感兴趣的开发者往往会使用复杂的算法进行过度设计的倾向。最后,一位评论者分享了Emily Brontë诗歌中相关的一段节选。

原文

This is part 1 of a multi-part series on grass rendering. We’ll start by figuring out how realistic grass should look like, and how herbage can be modeled with the tools we have at our disposal in real-time 3D graphics. Then, we’ll look at how to implement different methods of grass rendering in Godot. However, most of the tutorial will not be Godot-specific aside from some node names and syntax.

But before getting into any implementation details, we must first understand what grass even looks like.

What Does Grass Look Like?

Some of the visual properties are quite surprising if you have never really paid attention to them. For one, grass is shiny, especially long grass. Check out the specular hightlights in this example:

Free Expansive view of a lush green grass field, perfect for nature themes. Stock Photo

Although the random orientations of all the individual grass blades causes quite a rough appearance when looking at an entire field of grass - the specular highlights average out into a diffuse noise - the individual blades actually have quite strong specular reflections, and when looking at a field of grass against the sun, it is more shiny than you might intuitively think.

Secondly, grass is translucent. In fact, most herbage and foliage is quite translucent. In technical terms, translucency means that when the object is lit, it is also bright on the other side of its surface (although that light may look different, e.g. more diffuse and with a stronger color). This might seem obvious for grass, but it means we need to use an entirely different logic than what we usually do for rendering, since we usually assume that surfaces are hard and light does not go through them.

Free Macro shot of lush green grass with sunlight creating a warm, serene atmosphere. Stock Photo

When looking at an entire field of grass, we see large patterns which affect multiple individual blades of grass that are next to one another. Grass is patchy: depending on environmental conditions, micro-relief, etc., patches of grass with different heights and different shades of green emerge.

Free Scenic rural landscape with lush green hills and clouds in Samsun, Türkiye. Stock Photo

Related to this patchiness, we see structure and detail mostly because grass is self-shadowing. The tips of grass are often brightly lit, especially those of larger stalks or tufts, whereas the bottom part is dark because it is occluded by all the surrounding grass. Similarly, we may be able to see some shadowing on the side of tufts when the sun is at a steeper angle.

Free Expansive green field with dramatic clouds and bright sky, depicting rural serenity. Stock Photo

How to Depict Grass in 3D Graphics?

Now we know what grass looks like, but we haven’t talked about a fundamental question when it comes to translating grass into 3D graphics: what kind of method would we even use to depict it?

Different games from different times have come to different conclusions here. In most older games, grass is simply textured onto the terrain:

OoT_Link_in_Hyrule_Field.jpg

This makes sense: when every vertex counts, you don’t want to add any vertices for something as insignificant as grass when you can just draw it onto the terrain. Even in modern games, this may be fine for very short grass, especially with techniques like bump mapping. However, tall grass will never look right with this method. This is why games have started adding actual objects for grass. There are two ways to do this:

Billboards render an image of multiple stalks of grass onto a plane. This is the oldest and still a very common, if not most common, way to depict grass. It takes just a few vertices and a texture to get a seemingly high-detailed tuft of grass. Here’s how grass looks in Horizon: Zero Dawn, along with the underlying geometry:

image.png

This method is great and, especially at a distance, sufficient for high realism. However, when grass is tall and very close by, the flatness of the billboards can start to become obvious. In addition, animating these billboards will never look like proper, individual grass blades moving in the wind. That is why some games use actual geometry for individual grass blades. This is easier in games with a cartoon art style, since grass blades can be quite tall and plainly colored there. Zelda: Breath of the Wild is a good example:

botwgrassRS.jpg

Probably the state-of-the-art of realistic (even if somewhat painterly) geometry-based grass is Ghost of Tsushima:

maxresdefault.jpg

These games get a lot of their aesthetic from their grass, and only such games with full-geometry grass stalks can give you that feeling of being properly inside a field of tall grass.

Modern GPU hardware doesn’t care as much about the amount of vertices as older hardware did, so full-geometry grass is quite feasible nowadays. So in the next post, I will show how to create full-geometry grass in Godot; how to practically and efficiently fill a field with grass stalks, and how to shade them in a way that fulfills the criteria we set above: Grass Rendering Series Part 2: Full-Geometry Grass in Godot

联系我们 contact @ memedata.com