视频链接
Unity 如何在任意物体上自由绘制
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
public class PaintManager : Singleton
{
public Shader texturePaint;
private Material paintMaterial;
int debugUVID = Shader.PropertyToID("_DebugUV");
int positionID = Shader.PropertyToID("_Position");
int hardnessID = Shader.PropertyToID("_Hardness");
int strengthID = Shader.PropertyToID("_Strength");
int radiusID = Shader.PropertyToID("_Radius");
int colorID = Shader.PropertyToID("_Color");
int textureID = Shader.PropertyToID("_MainTex");
CommandBuffer command;
private void Awake()
{
paintMaterial = new Material(texturePaint);
command = new CommandBuffer();
command.name = "CommmandBuffer - " + gameObject.name;
}
pub