Fade By Depth 示例
This material graph sample demonstrates how to implement an effect of fading by depth.此材质图表示例演示了如何实现按深度衰减的效果。
The Mesh Transparent PBR material has white albedo color and the emission color controlled via the Parameters panel, the resulting appearance is controlled by opacity.Mesh Transparent PBR 材质具有白色反照率颜色和通过 Parameters 面板控制的发射颜色,生成的外观由opacity控制。
Resulting Opacity is defined by the combination of:结果 Opacity 由以下组合定义:
- the Fresnel effect (glow in the areas along the edges). Here we find the angle between the mesh’s surface normal and view direction using the Dot Product node, which looks like a “glow” around the edge of the object. We can increase the Fresnel Power input to make this glow thinner and closer to the edges.菲涅耳效应(沿边缘区域发光)。在这里,我们找到了网格表面之间的角度普通的和查看方向使用 Dot Product 节点,它看起来像围绕对象边缘的“发光”。我们可以增加 Fresnel Power 输入以使这种辉光更薄且更靠近边缘。
- data on intersected geometry of the scene (shield contours shall be projected onto intersected geometry). Here we’ll handle the intersection effect with scene geometry. Via the Texture Buffer Depth Opacity node we get Scene Depth and subtract the object's depth (the distance to the Vertex Position in the view space), then we saturate the result in the [0.0f; 1.0f] range and subtract it from 1 to get an inverse intensity. This gives us values close to 1 in the area of intersection with the geometry of other objects. At this point we can add a Power node to be able to control the intensity using a value provided by a Slider node (enabling you to adjust float values via the Parameters panel in UnigineEditor).场景的相交几何数据(屏蔽轮廓应投影到相交几何上)。在这里,我们将使用场景几何处理相交效果。 通过 Texture Buffer Depth Opacity 节点我们得到 Scene Depth 并减去对象的深度(到视图空间中 Vertex Position 的距离),然后我们饱和[0.0f; 1.0f] 范围内的结果和减去它从 1 得到反强度。 这在与其他对象的几何形状相交的区域中为我们提供了接近 1 的值。此时,我们可以添加一个 Power 节点,以便能够使用 Slider 节点提供的值来控制强度(使您能够通过 UnigineEditor 中的 Parameters 面板调整浮点值)。
Both these components are added together and saturated.这两个组件都是添加一起和饱和的.
The result结果
最新更新:
2024-08-16
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)