This topic is 3476 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

##### Share on other sites
Hi,

Judging from your explanation, I would guess that you're using gluLookAt() to orient the camera. The up vector must not be collinear with the line formed by the center and the eye, but if the up vector points straight up and the camera is pointed directly down, this will be the case. Try changing your up vector to something like (0,0,1) depending on how you want your shadowmap oriented.

-G

##### Share on other sites
This can be a lot of things... you should debug drawing your depth map to see what is being rendered on it. My guess is that your zNear and zFar may be wrong.

##### Share on other sites

Geometrian, you are correct... I am using gluLookAt for the light orientation. I tried changing my upVector to what you suggested but didn't seem to make a difference. I am not sure what else to try (not exactly sure how it works). My near and far clip planes look correct as well.... here is a code snippet that will hopefully help...

// Let's push on a new matrix so we don't change the rest of the world            Gl.glPushMatrix();            // Push on a new matrix to keep our view changes isolated            Gl.glPushMatrix();            // Reset the current modelview matrix            Gl.glLoadIdentity();            // This is where we set the light's position and view.            Glu.gluLookAt(ceilingCenter.x, 5, ceilingCenter.z,                      ceilingCetner.x + 4, 0, ceilingCenter.z, 0, 0, 1);            // Now that we have the light's view, let's save the current modelview matrix.            Gl.glGetFloatv(Gl.GL_MODELVIEW_MATRIX, g_mModelView);            // Now pop off the current light view's matrix            Gl.glPopMatrix();            // Reset the current matrix            Gl.glLoadIdentity();            // Set our FOV, aspect ratio, then near and far planes for the light's view            Glu.gluPerspective(60.0f, 1.0f, 0.1f, 1000.0f);            // Grab the current matrix that will be used for the light's projection matrix            Gl.glGetFloatv(Gl.GL_MODELVIEW_MATRIX, g_mProjection);            // Go back to the original matrix            Gl.glPopMatrix();

I've also posted a screenshot, notice that the bottom left, it's cut off.. the shadow is not the shape of the cylinder. So it almost appears that my camera view is a straight line cutting off the rest of my shadow since it's not in the view (if that makes sense).

"Screen Shot"

biraneto, I wanted to use your suggestion to see what is being rendered to my depth map.. is there a program you know of that will allow me to visually see what is being drawn while each call is made. Any guidance would really be appreciated

##### Share on other sites
There is no secret... its just a texture so you only need to bind it to some polygons to see it.

You may add somethin like this to the end of the render code. vis should be something like 256...

gl.glMatrixMode(GL.GL_PROJECTION);
gl.glOrtho(0.0D, vis, 0.0D, vis, -1D, 1.0D);
gl.glMatrixMode(GL.GL_MODELVIEW);
gl.glViewport(0, 0, vis, vis);
gl.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
gl.glActiveTexture(GL.GL_TEXTURE0);
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glTexCoord2f(0.0F, 0.0F);
gl.glVertex3f(0.0F, 0.0F, 0.0F);
gl.glTexCoord2f(1.0F, 0.0F);
gl.glVertex3f(vis, 0.0F, 0.0F);
gl.glTexCoord2f(1.0F, 1.0F);
gl.glVertex3f(vis, vis, 0.0F);
gl.glTexCoord2f(0.0F, 1.0F);
gl.glVertex3f(0.0F, vis, 0.0F);
gl.glEnd();

From your screen looks like you are too close to the object. Not really too close... but you aren't beeing able to see it entirely.

##### Share on other sites
Thank you for the reply... I ended up (somewhat) getting it. I removed the ceiling and raised the light 10 units and now the eye of the light/camera covers the entire room... not sure if there is a way around that by keeping the light at ceiling level??

I posted a screen shot, that shows what the shadows look like with furniture. You can see a little shadow underneathe the table. I had one more question regarding this... it seems that my light is coming straight down so I only see a shadow underneathe the table. Is there a way to make my light illuminate the room, so that I can see a shadow from the table underneathe as well as on the wall behind it? Not sure if that would involve using multiple lights, a different type of light or just an entirely different method?? Any help would be great!!

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5
frob
13

• 9
• 15
• 10
• 9
• 17
• ### Forum Statistics

• Total Topics
632602
• Total Posts
3007363

×