Results 1 to 7 of 7

Thread: Is fog affected by the number of tris?

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    23

    Is fog affected by the number of tris?

    Hi there,

    I have a game dungeon which I am adding fog to. The initial results were very unsatisfactory - the fog appears to work in places but in others it is just a blank sheet. However I noticed that when I increased the number of tris with which the dungeon floor is drawn the fog effect improves. I am not quite sure how fog is computed so is this to be expected? Is there any way I can have my floor drawn with two tris and still get a good fog effect?

    Thanks, Ben

  2. #2
    Senior Member Regular Contributor
    Join Date
    Jul 2005
    Location
    Berlin, Germany
    Posts
    188

    Re: Is fog affected by the number of tris?

    Originally posted by benwestgarth:
    Is there any way I can have my floor drawn with two tris and still get a good fog effect?
    Try glHint(GL_FOG_HINT, GL_NICEST). It should enable per pixel fog calculation, if your implementation supports that.
    355/113 -- Not the famous irrational number PI, but an incredible simulation!

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    23

    Re: Is fog affected by the number of tris?

    Thanks,
    I already tried that and it made no difference. Is a geforce4 mx440 recent enough to utilise per pixel calculations for fog? Maybe not.

  4. #4
    Member Contributor
    Join Date
    Feb 2004
    Location
    Dallas/ Nottingham
    Posts
    96

    Re: Is fog affected by the number of tris?

    How large are your tris/polygons, are you using large poly's for the wall/floors etc or lots of small sections.

    You should find that Fog looks better with higher tessellation

  5. #5
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    23

    Re: Is fog affected by the number of tris?

    The tesselation on the floors and walls is very low. 2 large triangles per surface to be specific. I made the assumption that it wasn't important since they are completely flat and square surfaces. In general should I tesselate my surfaces more? Is there a performance penalty for doing so?

  6. #6
    Senior Member Frequent Contributor
    Join Date
    May 2005
    Location
    Prague, Czech Republic
    Posts
    913

    Re: Is fog affected by the number of tris?

    Originally posted by benwestgarth:
    I made the assumption that it wasn't important since they are completely flat and square surfaces.
    In general should I tesselate my surfaces more? Is there a performance penalty for doing so?
    If per pixel fog is not supported, fog factor is calculated in each vertex and interpolated across the triangle so in that case the smaller the triangles are the better the result is.

    Unless you increase number of triangles by too much the performance penalty caused by sending more vertices to OpenGL should be slight. What is high depends on method used to render the geometry. If you are using vertex array, vertex buffer objects or display lists the value may be much higher than when immediate mode is used.

    If you have sufficiently capable hw (for simplicity it has to support multitexturing and have one additional texture unit to whichever number of texture units you are using normaly), you can emulate per pixel fog by use of additional texture that does encode fog factor and fog color for various distances.
    In that case you need to set texture coordinage generation mode for the texture unit containing this texture in such way that generated texture coordinates will in some way correspond to distance of vertex from eye plane.
    Then you need to setup hw to calculate:
    Code :
    unfogged_color.rgb * ( 1 - fog_factor ) + fog_color.rgb * fog_factor
    For fog color and fog factor encoded in the texture it will be
    Code :
    unfogged_color.rgb * ( 1 - fog_texture.a ) + fog_texture.rgb * fog_texture.a
    which is what texture function GL_DECAL does.

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2003
    Posts
    23

    Re: Is fog affected by the number of tris?

    Thanks for the answers guys. I guess I'll have a look at the suggested options.
    Peace.
    Ben

Similar Threads

  1. VBO and immediate mode with low tris/s
    By elpatolocosisi in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 08-20-2013, 08:45 AM
  2. Get amount of tris being rendered? how!?
    By bansheeogl in forum OpenGL: Basic Coding
    Replies: 12
    Last Post: 04-26-2005, 01:54 AM
  3. VBO and indexed tris
    By Tom78 in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 09-30-2003, 03:41 PM
  4. max tris a second
    By zed in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 06-11-2002, 02:32 PM
  5. Quads vs Tris
    By TCBdev in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 10-24-2000, 03:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean