Archived

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

Moe

Wold space to screen space question...

Recommended Posts

Moe    1256
I have been thinking of adding a lens-flare effect to my program. I have read several tutorials on making lens flares, but none describe exactly how to do it in DirectX 8. The part that I need to know how to do is how to get the screen space coordinates of a coordinate that is in the world, so I can test if the flare should be drawn or not. Does anyone know how to do this? Also, one quick other question: Is it possible to mix FVF types in a program? eg: using 3d vertices as well as transformed/lit vertices in the same program with the same LPD3DDEVICE thingy. This can be done, right? I will also use this for my lens flare if I get it working. Moe''s site

Share this post


Link to post
Share on other sites
JonStelly    127
As to the FVF question, it sure is. Just call SetVertexShader and SetStreamSource with the correct parameters.

    
m_pD3d->SetStreamSource(0, m_pVb, sizeof(TLTVERTEX));
m_pD3d->SetVertexShader(FVF_TLTVERTEX);


Edited by - jonstelly on January 10, 2002 12:19:52 PM

Share this post


Link to post
Share on other sites
Moe    1256
Ok, thats what I figured. Anyone have an answer to my first question about world space to screen space?

Anyone? Has anyone ever done a lens flare effect in DirectX 8?

Moe's site

Edited by - Moe on January 11, 2002 6:28:59 PM

Share this post


Link to post
Share on other sites
S1CA    1418
http://www.gamedev.net/community/forums/topic.asp?topic_id=74384

In that thread I showed how to transform a world space vertex into screen space.

IIRC MS did a DirectX sample showing how to do lens flares. Try looking around msdn.microsoft.com/directx

--
Simon O''''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Moe    1256
I don't suppose you have a direct link to that sample? I have tried looking around and I can't seem to find it at all.

I noticed for the previous link that you posted, you transformed several vertices that were for drawing triangles. Would it basically be the same for transforming one point, but without the locking/unlocking of the vertex buffer?

Also, one other question: How fast is this done? Can it be done on a per-frame basis without much of a performance hit?

Moe's site


Edited by - Moe on January 18, 2002 6:41:06 PM

Share this post


Link to post
Share on other sites