GL.invertCulling

Cambiar al Manual
public static bool invertCulling ;

Descripción

Select whether to invert the backface culling (true) or not (false).

This flag can "flip" the culling mode of all rendered objects. Major use case: rendering reflections for mirrors, water etc. Since virtual camera for rendering the reflection is mirrored, the culling order has to be inverted. You can see how the Water script in Effects standard package does that.

// When attached to the camera, this script
// will make all rendering be flipped "inside out",
// i.e. back faces of objects will be rendered instead
// of front faces.
using UnityEngine;

[ExecuteInEditMode] public class ExampleScript : MonoBehaviour { private bool oldCulling; public void OnPreRender() { oldCulling = GL.invertCulling; GL.invertCulling = true; }

public void OnPostRender() { GL.invertCulling = oldCulling; } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961