Get tangent/normal by derivate of function can sometimes fail if your surface points are nonlinearly distributed and or some math singularity is present or if you make a math mistake (which is the case in 99.99%). Anyway you can always use the geometric approach: 1. you can get the tangents...

three.js,blender,normals,uv-mapping

It seems that OBJMTLLoader can handle only triangles and quadrangles, but obj files can describe faces with any number of vertices, but the faces should be convex. If you check your model with http://3dviewer.net, you can see that every face exists, but there are some issues with non-convex faces. So...

directx,hlsl,normals,geometry-shader

I assume that your input vertices' positions are already transformed to clip space. Then, at least you're calculating lighting in the same space. However, clip space is not suited for lighting calculations because perspective transforms are not angle-preserving. Either do the calculations in world or in view space. In either...

opengl,matrix,rotation,glsl,normals

Apparently, if the vertex normals of a mesh are incorrect, then strange rotation artifacts will occur. In my case, I had transformed the mesh in my 3D modelling program (Blender) by 90 degrees on the X axis, as Blender uses the z-axis as its vertical axis, whereas my program uses...

The calculation of the tangent basically looks ok. I don't quite understand the way you draw it, though. If (dx, dy) is your tangent vector, shouldn't your drawing code look like this? glVertex3f(position, SIN(1, 2, position), 1.f); glVertex3f(position + dx, SIN(1, 2, position) + dy, 1.f); In any case, with...

Your normals basically look correct. For the first quad, I get: (0.0, 0.725, -0.689) For the second one: (0.0, -0.725, -0.689) As you can see, I got the opposite sign for the second normal. Which leads directly to the second part of your question. The term "outwards" does not really...

Yes, that is possible, but it's a little effortful. With the returning faceIndex you can lookup the three indices of the triangle in the corresponding indexbuffer, which you can resolve to the vertices in the vertexbuffer. These are containing all information you need to compute the normal. Either the face...

opengl,glsl,normals,simplex-noise

Alright, turns out my problem was almost purely math related. If anyone is interested: The GLSL implementation of the gradient calculation posted in the question is totally correct. Calculating the normals directly from the gradient is possible as described here. And the result looks exactly like I wanted it to...

javascript,opengl,normals,vectormath

You're using a degenerate polygon for testing. If you draw it in the xz-plane, with the vertices numbered from 0 to 3, it looks like this: 2 ---- 3 \ / \ / \/ /\ / \ / \ 0 ---- 1 This polygon does not have a well defined...

javascript,three.js,geometry,normals

If you want to split faces with edges longer than a specified value into two faces, you can use THREE.TessellateModifier, which you will find in the examples/modifiers folder. You can call it repeatedly if you want. Like so: var tessellateModifier = new THREE.TessellateModifier( LENGTH ); for ( var i =...

c#,unity3d,polynomial-math,unityscript,normals

Hm... Should be like this: public Vector3 normalAt (float x, float z) { float argument = Time.realtimeSinceStartup + x * frequency * transform.forward.x + z * frequency * transform.forward.z; float nx = amplitude * frequency * transform.forward.x * Mathf.Cos(argument); float ny = -1.0f; float nz = amplitude * frequency *...

I found out the origin of the problem: in the working script, I was using Orbitcontrols to transform the mesh; in the non-working script, I was transforming the mesh myself and it seems the normals were not updated. What happened is that the origin point was correct but the normal...

I found it! OpenGL uses column major matrices while jbullet uses row major matrices. That's what was giving wrong results.

opengl,glsl,lighting,normals,deferred-rendering

The way you calculate p, p1 and p2 via viewSpacePositionFromDepth is certainly wrong. That function uses the same texcoordFrag for all three points, just with a different depth, so all three points will lie on a line. The cross product in getNormal should just yield 0 for any pixel -...

glsl,webgl,normals,render-to-texture

After a brief look it seems like your problem is in storing x/y positions. gl_FragColor = vec4(vec3(p0*0.5+0.5), 1.0); You don't need to store them anyway, because the texel position implicitly gives the x/y value. Just change your normal points to something like this... vec3 p2 = vec3(1, 0, texture2D(rttTexture, vUV...

opengl,glsl,shader,hlsl,normals

It's pretty simple really: just rotate the normals in the map with the rotation of the map after generating them normally. You don't even need to regenerate them strictly speaking; just adjust your shader.

opengl,glsl,lighting,normals,wavefront

The problem is that OpenGL uses a single index buffer to index the vertex position, texture coordinates and normal buffers, using the same index for each (3 indices for a triangle), whereas the Wavefront obj format allows each face to specify separate indices for the vertex position, texture coordinate and...

To do this with simple OpenGL, you'll need to use a finer tessellate of the cube. Instead of drawing each face with only two triangles, you subdivide it into smaller pieces. The easiest tessellation is to split the faces into smaller squares, and drawing them with triangle strips. If you...