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 7799611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:22:03+00:00 2026-06-02T00:22:03+00:00

I would like to produce an effect where certain objects are only rendered if

  • 0

I would like to produce an effect where certain objects are only rendered if they fall within a certain space. Think of a “magic decoder volume” that reveals secret objects when they are inside it.

Let’s assume that the secret objects and revealing volume are all spheres. I first render the non-secret objects. I then render the back face of the revealing volume into the depth and stencil buffers. If I render only the secret objects that pass both depth and stencil tests, they’ll also be drawn in front of the revealing volume. I’d like the ability to create a second depth buffer that holds front of the revealing volume. Is there a standard way to do this?

I think I could probably set the near clipping plane to pass through the center of the revealing sphere. Then I could pull the near-clipping plane back closer to the eye, render the front face of the revealing volume and set the far clipping plane to its center and only render secret object vertices that are greater than the depth test and pass the stencil test.

This two-pass approach feels a bit ugly and if there’s a non-secret object in the volume that should be in front of a secret object, it might get squished because of the reversed depth test. I don’t have much experience with shaders, but I’m guessing that’s the way to go?

  • 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-06-02T00:22:05+00:00Added an answer on June 2, 2026 at 12:22 am

    Vincent’s deleted answer regarding a shader isn’t such a bad idea — per fragment work out the distance from the centre of your revealing sphere; if the distance is too great then discard.

    Otherwise, shadow volumes work because they never reveal any additional geometry. Though thinking as I type, I guess what you could do is:

    • disable writes to the colour buffer, so that you’re affecting depths only;
    • render your scene with standard GL_LESS depth testing, to establish depth values;
    • render the back-facing portion of your clipping sphere with the same depth test;
    • render the front-facing portion of your clipping sphere with GL_GREATER enabled, so portions of those faces will be drawn only if things are in front of them;
    • enable the colour buffer, switch to depth function GL_EQUAL;
    • render your scene geometry again.

    The net effect should be that after the first four steps your depth buffer has values equal to the true values only where it intersected the clipping geometry. Hence when you switch to GL_EQUAL colours will get through for only that geometry.

    Specifically, step 3 wipes out anything behind the clipping geometry, step four wipes out anything in front. The implicit assumption is that your clipping geometry fits entirely within the view frustum.

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

Sidebar

Related Questions

I would like to produce a character list of all of the first letters
I would like to produce C# helper files from the KML2.2 xml schema using
I would like to produce a binary zip distribution of my project that would
I am using Core Image and would like to produce a black and white
I'm using Visual Studio 2008 (C++) and would like to produce a list of
I would like to be able to produce a file by running a command
I would like to produce a text file which includes a mixture of strings
How would one programatically reproduce the following effect? (source: artext.co.uk ) I'd like to
I would like to have an animation effect which starts when people leave a
I would like to produce the following result: Table:[0050 Fix No Hit].[Fix_No_Hit] Policy Number:

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.