Skip to main content
23 events
when toggle format what by license comment
Feb 10, 2018 at 8:13 answer added ErnieDingo timeline score: 0
Jun 3, 2011 at 7:41 answer added Chris Subagio timeline score: 2
Jun 3, 2011 at 4:12 history edited doppelgreener
edited tags
Apr 22, 2011 at 17:34 vote accept Olhovsky
Apr 22, 2011 at 15:09 history tweeted twitter.com/#!/StackGameDev/status/61446536126672897
Apr 22, 2011 at 15:07 comment added Maik Semder Did you try to calculate the matrix in the vertex-shader (3 times per triangle) and pass it to the pixel-shader, so the pixel-shader only needs to multiply the matrix with the normal-map-vector per pixel? That doesn't sound too expensive to me, its just a matrix-vector multiplication more per pixel.
Apr 22, 2011 at 14:52 comment added Olhovsky I'm using 577 instruction slots in a PS3.0 shader. The limit is 512, so I need to find another way to do this :/
Apr 22, 2011 at 14:19 comment added Olhovsky I'm still trying to figure out how to do this efficiently, although Maik's answer technically solves the problem. I think I can store a quaternion (representing the rotation matrix) instead of storing the normal (and finding the rotation matrix from the normal). However, I don't know how to find the normal from the quaternion. A green checkmark for someone who does...
Apr 22, 2011 at 14:16 comment added Olhovsky Sorry, I was trying to make things simple and failed :)
Apr 22, 2011 at 14:15 comment added Andrew Russell Your latest diagram makes much more sense.
Apr 22, 2011 at 12:12 comment added Olhovsky I added another image to my question to make it more clear what I'm trying to do. Nothing really fancy, just normal mapping.
Apr 22, 2011 at 12:03 history edited Olhovsky CC BY-SA 3.0
added 523 characters in body
Apr 22, 2011 at 11:44 answer added Maik Semder timeline score: 4
Apr 22, 2011 at 10:11 history edited Olhovsky CC BY-SA 3.0
added 53 characters in body; added 31 characters in body
Apr 22, 2011 at 10:01 history edited Olhovsky CC BY-SA 3.0
added 1620 characters in body; added 429 characters in body; added 92 characters in body
Apr 22, 2011 at 9:59 comment added Olhovsky What I'm trying to do, is apply a normal map to a terrain surface. I guess one way is to find the tangent and bitangent vector, and then use those with the surface normal to form a matrix, which I multiply by the orange normal map normal, to obtain the green result normal. I'm not sure how to find the bitangent and tangent, or if there is an easier way. I have updated my question to show how I am getting the normal from the terrain.
Apr 22, 2011 at 9:57 comment added Olhovsky The surface normal is 90 degrees from the surface, and some other angle from the XZ plane (with Y being up and Z being toward the screen, as in Direct X). I want to rotate the vector by the angle that the normal forms with the XZ plane.
Apr 22, 2011 at 9:45 comment added Andrew Russell Your question does not make sense. You cannot rotate a vector by a vector (you can rotate around a vector, and in fact you must specify an axis of rotation in 3-space). You can find the angle a vector forms with a plane. But in the case of a surface normal it is defined as 90 degrees. Additionally, rotating a vector by 90 degrees makes no sense unless you specify, as I mentioned, the axis of rotation.
Apr 22, 2011 at 8:43 history edited Olhovsky CC BY-SA 3.0
deleted 422 characters in body; added 440 characters in body
Apr 22, 2011 at 8:26 history edited Olhovsky CC BY-SA 3.0
added 420 characters in body; added 2 characters in body; added 162 characters in body
Apr 22, 2011 at 8:13 history edited Olhovsky CC BY-SA 3.0
added 110 characters in body
Apr 22, 2011 at 7:54 answer added Roy T. timeline score: -1
Apr 22, 2011 at 7:45 history asked Olhovsky CC BY-SA 3.0