Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Chozo

Member Since 21 Nov 2002
Offline Last Active May 17 2012 09:11 PM

Posts I've Made

In Topic: What's wrong with my stencil shadows?

09 January 2012 - 06:34 PM

Ok, going back to the cube now that I'm home, still using 128 as a starting value, I see the full cube geometry with a 129 in the stencil where the cube is at. A little more messing around and it seems to be related to front face culling. For example, I can remove the increment and change the decrement to work on front faces and it decrements fine. I can also change the increment to work on back faces and it never increments. But I can render the cube with whichever face culling outside of shadows and it works fine.

In Topic: What's wrong with my stencil shadows?

09 January 2012 - 03:53 PM

Just going to note that when I get home and can get back to the box shadows, I'm going to try with a clear value of 128 and check the variance of values. I'm guessing stencil indices can't be negative? It's possible that may be getting in the way here.

In Topic: What's wrong with my stencil shadows?

09 January 2012 - 02:50 PM

Unfortunately, I'm not in a place to test with the cube right now, but I did manage to dump the stencil buffer for my shadow volume (clearing with and checking against 0 rather than 1 here) to a text file with this:

const size_t s = window_width() * window_height();
boost::shared_array<unsigned char> stencil(new unsigned char[s]);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, window_width(), window_height(), GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, stencil.get());
glPixelStorei(GL_PACK_ALIGNMENT, 4);

std::ofstream f("stencil.txt");
for(size_t y=0; y<window_height(); ++y) {
	for(size_t x=0; x<window_width(); ++x) {
		f << static_cast<int>(stencil[(y * window_width()) + x]) << " ";
	}
	f << std::endl;
}
f << std::endl;
f.close();

and I'm seeing values larger than 1. In fact I see all the way up to 9. It really is starting to seem like something is wrong with my decrementing.

In Topic: What's wrong with my stencil shadows?

08 January 2012 - 09:37 PM

Sorry, removing some posts that came about as a result of me making some mistakes in testing. Both back and front face culling seem to be working.

In Topic: What's wrong with my stencil shadows?

08 January 2012 - 09:17 PM

Sorry, I did that cube test wrong. Doing it correctly I have the same effect as the shadow volumes. The entire cube volume is cute out of the scene rather than just shadowing on the wall.

PARTNERS