将属性打包到纹理中,延迟渲染

发布于 2024-08-25 01:05:10 字数 225 浏览 4 评论 0原文

我正在滚动一个延迟着色器管道,并且由于需要将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

玻璃人 2024-09-01 01:05:10

也许这个链接会对您有所帮助: 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文