Jump to content

  • Log In with Google      Sign In   
  • Create Account


3D projection problem => oval circle


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 ManicPumpkin   Members   -  Reputation: 100

Like
0Likes
Like

Posted 28 March 2012 - 10:26 AM

Hello,

I've builded a 3D particle system that blows particles in different directions beginning with a particle circle in the middle of the screen.
It works perfect, but I got a realy strange effect.

If I set my projection command like this (look at D3DXToRadian):
D3DXMatrixPerspectiveLH(&tMatrixProjection, D3DXToRadian(45), (FLOAT) SCREEN_WIDTH / (FLOAT) SCREEN_HEIGHT, 1.0f, 100.0f);

The effect is:
Posted Image

But if I set it (D3DXToRadian) to 90 degree:
D3DXMatrixPerspectiveLH(&tMatrixProjection, D3DXToRadian(90), (FLOAT) SCREEN_WIDTH / (FLOAT) SCREEN_HEIGHT, 1.0f, 100.0f);

I got the desired effect:
Posted Image

I initiate my particles once, before I enter the "game loop".
After that, I re-initiate my particles if the radian is greater than 10.
Code here:
// ******************************************************************************************************
void cParticleSystem::initiate()
{
VERTEX *tVertex;
srand(100);
mRadius  = 0.1f;
mPBuffer->Lock(0, 0, (void**)&tVertex, 0);
for(int i=0; i<mCount; i++)
{
  tVertex[i].position.x = ((float)rand()) / RAND_MAX - 0.5f;
  tVertex[i].position.y = ((float)rand()) / RAND_MAX - 0.5f;
  tVertex[i].position.z = ((float)rand()) / RAND_MAX - 0.5f;
  D3DXVec3Normalize(&tVertex[i].position, &tVertex[i].position);
  tVertex[i].color  = D3DCOLOR_ARGB(255, (int)(128*(tVertex[i].position.x+1)), (int)(128*(tVertex[i].position.y+1)), (int)(128*(tVertex[i].position.z+1)));
  tVertex[i].position  = mRadius * tVertex[i].position;
}
mPBuffer->Unlock();
}
// ******************************************************************************************************
void cParticleSystem::blowup()
{
VERTEX *tVertex;
mRadius  *= 1.1f;
if(mRadius < 10)
{
  mPBuffer->Lock(0, 0, (void**)&tVertex, 0);
  for(int i = 0; i < mCount; i++)
   tVertex[i].position  = 1.1f * tVertex[i].position;
  mPBuffer->Unlock();
}
else
  initiate();
}
// ******************************************************************************************************

Can someone tell me about this effect ?
I do not quite understand this "oval effect".

Thank you,
Manic.


Some Information:
- D3D9
- Visual Studio 2010
- Windowed mode
- Resolution: 800x600

Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS