Archived

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

mons

How to enable Exponential Pixel Fog in DirectX 8.1

Recommended Posts

mons    122
Background: To create a mini-solar system with the earth being orbited by satellites. This is the way I approached the problem: (1) Used Shape Creation Function for Meshes namely D3DXCreateSphere to create the mesh containing a sphere (2) Used D3DXCloneMeshFVF function to create a duplicate of the mesh with a new vertex format which contains elements for storing texture coordinates (3) Applied a texture to the sphere Problem: I wanted to use Exponential Pixel fog to create a foggy effect but I am unable to do so. I used the same code and followed the steps as provided in the SDK C++ Help. . All I get now is the sphere of the same color as I set in the D3DRS_FOGCOLOR and the bitmap is nowhere to be seen. My doubts: (1) Should I enable pixel fog before or after the DrawSubset() function call to draw the mesh subset when I render the scene? (Both seem to produce the same effect. But what is the logically correct thing to do?) (2) Why is the textured bitmap that I attached to the spherical mesh not visible when I use Exponential pixel fog? (3) Could a possible reason for the fog effects not coming out as intended be : If the projection matrix isn''t compliant with this requirement, fog effects are not applied properly. (MSDN) If so, how do I make a W-Friendly Projection Matrix?? I am quite unclear about how to do that and can’t seem to find any relevant information on the web. Please tell me where I could be going wrong. Thanks in advance for your time. Mons He who asks is a fool for five minutes, but he who does not ask remains a fool forever

Share this post


Link to post
Share on other sites
mons    122
Hi there!
I am adding this bit of information to the background of the problem that I have provided above.
--I have used a Flexible Vertex Format or FVF for describing attributes of a vertex.
--Later, I set the vertex shader to our FVF by invoking the function SetVertexShader()

Just adding to the above list of doubts and perhaps rephrasing my question a little bit:
(a) MSDN states that Pixel fog is not supported when using a vertex shader
So does this mean that when we use our FVF we cannot use pixel fog and instead have to use vertex fog? If so, is there anyway we can in fact use pixel fog with a vertex shader or not?
(I know its stupid to ask such a question because I should be able to draw a conclusion from what is stated in black and white, but I ask because I want to reinforce my understanding.. that’s all )
(b) I used vertex fog instead of pixel fog. Now, I am able to see the foggy effect on the the earth BUT the problem now is that I also see a small black sphere of about ¼ the radius of the original sphere object right in the middle as well as another black sphere of about 3/4th the radius of the original sphere also beneath the texture that I have attached as something like a shadow appearing in the view. The contours of the smaller sphere that appears does not have well-defined contours while the larger on does and appear to be black (D3DXCreateSphere creates a sphere of black color) and rotates in exactly the same way as the mesh that I have created.


He who asks is a fool for five minutes, but he who does not ask remains a fool forever

Share this post


Link to post
Share on other sites
mons    122
How can I upload a screen shot of what I am trying to convey here? Is there any way that I can do this? If so, please reply so that I can explain this problem a bit better.

Thanks in advance,
Mons

He who asks is a fool for five minutes, but he who does not ask remains a fool forever

Share this post


Link to post
Share on other sites