Skip to main content
gamedev.net
🔒 Locked

artifacts while using shadow mapping

Started by Achilleos Feb 25, 2007 at 8:43 AM 0 replies 700+ views
Original Post
Achilleos
Achilleos
Hi there, i am currently working on shadow maps using multitexturing to avoid rendering in multiple passes. therefore i am not using the alphatest to get rid of false calculations. nevertheless are the artifacts on the back of objects not like they should be. i am rendering on an GeForce 8800 GTX. A few code extracts: Creating the shadowmap: glGenTextures(1, &shadowMapID); glBindTexture(GL_TEXTURE_2D, shadowMapID); if(GLEW_ARB_depth_texture) glTexImage2D( GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, shadowMapSize, shadowMapSize, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_BYTE, NULL); Setting up TexGen: glActiveTexture(GL_TEXTURE0 + ++currentTextureUnitOffset); glBindTexture(GL_TEXTURE_2D, (*iter)->shadowMapID); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); if(GLEW_ARB_depth_texture) { glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE, GL_INTENSITY); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_FUNC, GL_LEQUAL); glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, shadows); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_INTERPOLATE); glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); glTexEnvf(GL_TEXTURE_ENV, GL_SRC2_RGB, GL_CONSTANT); glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND2_RGB, GL_SRC_ALPHA); } glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); glEnable(GL_TEXTURE_GEN_Q); glEnable(GL_TEXTURE_2D); And some related images: http://www.tzi.de/~pachur/shadowmaps/artifacts.jpg http://www.tzi.de/~pachur/shadowmaps/lightpositions.jpg http://www.tzi.de/~pachur/shadowmaps/shadowmap1.jpg http://www.tzi.de/~pachur/shadowmaps/shadowmap2.jpg It would be great if some could tell me what i am doing wrong. Thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.