# Tagged Questions

A vector that is perpendicular to an object's surface.

7k views

### Why are normal maps predominantly blue?

Why normal maps are predominantly blue instead of a random color? I guess normal vectors of a 3D object can point in every direction, like: (1.0, 0.1, 0.5), (0.1, -0.5, 0.3), (-0.51, 0.46, -1.0) ...
16k views

### OpenGL: why do I have to set a normal with glNormal?

I'm learning some basics of OpenGL but I'm wondering why there is a call glNormal to set the normal of vertices. If I create a simple triangle like this: glBegin(GL_TRIANGLES); glVertex3f(0,0,0);...
2k views

### Normals vs Normal maps

I am using Assimp asset importer (http://assimp.sourceforge.net/lib_html/index.html) to parse 3d models. So far, I've simply pulled out the normal vectors which are defined for each vertex in my ...
4k views

### Given a plane and a point, how can I determine which side of the plane the point is on?

Given the point Vector pos = new Vector(0.0, 0.20156815648078918, -78.30000305175781, 1.0); and the plane (triangle) Vector a = new Vector(-6.599999904632568, 0.0, -78.5, 1.0); Vector b = new ...
312 views

### Specular banding with high specular power

We're having some issues with our ray tracing in DirectX, especially with some serious banding issues with specular. With high specular power (above 8) banding starts. I'm wondering if this is an HDR/...
984 views

### Does one need normals for a strictly 2d Game?

I'm starting to learn OpenGL by creating a pure 2D game. I have to decide on the format of the Vertices. Do I need a normal component? Or is this for a 2d component not needed? My gut feeling says I ...
1k views

### How do I generate surface normals?

I have quite a few debug drawing methods in my engine that can generate geometry useful for debugging, like spheres and cubes. At the moment I do not generate any normals for these shapes. Is there ...
3k views

### 2D AABB vs AABB Sweep : How to calculate hit normal?

I've implemented a 2D AABBvsAABB sweep cast into my game, however, I'm having difficulty calculating the hit normal of the sweep cast. I have the sweep direction, both a and b AABB positions and xy ...
3k views

### How do I calculate the normal of a plane defined using homogeneous coordinates?

I can define a plane in 3D space using three 3D points (p0, p1, p2) that all lie in the plane and that form a non-degenerate triangle. Calculating the normal of the plane is as simple as calculating ...
384 views

### Unity: Why do my normals flip during an animation?

This problem boggles my mind. I have an animation running on a face object (imported from Blender). At a few points in the animation, the normals switch direction! It causes the mesh to blink. Of ...
304 views

### Transforming Normals in Bump Maps

Question I have a noise texture (perlin noise, to be precise) with its value in the alpha channel and the normal components in rgb. I now wish to, on the fly, apply some function to the alpha part ...
11k views

### Any reliable polygon normal calculation code?

Do you have any reliable 3d polygonal face normal calculation code? Any language will do, I'll port it to make it work. Even if you find some code in a 3d game engine and post it here I'll be more ...
2k views

### Normal transformation and homogeneous coordinates

I'm very confused about the math behind the model/affine transformation expressed in homogeneous coordinates. Reading this article, I understood that a generic vector is transformed by multiplying it ...
585 views

### How can I calculate a vertex normal for a hard edge?

Here is a picture of a lovely polygon: Circled is a vertex, and numbered are its adjacent faces. I have calculated the normals of those faces as such (not yet normalized, 0-indexed): Vertex 1 ...
11k views

### best way to compute vertex normals from a Triangle's list

hi i'm a complete newbie in computergraphics so sorry if it's a stupid answer. i'm trying to make a simple 3d engine from scratch, more for educational purpose than for real use. for now i compute ...
357 views

### Calculated normals for mesh not working

I am trying to implement a 3D mesh viewer with C++ and OpenGL ES 2. I am currently struggling with the calculation of the normals for the vertices, or at least I think that is where the problem lies......
232 views

### Coloring Terrain By Steepness Issue

Also I am attempting to implement some simple coloring by "slope" onto my planet and to do this I take the normal mapped normal "y" component and subtract it from one. Yet I am getting some strange ...
3k views

### How to do simple bump mapping

I'm trying to do bump mapping, and I'm getting fairly close at achieving my goal. I miss one crucial piece of my puzzle to have bump mapped effect in my scene; I need to transform the normals from my ...
1k views

### How to find two perpendicular lines given a single plane

Hey guys, i was wondering how i would go about finding the perpendicular lines relative to a surface normal. For instance say i have (0,0,1) the expected output would be (1,0,0) and (0,1,0). What ...
134 views

### SSAO issue - surfaces darken based on camera angle

I have a strange issue in my engine where my SSAO effect will extremely darken or lighten based on my camera angle: In that example, I'm just outputting the ssao texture to the screen. The texture ...
7k views

### Normalization of Vectors: Return a copy of the result or alter the object itself?

When calculating the normal of a vector, which is considered canon: Returning a copy: Vector2D Vector2D::Normalize() const { double a1 = GetX(); double a2 = GetY(); double a3 = GetZ(); ...
1k views

### Triangle Strips and Tangent Space Normal Mapping

Short: Do triangle strips and Tangent Space Normal mapping go together? According to quite a lot of tutorials on bump mapping, it seems common practice to derive tangent space matrices in a vertex ...
2k views

### How to create per-vertex normals when reusing vertex data?

I am displaying a cube using a vertex buffer object (gl.ELEMENT_ARRAY_BUFFER). This allows me to specify vertex indicies, rather than having duplicate vertexes. In the case of displaying a simple cube,...
833 views

### C# XNA Normals Question

I have been working on some simple XNA proof of concept for a game idea I have as well as just to further my learning in XNA. However, i seem to be stuck on these dreaded normals, and using the ...
1k views

### 3Ds Max is exporting model with more normals than vertices

I made a simple teapot with the "Create Standard Primitives" option and exported it as a collada file, ended up with this: < float_array id="Teapot001-POSITION-array" count="1590"> < ...
397 views

### Can't get normals to work correctly with lighting in OpenGL [closed]

I'm trying to light up a simple 2d triangle with my cursor as a diffuse light source but can't seem to set the normal correctly for the lighting to look right. The function that calculates the normal ...
316 views

### Removing seams between procedurally-generated spherical terrain tiles

I'm working on procedural planet generation project in Unity. To create a sphere, I use the following technique: Create six planes arranged as faces of a cube Normalize all vertices' positions to ...
159 views

### Using normals in DirectX 10

I've got a working OBJ loader that loads vertices, indices, texture coordinates, and normals. As of right now it doesn't process texture coordinates or normals but it stores them in arrays and creates ...
155 views

### Surface normal to screen angle

I've been struggling to get this working. I simply wish to take a surface normal and convert it to a screen angle. As an example, assuming we're working with the highlighted surface on the sphere ...
103 views

### When using deferred rendering technique, what space should my normals be? Why?

I'm implementing a deferred shading technique and the following question arose: When storing the normals, should I transform to view space, or may I keep them in world space? Why? Will any of the ...
3k views

### Blender mesh mirroring screws up normals when importing in Unity

My issue is as follows: I've modeled a robot in Blender 2.6. It's a mech-like biped or if you prefer, it kindda looks like a chicken. Since it's symmetrical on the XZ plane, I've decided to mirror ...
683 views

### Unusual Lighting Effects - Random Polygons Coloured

I am working on creating an object loader for use with iOS, I have managed to load the vertices, normals and face data from and OBJ file, and then place this data into arrays for reconstructing the ...
554 views

### What is the cause of this lighting artifact on my dynamic terrain mesh?

I am generating my own terrain mesh in Unity, using pseudo-random noise to determine the height. I construct the mesh using quads, each quad is composed of two triangles. All seems to be going well, ...
247 views

### A little bit confused on how to set normals in this case

I'm learning how to use VBOs and I'm following up on the tutorial at the bottom of this page. So I went ahead and created a structure Vertex to hold vertex data.(coordinates and normals). struct ...
65 views

### Make a plane to display material from both sides

I know there is a setting in Cry Engine, which allows you to be able to read materials of the plane from both sides, so I am wondering if there is such a setting in Unity5. Thanks in advance
1k views

### How to interpolate a height-map with normals

My Task I want to interpolate a heightmap by using the normal of each nearby point of the heightmap which is calculated before. When having 4 Points before i gonna have 9 points after it. ( See this ...
1k views

### Calculating vertex normals on the GPU

I have some height-map sampled on a regular grid stored in an array. Now, I want to use the normals on the sampled vertices for some smoothing algorithm. The way I'm currently doing it is as follows: ...
312 views

### Calculating the winding and normal when programatically adding triangles to a mesh

I'm writing a program that takes a 2D planar polygon and extrudes it to a 3D mesh with a given height. I identify triangle edges that are borders of the polygon and now I'm trying to automatically ...
219 views

### .md5mesh normals are not smooth

I'm currently working on a project that requires me to load .md5mesh format and draw it. Following this link I've managed to load the mesh into the engine successfully, but a problem arises when ...
137 views

### Pixelated Normal Generation

I am generating normals for each vertex in a standard 512*512 quad. Yet when I do using the following code: public Vector3f[] normals(Vector3f[] surface){ Vector3f[] normals = new Vector3f[surface....
411 views

### XNA calculate normals for linesegment

I am quite new to 3D graphical programming and thus far only understand that normal somehow define the direction in which a vertex faces and therefore the direction in which light is reflected. I have ...
1k views

### How do I determine the collision normal in an axis aligned bounding box collision?

I have a 3d moving box and a stationary box. I can detect collisions ok but now I would like to slide the moving box against the stationary box as a collision response. For this I need the normal of ...
52 views

### Generating face normals with the geometry shader

I'm trying to visualize the face normals for a mesh, using the geometry shader to generate lines represeting the normal vectors. My intention was to draw that line from the triangles centroid, ...
33 views

### Weird warping with per-vertex normals

I've had this little problem for a while now, where for some reason my calculations for per-vertex normals results in a weird distortion or warping, skewing my lighting, shading, and reflection passes....
63 views

### Computing Normals for a displaced material

Disclosure: cross-posted on Unreal Answers, thought was sufficiently general for GameDev.SE I am currently rendering a displacement texture and, separately, a normal texture for my ocean. Is there a ...
422 views

### Confused About My Code Suggesting The Normal Matrix Is Equivalent To The ModelView Matrix

I'm learning environment mapping in OpenGL by following this page. In his vertex shader, the author calculates the vertex normal in eye space with the following code: nEye = vec3(viewMatrix * ...
257 views

My test FBX mesh is a cube. From what I surmise, it seems that the cube is on the extreme end of this issue, but I believe that the same issue would be able to occur in any mesh: Each vertex has 3 ...
217 views

### Is it possible to gain performance by omitting vertex normals in the GPU pipe?

I am working on a rendering problem where I want to render as many raw triangles to the screen as I can with either OpenGL or DirectX with the absolute fastest performance possible. I wondered about ...