# mv348

Member

94

263 Neutral

• Rank
Member
1. ## Right vs Left-Handed Matrix Representation

This relates to the cross product. There is a way to determine the direction of the cross product of two vectors, using the "right hand rule" - in short, to determine the direction of (A cross B), you orient your right hand such that you can sweep your fingers from A to B. Your thumb will point in the direction of the cross product. Google "cross product - right hand rule" for better pictures and explanations. But you could redefine the cross product by using your left hand - this will just reverse the direction of the resulting vector.    you can determine the Z vector of your coordinate system by taking the cross product of the X and Y vectors (or in other language, get the k vector by taking the cross product of the i and j vectors).  If you find the z direction by using a right handed cross product of x and y, its a right handed coordinate system. Likewise for a left handed cross product, and left handed coordinate system.   Hope that makes sense. But in short, the z vector is reversed.
2. ## Capsule line intersectionpoint only

Maybe someone else will but I'm definitely not quite understanding your question. Could you give more details or post a diagram?   I implemented capsule collisions once.. to the best of my memory, to determine the closest point on a line to a capsule, I checked the distance between the two center center points to the line (point to infinite-line distance calculation) and then the distance between the line and the straight section of the cylinder (infinite-line to infinite-line distance calculation), and then projected the resulting closest point onto the line segment connecting the sphere center points to see if it was inside the cylinder portion. I had some simple logic to determine which of the 3 options was closest.   Hope that's somewhat helpful.. if not, please post more details.
3. ## OpenGL Can't get simple Tesselation Shaders to execute

Thanks everyone.   It turned out the problem went away when I explicitly set the attribute layout locations in all the shaders (tesselation control, tesselation evaluation, and fragment shader). Initially I was only doing this in the vertex shader.   It seems odd to me. I had thought that if your vertex shader sets the position of each attribute, the subsequent shaders would assume the same convention provided they were listed in the same order and had the same type (which was the case).   Should this really have been necessary?

5. ## How many dedicated Shaders to use?

So I've read its best to write dedicated shaders for specific purposes rather than bloat them with too many conditionals. And it makes sense. But I look at how many options are possible and it quickly becomes overwhelming:   1. Normal mapping 2. GPU Tesselation / Displacement mapping 3. Shadow mapping 4. Animation/Skinning   I could go with or without the each of these for any particular shader, resulting in 16 possible shaders. When you consider I have to write shaders for shadow passes for different types of lights (point, spot, directional, etc). the number of shaders quickly becomes ridiculous.   What's a smart way to cluster these and keep it reasonable?
6. ## Trouble reading from depth-texture

Yep! I set 7 as the active texture unit, bind the texture,and then set 7 as the value of the gCascadedShadowMap texture uniform.   I was hoping someone might now what possible things could 'block' the texture from being read from? Are their constraints on the bind states of the frame buffer objects? I've tried binding and unbinding the relevant frame buffers in various places, but I'm sure I've not exhausted the possibilities.

8. ## FBO - Render to texture not working

Fixed a small bug - I forgot to reset the glClearDepth to 1.0f after setting it to 0.25f. But still not working.    I think it has something to do with my gBuffer. My gBuffer has 4 color textures and a depth/stencil texture attached to its FBO. The shadow map FBO has only a depth texture attached. When I do my light pass I have my g-buffer fbo bound, and then I bind the shadow-map's shadow texture to an appropriate texture unit. It appears as if the gBuffer cannot "see" the shadow texture sitting in the unbound FBO. By my understanding I thought this would work but is there some technicality here that I'm not aware of?
9. ## FBO - Render to texture not working

I don't think thats it. I'm not using the texture for anything else.   (edit) Being doing more testing and it would appear that the depth clearing is being applied to my g-buffer (previously bound frame buffer) and not to the shadow FBO. I can't see why though, I am definitely binding the shadow FBO before clearing the depth buffer.

11. ## Stencil shadow volumes - a thing of the past?

Weird.. I thought I submitted a reply to this...   Interesting! I mean, my self-shadowing certainly works, its more an issue of artifacts close to the silhouette edge. May I ask, how did you determine your silhouette edges?  The issue I seem to be having, even when calculating a smooth silhouette edge (cutting along the line where non-ambient light reaches zero), is that the lighting is smooth and continuous but the shadow volumes are sharp wedges, and therefore I seem to invariably see artifacts close to the silhouette edge. Later I'll try to post an example when I have my laptop.