当前位置:网站首页>Unity shader (pass user data to shader)
Unity shader (pass user data to shader)
2022-07-07 09:25:00 【heater404】
Unity Shader( to Shader Passing user data )
Modify... By code Shader Properties in
I mentioned earlier that various types of attributes can be defined , Then you can make changes on the panel . But in fact, we can also modify it in the code .
Properties
{
_Color("I am Color", Color) = (1,1,1,1)// In turn RGBA(0-1)
_Int("I am Int", Int) = 1
}
public Material material;//Shader Where material
void Start()
{
material.SetInt("_Int", 200);
material.SetColor("_Color", new Color(0, 0, 0, 0));
}
stay Pass Define the data type in and then assign a value
Shader "Unlit/NewUnlitShader"
{
Properties
{
_Color("I am Color", Color) = (1,1,1,1)// In turn RGBA(0-1)
_Int("I am Int", Int) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
float b2;
RWStructuredBuffer<float> b5;
ENDCG
}
}
}
public class NewBehaviourScript : MonoBehaviour
{
public Material material;//Shader Where material
ComputeBuffer b5Buffer;
// Use this for initialization
void Start()
{
material.SetInt("_Int", 200);
material.SetColor("_Color", new Color(0, 0, 0, 0));
material.SetFloat("float", 998);
b5Buffer = new ComputeBuffer(24, 4);
material.SetBuffer("b5", b5Buffer);
}
}
边栏推荐
- Yapi test plug-in -- cross request
- Jenkins task grouping
- C language pointer (special article)
- How long does the PMP usually need to prepare for the exam in advance?
- Pycharm importing third-party libraries
- JMeter JDBC batch references data as input parameters (the simplest method for the whole website)
- Why is access to the external network prohibited for internal services of the company?
- [cloud native] Devops (I): introduction to Devops and use of code tool
- Pytest+request+allure+excel interface automatic construction from 0 to 1 [familiar with framework structure]
- 2021 year end summary
猜你喜欢
Difference between interface iterator and iteratable
[cloud native] Devops (I): introduction to Devops and use of code tool
章鱼未来之星获得25万美金奖励|章鱼加速器2022夏季创业营圆满落幕
C language pointer (special article)
Error: selenium common. exceptions. WebDriverException: Messag‘geckodriver‘ execute
Mysql:select ... for update
Do you have any certificates with high gold content?
Unity uses mesh to realize real-time point cloud (I)
2021 year end summary
Mysql database index study notes
随机推荐
Sublime Text4 download the view in bower and set the shortcut key
Leetcode刷题记录(数组)组合总和、组合总和 II
Information Security Experiment 3: the use of PGP email encryption software
E-commerce campaign Guide
Unity shader (data type in cghlsl)
Postman interface test (II. Set global variables \ sets)
Some pit avoidance guidelines for using Huawei ECS
Regularly modify the system time of the computer
嵌套(多级)childrn路由,query参数,命名路由,replace属性,路由的props配置,路由的params参数
Add new item after the outbound delivery order of SAP mm sto document is created?
Cesium does not support 4490 problem solution and cesium modified source code packaging scheme
4、 Fundamentals of machine learning
消费互联网的产业链其实是很短的,它仅仅承接平台上下游的对接和撮合的角色
Locust performance test 4 (custom load Policy)
Leetcode daily questions (2316. count unreachable pairs of nodes in an undirected graph)
Unity uses mesh to realize real-time point cloud (I)
【SVN】SVN是什么?怎么使用?
What are the suggestions for PMP candidates?
Huawei hcip datacom core_ 03day
Nested (multi-level) childrn routes, query parameters, named routes, replace attribute, props configuration of routes, params parameters of routes