本文介绍了点精灵的缩放(Direc3D 9)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我我应该为D3DRS_POINTSCALE_A,D3DRS_POINTSCALE_B,D3DRS_POINTSCALE_С设置什么值以指向像场景中其他对象一样缩放的精灵。参数A = 0 B = 0和C = 1(由F. D. Luna提出)不适用,因为缩放比例不够精确,粒子(点精灵)之间的距离可能大于其应有的距离。如果将点精灵替换为广告牌,则粒子的比例是正确的,但渲染速度要慢得多。请为我提供帮助,因为为我的任务渲染粒子的速度非常重要,但是其比例的精确度也非常重要。

Tell me please what values should ​​I set for D3DRS_POINTSCALE_A, D3DRS_POINTSCALE_B, D3DRS_POINTSCALE_С to point sprites scaled just like other objects in the scene. The parameters A = 0 B = 0 and C = 1 (proposed by F. D. Luna) not suitable because the scale is not accurate enough and the distance between the particles (point sprites) can be greater than it should be. If I replace the point sprites to billboards, the scale of the particles is correct, but the rendering is much slower. Help me please because the speed of rendering particles for my task is very important but the precise of their scale is very important too.

Direct3D根据以下公式计算屏幕空间点大小:
我不明白应该为A,B设置什么值, C到缩放比例正确

Direct3D computes the screen-space point size according to the following formula:MSDN - Point Sprites I can not understand what values ​​should be set for A, B, C to scaling was correct

PS抱歉我的英语是我来自俄罗斯

P.S. Sorry for my english I'm from Russia

推荐答案

Directx使用此功能来确定点的缩放大小:

Directx uses this function to determine scaled size of a point:

out_scale = viewport_height * in_scale * sqrt( 1/( A + B * eye_distance + C * (eye_distance^2) ) )

eye_distance生成者:

eye_distance is generated by:

eye_position = sqrt(X^2 + Y^2 + Z^2)

回答您的问题:

D3DRS_POINTSCALE_A是常数

D3DRS_POINTSCALE_A is the constant

D3DRS_POINTSCALE_B是线性元素(标度eye_distance),并且

D3DRS_POINTSCALE_B is the Linear element (scales eye_distance) and

D3DRS_POINTSCALE_C是二次元素(标度eye_distance平方)。

D3DRS_POINTSCALE_C is the quadratic element (scales eye_distance squared).

这篇关于点精灵的缩放(Direc3D 9)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 08:37