d3dx 库如何将纹理保存到文件中?
当使用函数:D3DXSaveTextureToFile 并传入 D3DXIFF_BMP 来创建 bmp 时,我注意到这些值似乎是估计的,而不是具体给出的。
如果我错了,请纠正我,但浮点纹理可以在任何给定的纹素中存储任何浮点,这会将其置于卡在 rgb(255,255,255,255) 之间的 BMP 范围之外,所以看起来该函数正在做的只是简单取纹理的最高值和最低值,并在该范围之间对其进行标准化。
所以我的问题是:是否可以完全按照内存中的值获取值?包括当颜色超出计算机显示器的光谱时?
When using the function: D3DXSaveTextureToFile and passing in D3DXIFF_BMP to create a bmp I've noticed that the values seem to be estimated rather than given specifically.
Correct me if I'm wrong but a floating point texture can store any float in any given texel which would put it outside the range of a BMP which is stuck between rgb(255,255,255,255), so what it seems that the function is doing is simply taking the upper most and lowermost value of the texture and normalizing it between that range.
So my question is: Is it possible to grab the values exactly as they are in memory? including when the colours are outside of the spectruc of the computer monitor?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要使用 BMP。使用支持您想要的数据类型的格式。对于 DX 纹理,似乎
D3DXIFF_PFM< /a>
格式就是您需要的。它是这样描述的:但请注意,图像会很大。这种格式的 256x256 纹理的大小应约为 768 KB。
更新:您应该能够使用Image Magick' s display 命令可以查看这种格式的图像。此外 HDRView 支持 PFM 格式。第三种选择可能是 fv。
Don't use BMP. Use a format that supports the data type you want. For DX textures, it seems the
D3DXIFF_PFM
format is what you need. It's described like so:Note that images will be large, though. A 256x256 texture in this format should weigh in at around 768 KB.
Updates: You should be able to use Image Magick's display command to view images in this format. Also HDRView supports the PFM format. A third choice might be fv.