码迷,mamicode.com
首页 > 其他好文 > 详细

GPU instancing

时间:2018-09-18 20:44:50      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:star   实例   rop   shader   data   logs   bsp   http   rar   

参考

https://www.cnblogs.com/hont/p/7143626.html

github地址

https://github.com/yingsz/instancing/

补充2点:

1怎么add per instancing objet data

代码里使用set*Array,比如

mat.SetVectorArray("LightMapOffSets", lightmapOffSet);

  shader里面使用这个lightmapoffset,如下

sampler2D Lightmap;
UNITY_INSTANCING_CBUFFER_START(LightMapOffSets)
    UNITY_DEFINE_INSTANCED_PROP(half4, _OffSet)
UNITY_INSTANCING_CBUFFER_END

  取值的地方

half4 offset = UNITY_ACCESS_INSTANCED_PROP(_OffSet);

2支持lightmap

感谢Solar Rain同学的提醒

技术分享图片

这个之前有个误区,以为烘焙后每个实例的uv2不一样,其实是一样。

 

GPU instancing

标签:star   实例   rop   shader   data   logs   bsp   http   rar   

原文地址:https://www.cnblogs.com/marcher/p/9671009.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!