Archived

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

Commando

Vertex fog without lighting in DX8...

Recommended Posts

Commando    122
Here's what DX8 documentation says about vertex fog:
quote:
Vertex fog effects are computed by the Microsoft® Direct3D® lighting and transformation engine. ... If your application does not use Direct3D for transformation and lighting, it must perform fog calculations on its own. In this case, your application can place the fog factor that it computes in the alpha component of the specular color for each vertex.
My engine doesn't use D3D lighting (D3DRS_LIGHTING is set to false). I currently use pixel (table) fog but that has one problem, it doesn't support range based fog. I wanted to have range based fog so I tested if vertex fog would work. And to my surprise it did work! I set D3DRS_RANGEFOGENABLE to true, and it worked too. I set pixel fog back, and range based fog got disabled. So looks like I can have range based vertex fog without lighting! And I sure don't calculate the fog effects my self, vertices only have pre-calculated diffuse color and no specular or normals. On a side note enabling vertex fog dropped frame rate 4% and enabling range base fog another 4%. Seems weird to me, anyone else noticed the same thing? I'm using directX8. [edit]Oh yeah, I have TNT2U and not using vertex shaders.[/edit] Edited by - Commando on December 15, 2001 1:33:37 PM

Share this post


Link to post
Share on other sites
FantasyGuy    122
Although you''re not using D3D for lighting, you''re still using D3D for transformation. In other words, your vertex buffer is not transformed. If you use transformed vertex buffer (vertex buffer with the D3DFVF_XYZRHW flag enabled) you might get the fog effect disabled. However, this is what I think, I''m not so sure about that.

Share this post


Link to post
Share on other sites
Commando    122
Yeah, that seems logical. Now that I think of it, propably it is the transformation engine that calculates vertex fog effects.

Which makes me wonder, does the transformation engine modify my FVF so that the specular part fits there...

Share this post


Link to post
Share on other sites