Sign in to follow this  

Particles are getting bigger...

Recommended Posts

I`ve just implemented my particle emitter class and all works fine but the particles are getting bigger when I move away my camera! I have set SetRenderState(D3DRS_POINTSCALEENABLE, TRUE); so my understanding is that the particle size is in world units. Even when I change it to FALSE I can't see any diffrence. Is this normal? Is there any way to change it? I tried to solve this with vertex shader but particles size outputed by VS is also scalled by DX. Please help:)(SDK February 2006)

Share this post

Link to post
Share on other sites
Yes i think the answer is somewhere there. But I just can't see why my particles using any combination of A, B and C (>1) are getting bigger when I move my camera away. According to this formula :Ss = Vh * Si * sqrt(1/(A + B * De + C *( D e2 )))
(Ss - output size in camera units, De - distance from camera, Si - input size)
I think they should shrink when De is getting bigger ,not the other way. Where do I make a mistake?

Share this post

Link to post
Share on other sites
Here is my code:

m_pD3DDevice->SetFVF(SIMPLE_PARTICLE_FVF); m_pD3DDevice->SetStreamSource(0,m_pVertexBuffer,0,sizeof(SSimpleParticleVertex));

m_pD3DDevice->SetRenderState( D3DRS_POINTSPRITEENABLE, TRUE );
m_pD3DDevice->SetRenderState( D3DRS_POINTSCALEENABLE, TRUE );

float fMinSize = 1.0f;//ma byc tak
m_pD3DDevice->SetRenderState( D3DRS_POINTSIZE, *((DWORD*)&m_fSizeMin)); m_pD3DDevice->SetRenderState( D3DRS_POINTSIZE_MIN,*((DWORD*)&fMinSize)); m_pD3DDevice->SetRenderState(D3DRS_POINTSIZE_MAX,*((DWORD*)&m_fSizeMax));
fMinSize = 0.0f;//ma byc tak
m_pD3DDevice->SetRenderState( D3DRS_POINTSCALE_A, *((DWORD*)&fMinSize));
fMinSize = 0.0f;
m_pD3DDevice->SetRenderState( D3DRS_POINTSCALE_B, *((DWORD*)&fMinSize));
fMinSize = 1.0f;
m_pD3DDevice->SetRenderState( D3DRS_POINTSCALE_C, *((DWORD*)&fMinSize));



Now as I look at it I think that the particles are not scalled and stays in camera units (so when I move away they seem to be getting bigger comparing to other objects) . But why? Is it some stupid mistake of mine?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this