Results 1 to 3 of 3

Thread: Fragment face data

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    14

    Fragment face data

    Hi everyone,

    I am wondering if there is any quick access to information on whether or not a fragment is the back or front face of a polygon from within the pixel shader?

    I suspect that there isn't and that something like culling happens in the primitive assembly stage.

    Could I get face information by calculating a cross product per primitive in the geometry shader, and then pass it to the pixel shader as an out?

    Any advice would be much appreciated.

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,675

    Re: Fragment face data

    I am wondering if there is any quick access to information on whether or not a fragment is the back or front face of a polygon from within the pixel shader?
    The built-in boolean fragment shader input: gl_FrontFacing.

    I suspect that there isn't and that something like culling happens in the primitive assembly stage.
    Yes. But if you're not doing backface culling, you can simply tell OpenGL which side is the front, and gl_FrontFacing will be false for fragments of the back triangle.

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2011
    Posts
    14

    Re: Fragment face data

    Thank you very much for the reply.

    I am playing around with the stencil and depth buffers for volumetric shadows / crepuscular rays.

    I actually have another question, which I will post in another thread.

Similar Threads

  1. Querying fragment data names
    By malexander in forum OpenGL: GLSL
    Replies: 2
    Last Post: 09-27-2010, 02:52 PM
  2. Reading Data From a Fragment Shader
    By cotdang in forum OpenGL: GLSL
    Replies: 1
    Last Post: 07-13-2010, 01:24 PM
  3. Variable data in fragment shader
    By dogdemir in forum OpenGL: GLSL
    Replies: 13
    Last Post: 09-23-2009, 06:53 PM
  4. Getting compressed cube map face data from GPU broken on ATI Catalyst 6.10?
    By AblazeSpace in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 11-10-2006, 02:23 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