Sign in to follow this  

3D projection problem => oval circle

This topic is 2121 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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):
[code]D3DXMatrixPerspectiveLH(&tMatrixProjection, D3DXToRadian(45), (FLOAT) SCREEN_WIDTH / (FLOAT) SCREEN_HEIGHT, 1.0f, 100.0f);
[/code]

The effect is:
[img]http://dl.dropbox.com/u/29271646/radian45degree.jpg[/img]

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

I got the desired effect:
[img]http://dl.dropbox.com/u/29271646/radian90degree.jpg[/img]

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:
[code]// ******************************************************************************************************
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();
}
// ******************************************************************************************************
[/code]

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

Share this post


Link to post
Share on other sites
Sign in to follow this