Jump to content
  • Advertisement
Sign in to follow this  
L. Spiro

OpenGL Fog Coordinates

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

OpenGL allows fog coordinates to be part of vertex buffers.
There are no HLSL semantics for fog coordinates as inputs to vertex buffers, so how can I match OpenGL on this point?


Yogurt Emperor

Share this post


Link to post
Share on other sites
Advertisement
The general rule with HLSL is to just use a TEXCOORD semantic for any custom data. The semantic doesn't really matter too much, it's what you do with it in your shader that counts.

Share this post


Link to post
Share on other sites

OpenGL allows fog coordinates to be part of vertex buffers.
There are no HLSL semantics for fog coordinates as inputs to vertex buffers, so how can I match OpenGL on this point?


Yogurt Emperor


There most definitely is a semantic: D3DDECLUSAGE_FOG

But like the above poster said, it really doesn't matter at all which semantic you use for vertex data.

Share this post


Link to post
Share on other sites
There most definitely is a semantic: D3DDECLUSAGE_FOG

But like the above poster said, it really doesn't matter at all which semantic you use for vertex data.

According to http://msdn.microsof...7(v=vs.85).aspx, that is not an input.
Although http://msdn.microsof...4(v=vs.85).aspx says, “Vertex data contains fog data,” it doesn’t mention whether it is input or output.
Very unclear.


That being said, something seems inadequate about the “general rule”.
How could that work with multiple streams?
POSITION1 indicates vertex data on stream 1.
But TEXCOORD1 indicates vertex data on stream 0.
If I picked another semantic arbitrarily, I could be clashing with an existing semantic, unless DirectX is fine with having multiple POSITION1’s (and it may be as I recall).


Yogurt Emperor

Share this post


Link to post
Share on other sites
"Vertex data contains fog data" is a statement about the vertex data structure and the usage intent of the data.

Compare the 2 links you posted - for each vertex structure usage type, there's a corresponding HLSL semantic.

I've never used FOG myself, but you might try simply declare the vertex structure with a D3DDECLUSAGE_FOG member, and use FOG as the vertex shader semantic.


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!