Skip to content

Instantly share code, notes, and snippets.

mode out color out alpha
-------------- -------------- -----------
layer/over: ( sc+(1-sa)*dc , sa+da-sa*da )
multiply: ( sc*dc , sa+da-sa*da )
screen: ( sa*da - (da-dc)*(sa-sc) , sa+da-sa*da )
lighten: ( max(sa*dc,sc*da) , sa+da-sa*da )
darken: ( min(sa*dc,sc*da) , sa+da-sa*da )
add: ( min(dc+sc,1) , min(sa+da,1) )
subtract: ( max(dc-sc,0) , min(sa+da,1) )
difference: ( abs(sa*dc-sc*da) , sa+da-sa*da )
@MattRix
MattRix / SimpleGraphic.cs
Last active February 4, 2023 07:47
How to draw a custom mesh in a UI.Graphic
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
[RequireComponent(typeof(CanvasRenderer))]
public class SimpleGraphic : MaskableGraphic //could extend Graphic if you don't need it maskable
{
public Texture texture;
public override Texture mainTexture