基于z距离的粒子宽度 [英] Particle width based on z distance

查看:104
本文介绍了基于z距离的粒子宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基于x和y坐标,我有一堆粒子在2D空间中漂移.只需在其x,y坐标中绘制它们,即可在每帧中更新它们的位置:

I had a bunch of particles drifting in 2D space based on x and y coordinates. Their positions were updated each frame by simply drawing them in their x, y coordinates:

pic1.DrawWidth = 3
pic1.PSet (dot(i).x, dot(i).y), vbWhite



现在,我在混合中添加了一个z尺寸.因此,我需要一个公式,用于根据每个粒子从视点(dot(i).z)的z距离来设置其绘画宽度.



Now I''ve added a z dimension to the mix. So I need a formula for setting the drawwidth of each particle based on its z-distance from the view point (dot(i).z).

pic1.DrawWidth = ???
pic1.PSet (dot(i).x, dot(i).y), vbWhite



我不是绝对的准确性.我只想给出每个粒子彼此之间的距离和远近的视觉指示.

提前谢谢.

ps.进一步想想,我想到我将不得不将抽倍宽度与x,y距离的运动的比例也考虑在内,因为距离较远的粒子将需要更多的时间才能在屏幕上移动相同的距离.那么这个比率是多少?



I''m not going for absolute accuracy. I just want to give some visual indication of the nearness and farness of each particle relative to each other.

Thanks in advance.

ps. On further thought, it occurs to me I''m gonna have to factor the same ratio of drawwidth to the motion of the x, y distances as well, as particles further away will take more time to travel the same distance across the screen. So what''s this ratio?

推荐答案

直径= Do * Zo/(Zo + Z);
Z = 0时(显示表面)的Do粒径
Zo-观察者与显示器之间的距离(比如说0.6m)
Z-深度
Diameter = Do*Zo/(Zo+Z);
where Do- particle diameter when Z=0 (display surface)
Zo - distance between an observer and the display (let say 0.6m)
Z - depth


这篇关于基于z距离的粒子宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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