-
-
Notifications
You must be signed in to change notification settings - Fork 478
Transparency Workarounds
Dale Eidd edited this page May 12, 2021
·
2 revisions
@Cotanius on Discord shared a solution (source) for solving their transparency issue by rendering the transparent object before the transparent pass.
Fixed and broken respectively.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
public class DamageRenderer : MonoBehaviour
{
CommandBuffer mCacheCommandBuffer;
public MeshRenderer testRenderer;
void OnEnable()
{
mCacheCommandBuffer = new CommandBuffer();
mCacheCommandBuffer.name = "DamageRenderCommandBuffer";
mCacheCommandBuffer.DrawRenderer(testRenderer, testRenderer.material, 0, -1);
Camera.main.AddCommandBuffer(CameraEvent.AfterSkybox, mCacheCommandBuffer);
}
void OnDisable()
{
Camera.main.RemoveCommandBuffer(CameraEvent.AfterSkybox, mCacheCommandBuffer);
mCacheCommandBuffer.Dispose();
}
}