将属性打包到纹理中,延迟渲染
我正在滚动一个延迟着色器管道,并且由于需要将 G 缓冲区保持为统一格式,因此需要压缩属性。遗憾的是,我无法找到一些关于如何实际完成此操作的好信息。
我有一个 G 缓冲区格式,每个组件以定点格式使用 16 位。遗憾的是,由于我的目标是着色器模型 3 硬件,因此无法使用位运算符。那么,基本上,如何将 0..1 范围内的 2 个 8 位值打包到同样在 0..1 范围内的单个 16 位通道中?最好适用于 CG 或 HLSL。
I'm rolling a deferred shader pipe, and due to the need to keep the G-buffers in a unified format a need to compress attributes is needed. I've sadly been unable to find some good information on how this actually is done.
I have a G-buffer format that uses 16 bits per component in a fixed point format. Sadly as I target shader model 3 hardware I can't use bit operators. So, basically, how does one go about to pack 2 8 bit values in the 0..1 range into a single 16 bit channel, also in the 0..1 range? Preferably applicable to either CG or HLSL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许这个链接会对您有所帮助: http://www.gamedev.net/topic/534283-hlsl-pack-two-values-into-one-component-of-a-4x16_unorm-target/
但是根据我的经验我会说包装成本很高。我使用更多的多渲染目标(MRT)来保存数据,这对我来说效果很好。
Maybe this link will help you: http://www.gamedev.net/topic/534283-hlsl-pack-two-values-into-one-component-of-a-4x16_unorm-target/
But by my experience i would say the packing costs are high. I use more Multiple Rendertargets (MRT) to save the data and this works fine for me.