Shader在地上画个圆
来源:互联网 发布:淘宝天猫优惠券宣传语 编辑:程序博客网 时间:2024/04/28 07:26
圈移动,访问修改shader的属性
using UnityEngine;[ExecuteInEditMode]public class Radius : MonoBehaviour { public Material radiusMaterial; public float radius = 1; public Color color = Color.white; // Use this for initialization void Start () {} //每帧更新shader中的参数值// Update is called once per framevoid Update () { radiusMaterial.SetVector("_Center", transform.position); radiusMaterial.SetFloat("_Radius", radius); radiusMaterial.SetColor("_RadiusColor", color); }}
Properties {_Color("Color", Color) = (1,1,1,1)_MainTex("Albedo (RGB)", 2D) = "white" {}_Center("Center", Vector) = (0,0,0,0)_Radius("Radius", Float) = 0.5_RadiusColor("Radius Color", Color) = (1,0,0,1)_RadiusWidth("Radius Width", Float) = 2}SubShader {Tags { "RenderType"="Opaque" }LOD 200CGPROGRAM// Physically based Standard lighting model, and enable shadows on all light types#pragma surface surf Standard fullforwardshadows// Use shader model 3.0 target, to get nicer looking lighting#pragma target 3.0sampler2D _MainTex;fixed4 _Color;float3 _Center;float _Radius;fixed4 _RadiusColor;float _RadiusWidth;struct Input {float2 uv_MainTex;float3 worldPos;};void surf(Input IN, inout SurfaceOutputStandard o) {float d = distance(_Center, IN.worldPos);if (d > _Radius && d < _Radius + _RadiusWidth)o.Albedo = _RadiusColor;elseo.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb;}ENDCG} FallBack "Diffuse"
阅读全文
0 0
- Shader在地上画个圆
- 铺在地上的历史
- 那妇人被按压在地上 水浒传
- 上周技术关注:铺在地上的历史
- 妈妈,太空植物园的植物为什么长在地上啊
- U3D 小球跟随鼠标在地上滚动(一)
- U3D 小球跟随鼠标在地上移动(二)
- 当我坐在地上时,我在想什么
- 传奇物品在地上显示,红字,自动拾取文件
- 地上地下
- [故事]切·格瓦拉:他的国不在地上,也不在天上
- 把n个骰子扔在地上,所有骰子朝上一面的点数之和为S
- 客轮船长逃生后在地上晒纸钞 大喊“钱是我的”
- 船长逃生后在地上晾晒纸钞 大喊“钱是我的”
- 骂老板,就是站在地上往25楼吐口水
- 在cocos2d中使用shader
- 在Unity中使用Shader
- 在Shader修改Depth Value
- android webview中嵌套的h5页面下载apk
- 文章解析整理:《基于TensorFlow理解三大降维技术:Pca,t-SNE 和自编码器》
- C# TreeView
- 复杂链表复制
- Android 线程池—ThreadPoolExecutor理解与使用
- Shader在地上画个圆
- Xshell
- 【Unity】ios平台导出Xoce项目打包成ipa过程(图文详尽版)
- Hive数据导出三种方式
- 内部字段计数是什么,SetInternalFieldCount使用的是什么?
- 网络工具类封装
- struts.xml的常用配置
- 异常处理基本概念和类别细分
- Java 抽象类与oop三大特征