Archived

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

Arcibald Wearlot

Billboarding in a vertex shader

Recommended Posts

I''m trying to do implement billboarding in a vertex shader for my particle system, but something isn''t working. Every frame I create a vertex buffer with 6 vertices per particle (in model space) and set it. I pass the world, view, projection matrices and the transposed view matrix, then in the vertex shader I do something like this: m4x4 r0,v0,WORLD m3x3 r0,r0,TRANS_VIEW m4x4 r0,r0,VIEW m4x4 r0,r0,PROJECTION I think this should be correct: I multiply the world space vertex with the transposed view matrix, using m3x3 to ignore anything beside rotation, to make it face the camera, then transform with view and projection matrices. But it isn''t working: the particles rotate in strange ways and don''t face the camera. What am I doing wrong?

Share this post


Link to post
Share on other sites
One suggestion I just found...
http://www.gamedev.net/community/forums/topic.asp?topic_id=144114
Look a few relies down. I think you must also pass the camera vectors via VS constants.

Of course for a particle system you could always use point-sprites, which are automatically view-aligned, but then you don't get distance scaling, which is really a fundimental feature of 3D graphics.

[edited by - AndyTX on May 25, 2004 3:11:32 PM]

[edited by - AndyTX on May 25, 2004 3:15:13 PM]

Share this post


Link to post
Share on other sites