DepthWithColor-D3D.fx问题 [英] DepthWithColor-D3D.fx question

查看:84
本文介绍了DepthWithColor-D3D.fx问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在查看DepthWithColor-D3D.fx中的代码并且不理解以下转换


    //删除玩家索引信息并转换为米数
    float realDepth = depth / 4000.0;


不应该是 


    float realDepth =(深度>>> 3)/ 4000.0;


更改此行后,投影图像变小了很多。不知道如何弥补这一点。是否有可能获得更多额外的解释 如何计算缩放因子和坐标?


非常感谢!

解决方案

此文件的副本除以8000.0。你确定你的副本说4000.0吗?


float realDepth = depth / 8000.0;


因为右移3和8除以相同,这实际上与以下内容相同:


float realDepth =(depth>> 3)/ 1000.0;


...但它是在一次操作中完成,这应该更快。


约翰

K4W开发



Hi,

I am looking at the code in DepthWithColor-D3D.fx and don't understand the following convertion

    // remove player index information and convert to meters
    float realDepth = depth / 4000.0;

Shouldn't it be 

    float realDepth = (depth >> 3) / 4000.0;

After I change this line the projected image becomes a lot smaller. Not sure how to compensate for this. Is it possible to get some more additional explanation how the scaling factors and coordinates are computed?

Thanks a lot!

解决方案

My copy of this file has a division by 8000.0. Are you sure your copy says 4000.0?

float realDepth = depth / 8000.0;

Since right-shift by 3 is the same as division by 8, this is effectively the same as:

float realDepth = (depth >> 3) / 1000.0;

...but it is accomplished in one operation, which should be faster.

John
K4W Dev


这篇关于DepthWithColor-D3D.fx问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆