当前位置:网站首页>Unity在URP管线下使用TriLib插件加载模型材质不正确的问题
Unity在URP管线下使用TriLib插件加载模型材质不正确的问题
2022-07-23 05:45:00 【代码写久了眼睛不舒服】
目前使用Unity开发项目绝大部分已经使用URP渲染管线,但是TriLib加载进来的模型默认的还是使用内置渲染管线的材质,这会导致材质无法正常显示,解决办法如下:
1、在Assets目录下新建一个AssetLoaderOptions的ScriptObejct文件:如下图
2、新建一个UniversalRPMaterialMapper的ScriptObejct文件:如下图
3、现在你会得到两个文件,确认无误后继续
4、点击AssetLoaderOptions,选择Materials,将UniversalRPMaterialMapper文件添加到Material Mappers中
5、到这一步再次加载准备好的模型就已经可以正常显示材质了。
但是还会出现贴图压缩的错误。因为这个插件要求的是贴图宽高需要是4的倍数,如果不符合标准就会报错,我们可以再次设置,如下图
在Texture选项里选择不压缩,就可以了。
6、加载模型,我是用的下面这个API ,从硬盘上加载的
AssetLoader.LoadModelFromFile(path, null, LoadEndCallBack, null, null, parent, assetLoaderOptions);
path:路径
LoadEndCallBack:加载完成的回调函数
parent:父物体GameObject类型
assetLoaderOptions:上面创建的AssetLoaderOptions文件,为了方便我是放到Resources文件夹下,用Resources.Load<>()
函数
工作环境:
Unity2021.3.2f1c1
TriLib 2
全文结束
边栏推荐
猜你喜欢

C语言小项目——学生成绩管理系统

【基于UDS服务的BootLoader架构和刷写流程】

Question bank of basic principles of steel structure

Interpretation of the paper: develop and verify the deep learning system to classify the etiology of macular hole and predict the anatomical results

【AUTOSAR COM 1.通信协议栈介绍】

Redis——配置及应用

【学习总结】
![[AUTOSAR com 1. introduction to communication protocol stack]](/img/ed/e61ca1e37817a81fc6eada54192876.png)
[AUTOSAR com 1. introduction to communication protocol stack]

堆的实现与堆排序实现

Enter the triangle side length and calculate the area
随机推荐
嵌入式从入门到精通(入土)——超详细知识点分享3
5.4 Pyinstaller库安装与使用
Interpretation of the paper: "deep-4mcw2v: sequence based predictor for identifying N4 methylcytosine (4mc) sites in E. coli"
(1)ASIO
Embedded from entry to mastery (buried) - sharing of ultra detailed knowledge points 2
基于对象(Object Based)-两个经典类
Prometheus
APISIX的源码安装与使用
【AUTOSAR COM 1.通信协议栈介绍】
3.2daydayup draw inferences from one instance: three days of fishing and two days of net learning
Interpretation of the paper: recognition of enhancer promoter interactions with neural networks based on pre trained DNA vectors and attention mechanisms
Uni native plug-in development -- Youmeng one click login
【AUTOSAR DCM 1.模块简介(DSL,DSD,DSP)】
Doubts about using the incluxdb database
Awk programming language
【学习总结】
鋼結構基本原理複習
Blog building five: drawing bed selection
Dicom开源工具库
socket基础知识以及各种使用场景