Sign in to follow this  

Billboarded Particles.

This topic is 4836 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

Hi, I have some problem to make billboarding works, I have try this. This is the way I render the billboarded particles.
	float modelview[16];
	int i,j;

	glPushMatrix();

	glGetFloatv(GL_MODELVIEW_MATRIX , modelview);

	for( i=0; i<3; i++ ) 
	    for( j=0; j<3; j++ ) {
		if ( i==j )
		    modelview[i*4+j] = 1.0;
		else
		    modelview[i*4+j] = 0.0;
	    }

	glLoadMatrixf(modelview);

	m_particles.RenderFire();

	glPopMatrix();

Is this right or wrong to setup billboarding to an particle system? and how do you setup your billboarding to your particle systems? Hope anyone can point me somewere. thx.

Share this post


Link to post
Share on other sites
Right or wrong? The more important question is: does it work, and does it work reasonably well? I.e., does it max out the CPU and slow the system to a crawl or crash randomly?

If it works, and it doesn't do bad things, stick with it. There is no right or wrong way to do stuff like this.

Personally, I do billboarding by retrieving the modelview matrix, and view it is in this format:


Mv0 Mv1 Mv2 Mv3


(Mvn are all 4 component vectors)

And then replace the modelview matrix with this one:


mag(Mv0) 0 0 Mv3x
0 mag(Mv1) 0 Mv3y
0 0 1 Mv3z
0 0 0 Mv3w


Where mag(v) = magnitude of vector v

Relatively easy to calculate and setup, and adjusts size for depth.

Share this post


Link to post
Share on other sites
as long as your on semi-recent hardware, i suggest you go with point sprites, their much faster because they require less data being sent across the bus

hope that helps
-Dan

Share this post


Link to post
Share on other sites
Take a look at this page:

http://www.mvps.org/directx/articles/view_oriented_billboards.htm

It's based on D3D but you should be able to convert it to work in OpenGL fairly easy. It's certainly one of the simpler ways to do it and doesn't hog CPU time.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ademan555
as long as your on semi-recent hardware, i suggest you go with point sprites,


they would be great if they a) wouldnt be clipped as if they were points and b) ati would sometime during my lifetime fix their completely broken point sprite support under opengl, so it wont a) screw up texturing for good and b) crash the vpu depending on what youre doing and if you sacrificed a virgin chicken before.

Share this post


Link to post
Share on other sites
ATI drivers are notoriously rubbish compared to NVidea. I steer clear of point sprites because of consistency of support problems.

My particles are the same as my other game objects. I use a programmable vertex shader to make them face the camera without lighting (bright). It's fast but like any P.V.S. system you'll have to do some groundwork to add support to your graphics system/engine.

Mark
Sound Effects For Game Developers
http://www.indiesfx.co.uk
Ever wanted to command a starship?
http://www.lostinflatspace.com

Share this post


Link to post
Share on other sites

This topic is 4836 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.

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