Skip to main content
GameDev.net gamedev.net
🔒 Locked

3D projection problem => oval circle

Started by TheSkiD Mar 28, 2012 at 4:26 PM 0 replies 1k views
Original Post
TheSkiD
TheSkiD
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:
radian45degree.jpg

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:
radian90degree.jpg

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.position.x = ((float)rand()) / RAND_MAX - 0.5f;
tVertex.position.y = ((float)rand()) / RAND_MAX - 0.5f;
tVertex.position.z = ((float)rand()) / RAND_MAX - 0.5f;
D3DXVec3Normalize(&tVertex.position, &tVertex.position);
tVertex.color = D3DCOLOR_ARGB(255, (int)(128*(tVertex.position.x+1)), (int)(128*(tVertex.position.y+1)), (int)(128*(tVertex.position.z+1)));
tVertex.position = mRadius * tVertex.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.position = 1.1f * tVertex.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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.