当前位置:网站首页>Legend has it that setting shader attributes with shader ID can improve efficiency:)
Legend has it that setting shader attributes with shader ID can improve efficiency:)
2022-06-11 04:32:00 【ttod】
Legendary use Shader Of ID To set up Shader Attributes can improve efficiency :)
In fact, I just want to know more about using Shader Methods :D
The test code used is as follows :
using UnityEngine;
public class Test : MonoBehaviour
{
[SerializeField]
MeshRenderer render;
int baseColorID;
void Start()
{
baseColorID = Shader.PropertyToID("_BaseColor");
}
void Update()
{
Vector3 pos = render.transform.position;
float r = Mathf.Abs(pos.x - (int)pos.x);
float g = Mathf.Abs(pos.y - (int)pos.y);
float b = Mathf.Abs(pos.z - (int)pos.z);
render.material.SetColor(baseColorID, new Color(r, g, b));
}
}Whether the efficiency is improved or not , It can be used in this way anyway :D
Make complaints about it ,Mathf There is no way to take decimals , It makes me subtract my own rounding from decimals .
边栏推荐
- 2021 5g aiot annual innovation achievements! release!
- Product milestones in May 2022
- golang泛型:generics
- Sharing of precautions for the construction of dioxin laboratory in Meizhou
- Guanghetong 5g module fg650-cn and fm650-cn series are produced in full scale, accelerating the efficient implementation of 5g UWB applications
- 超简单 CameraX 人脸识别效果封装
- JVM(1):介绍、结构、运行和生命周期
- Unity 地图映射
- 给你一个项目,你将如何开展性能测试工作?
- Zhongang Mining: fluorochemical industry is the main consumption field of fluorite
猜你喜欢

Talk about data center network again

The live broadcast helped Hangzhou e-commerce Unicorn impact the listing, and the ledger system restructured the new pattern of e-commerce transactions

未來已來,5G-Advanced時代開啟

Guanghetong 5g module fg650-cn and fm650-cn series are produced in full scale, accelerating the efficient implementation of 5g UWB applications

PCB地线设计_单点接地_底线加粗

Unity 传送机制的实现

MySQL锁总结

meedu知识付费解决方案 v4.5.4源码

2022年新高考1卷17题解析

Statistical knowledge required by data analysts
随机推荐
碳路先行,华为数字能源为广西绿色发展注入新动能
The live broadcast helped Hangzhou e-commerce Unicorn impact the listing, and the ledger system restructured the new pattern of e-commerce transactions
golang泛型:generics
Commissioning experience and reliability design of brushless motor
Vulkan official example interpretation raytracing
JVM (5): virtual machine stack, stack exception, stack storage result and operation principle, stack internal structure, local variable table
Safe and borderless, Guanghe tongdai 5g module +ai intelligent security solution shines at CPSE Expo
PHP regular use case
Exness: liquidity series - order block, imbalance (II)
2022年新高考1卷17题解析
智慧工地怎样做到数字化转型?
Problems in compiling core source cw32f030c8t6 with keil5
Introduction to the development and production functions of shop facade transfer and rental applet
From the first generation of sowing to the first generation of flowers, 5g commercial "gave birth to all things" for the third anniversary
Guanghetong LTE Cat4 module l716 is upgraded to provide affordable and universal wireless applications for the IOT industry
谷歌的代码覆盖率最佳实践
梅州植物组培实验室建设资料整理
JVM (4): active and passive use of classes, internal structure of runtime data area, JVM thread description, PC register
Unity Advanced Backpack System
Overview of construction knowledge of Fuzhou mask clean workshop