Archived

This topic is now archived and is closed to further replies.

Sander

Particle engine: reverse rotation

Recommended Posts

I am programming a new particle engine to work with my new camera class. This new camera class doesn''t store the rotations anymore but instead works directly on the modelview matrix. When drawing the particles I need to orient them towards the camera. How can I rotate the particles towards the camera using only the modelview matrix info? I would really prefer a fast routine since I need to have *lots* of particles. Thanks in advance! Sander Maréchal [Lone Wolves Game Development][RoboBlast][Articles][GD Emporium][Webdesign][E-mail]

Share this post


Link to post
Share on other sites
the modelview matrix, isn''t one row = up vector, another row = right vector, third row = direction vector ?

the simplest way is to use the up vector as y-axis and right vector as x-axis for your bilboard

"No lies of sugar can sweeten the sournes of reality"

}+TITANIUM+{ A.K.A. DXnewbie[onMIRC]

Share this post


Link to post
Share on other sites
As Seriema said, you can extract the axes directly from the view matrix. If you''re using D3D..


m_pD3Ddevice->GetTransform( D3DTS_VIEW, &viewMatrix);

Xaxis.x=viewMatrix._11;
Xaxis.y=viewMatrix._21;
Xaxis.z=viewMatrix._31;

Yaxis.x=viewMatrix._12;
Yaxis.y=viewMatrix._22;
Yaxis.z=viewMatrix._32;

Zaxis.x=viewMatrix._13;
Zaxis.y=viewMatrix._23;
Zaxis.z=viewMatrix._33;


The method for OGL would be similar. Then you use the x-axis and y-axis as offsets for the corners of each billboard.

Share this post


Link to post
Share on other sites
Ahhhhh.... stupid, stupid me

Why could I not think of that myself. It makes sooo much sence and I knew that those vectors were storen in the modelview matrix.

Thanks a lot guys!

One last question: The vectors stored in the modelview matrix (OpenGL), are they already normalized? Or would I need to do that manually?

Sander Maréchal
[Lone Wolves Game Development][RoboBlast][Articles][GD Emporium][Webdesign][E-mail]

Share this post


Link to post
Share on other sites