Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4019554
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:07:07+00:00 2026-05-20T10:07:07+00:00

In a pixel shader you can discard a pixel but I would imagine even

  • 0

In a pixel shader you can discard a pixel but I would imagine even a fast-fail shader called for every pixel takes a non-trivial time? Is there any way a vertex shader can discard an entire triangle… I am fairly sure a VS can’t access the primitive but are there any tricks by which we can get the same result?

Talking SM 3.0 here – for completeness discussion on newer versions is welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:07:08+00:00Added an answer on May 20, 2026 at 10:07 am

    The geometry shader can do that trivially as you probably know, but no such thing in SM3.

    It’s harsh for the vertex shader to identify a triangle as such, since all the vertex shader sees is the individual vertices. But… in principle it’s possible.

    If you set the w coordinate to zero, a point will be projected to infinity. Set the w coordinates of all points to zero, and the entire triangle is at infinity, so it won’t be rendered.

    Alternatively, you could probably set gl_ClipDistance to zero or a value below zero (never really used those, but I guess this should work). That would mark the vertex as “behind” a clipping plane. If all three vertices are behind a clipping plane, the triangle is not visible.

    You would need a way to identify the vertices that belong to the triangle that you want to discard, however… and that will not be easy unless you have a very special situation (such as for example knowing that you want to discard all triangles in some given bounding box, or all triangles in which the vertex attribute #5 is zero, or whatever).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I output something from the vertex shader to the pixel shader multiple
MRT allows for rendering to multiple texture targets in the pixel shader, but I'm
I've written a basic 2d pixel shader, and i can't seem to get it
I know that Floyd–Steinberg dithering algorithm can't be implemented with pixel shader, because that
Would like to know options in 3D graphics engines out there that can even
My overall goal is to be able to create a pixel shader that takes
I'd like to write a pixel shader that takes an input image, and converts
To start with my main question: Can I use pixel shader model 3, 4
I'm creating a fog feature in my Effect file.. in the pixel shader, I
I am new write a pixel shader and use in my managed directx project,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.