Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

1
vote
0answers
85 views

how to calculate smooth normals for 10,000,000 vertices?

I am trying to calculate smooth normals with angle weight for a huge mesh with 10 million vertices. Currently, i am using map/dictionary to store the traingles connected to a vertex. That is, for each ...
0
votes
1answer
99 views

Why is my spherecast returning an incorrect hit on mesh collider? (Unity)

I have a mesh collider that is largely a flat plane facing up. Any SphereCast against that surface should return a normal of Vector3(0, 1, 0), but that isn't always happening. When near an edge on the ...
0
votes
1answer
62 views

How can I get visually accurate collision normals with sphere collisions?

I'm solving simple 3D sphere collisions by checking the sphere for overlap with a mesh, finding the nearest point on that mesh's surface to the center of the sphere, and then resolving the collision ...
0
votes
1answer
36 views

How can I detect if I move circular with my Gameobject?

I want to detect if my Gameobject (Vector3 Point) is moving circular. For that i thought its a good idea to safe the last 5 Points every 10 frames and make line-Vectors out of it. Then I thought I ...
0
votes
2answers
179 views

Correctly transforming normals for G-Buffer in Deferred Rendering

I have a deferred rendering system: first there is the G buffer generation, then there is the lighting or shading calculation on that gbuffer data. However there seems to be an issue with various ...
3
votes
4answers
253 views

Algorithms for calculating vertex normals in 2D polygon

I have the points of a 2D polygon in the order in which they are connected, and I need to calculate the vertex normals and move them along it. An example is shown. I would like to know how to ...
0
votes
1answer
85 views

Unity Surface Shader Using “worldNormal” While modifying Normals Turns Shader Black

So I was writing a simple triplanar mapping shader and while doing so encountered a bug where when using IN.worldNormal in code while writing to ...
0
votes
1answer
28 views

.md5mesh - multiple meshes with smooth normals

I have a .md5mesh which contains multiple meshes and I want to calculate smooth normals. The normals are correct but they don't work with multiple meshes. My first idea was to merge all meshes, then ...
1
vote
1answer
51 views

Why does Unity ignore normals when calculating backfaces?

Here's some code to generate a square mesh. ...
0
votes
0answers
24 views

Made a quad manually, Polygons have opposite facings?

NOTE: I'm in XNA/Monogame So I have a generalized Quad-Builder for textures that looks like this: ...
0
votes
2answers
71 views

Converting between world coordinate systems

I have a mesh (verticies, indicies, normals).This mesh uses following world coordinate system: Forward: x Up: z Right: y I am trying to convert it to a different coordinate system: Forward: z Up: y ...
1
vote
1answer
110 views

Correct normal map for rotated sprites

I am trying to find the best way to correctly do normal mapping in a 2D batched sprite renderer. For each sprite sheet (aka texture atlas) I render all sprites as a textured quads with a single <...
0
votes
1answer
23 views

How to get smoother transition between the surface normals rotation of player in Unity

I kinda have a problem that my player is snapping onto the other surface while I wanna move a ramp up. I want to have it rotate smooth to the normals of the ramp. How can I change the code below to a ...
1
vote
2answers
329 views

Getting scene normals in Unity

When I get the depthnormals with the shaderreplace script, it just replaces all the shaders in the scene and uses the meshes geometry to calculate the normals, ignoring the normalmap textures applied ...
0
votes
1answer
71 views

Calculating correct normal direction from multi-variable function

I am working with a plane model which I am offsetting the vertices on the up axis to look like waves by using the function: Sin(vertex.x * frequency) * amplitude + Cos(vertex.y * frequency) * ...
1
vote
1answer
200 views

Using indices in obj files and handling normals

I have been loading obj files and using indices for handling duplicated vector positions, but I have not gotten to the point of requiring normal data to be passed to the shaders as well. The problem ...
0
votes
1answer
76 views

How do I triangulate non-planar polygons correctly?

I've got a super simple octagonal mesh with a bevel around the circumference. When I triangulate for export, the cuts form a valley (proper term here?) – which is to say, they transform a level quad ...
9
votes
1answer
2k views

How can I get the normal vector for a plane from a set of vertices?

I'm working on a HLSL / C++ little project to going over my graphics work, and I am unsure how I am to get a facing vector from a vertex polygon. I can't seem to find the formula. The positions are ...
0
votes
1answer
152 views

Unity: Blender's Armature messes up Faces

The Model itself is fine when imported but when I activate the Animation all Normals and lighting get Inverted from the Bones. Result: Import Settings: Import Settings: Blender Armature Settings: ...
0
votes
0answers
292 views

How do I calculate terrain normals?

I have a problem with calculating the normals of vertices in my terrain. The picture above is how my terrain mesh looks. Each vertex has of course an X, Y and Z component. How do I calculate the ...
1
vote
1answer
1k views

convert view space normal to world normal

Im writing a shader that uses Unity's _CameraDepthNormalsTexture to get both the view normal and depth values. I return a color from my fragment shader equal to the normal values sampled. I am ...
1
vote
1answer
203 views

How to achieve good looking surface net normals?

EDIT After Victor T.'s suggestion (ignore seams): I'm using elastic surface nets to convert a 3D voxels into a nice smooth mesh. The mesh part, is great, however, I can't seem to find a decent ...
2
votes
1answer
370 views

How do I calculate normals correctly for dynamic terrain (DX11, C++)?

I am currently looking for some guidance on how to correctly calculate my normals on the CPU for my terrain as the results I'm getting seem to be incorrect. Eventually I will attempting to calculate ...
3
votes
2answers
306 views

How to calculate verticle normals of triangular mesh

I'm playing with some terrain generation. I have a triangular mesh that looks OK - that is if I hardcode verticles normals (on this image every single verticle has normal of (0,-1,0) The situation ...
1
vote
1answer
605 views

Consistent normals at any angle in bezier curve

Could not work out or find any solution for this. I have a spline which consists of bezier curves (in 3d space) — in fact, any straight line will also have such problem. I take a point on the curve ...
0
votes
2answers
497 views

How does one calculate the surface normal, in 2D collisions?

I have a ball, which should bounce when it collides with a surface. I know the formula for reflections; (v1 - 2(v1 • n)n) However, I cannot obtain the required information. I know: the ball ...
1
vote
2answers
674 views

Unity procedural smooth normals

I have a Unity project, which heavily relies on the marching cubes algorithm. Because this algorithm doesn't return the triangles in order, I can only index them in the order they are present in the ...
1
vote
1answer
76 views

IsoSurface Normals\Texture Coords Problems(DX11\SharpDX)

Hi and thanks for your time! So over the past few days I have been playing with isosurface construction from volume textures, I have it running on the cpu and all is well from a "just got it working" ...
0
votes
1answer
24 views

Lengthen Line (bidirectional) - crossing zero line

I'm trying to lengthen a line, by a certain amount. I want to apply the modification to both points on the line, expanding it in both directions. without moving it from it's current position (center ...
0
votes
0answers
46 views

Slide along Surface

I'm very bad at Math and trigonometric functions (And I dunno if this questions fits here) I have a surface normal as a direction vector.I want my character slide along the surface, if the angle of ...
0
votes
1answer
222 views

Applying texture inside of an Icosphere?

I have implemented a code to generate an Icosphere procedurally in Unity 5.3.4f, which works pretty well. However, what I need to do know it tweak the code to make the sphere to receive texture only ...
2
votes
1answer
121 views

How do I make my indices anti-clockwise, so I can cull triangles in OpenGL? (immediate mode)

At the moment, I'm attempting a basic game engine in OpenGL using immediate mode. I'm trying to render a cube. Cube is a class with the vertices, normals, and indices. Here is part of the Cube class: ...
4
votes
2answers
809 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, ...
1
vote
0answers
41 views

Light intensity on plain from angle

Given a vector (v) for the direction of light and a vector (n) for the normal of a plain. How can I calculate a rudimentary intensity value (i) where ...
1
vote
1answer
290 views

How can I fix the face/normal direction of my 3d mesh in blender/UE4?

So I am playing around with UE4 to make some concept art for a game. I extracted the model I wanted to use from the game's files and imported it into blender. It's a tank with 4 parts: the hull, the ...
0
votes
2answers
355 views

Calculating vertex normals to be able to have both sharp edges and smooth gradients

I'm computing area-weighted vertex normals, but lighting looks bad on meshes containing sharp edges and corners (e.g. cubes look 'blobby' as the light leaks onto the dark sides). Is there a way of ...
0
votes
1answer
243 views

Invisible mesh. Are my normals, normal?

I'm creating this mesh during runtime in Unity3D. The mesh shape is ok, but as you can see on this screenshot, the mesh is not correctly rendered: it's only rendered when the camera is looking back ...
1
vote
0answers
747 views

C++ Modern OpenGL - Calculate Vertex Normals

I'm learning modern OpenGL and i just got started so go easy on me :). Right now im trying to understand normals but im having some difficulties. On my program i have this class which i use to draw ...
1
vote
1answer
81 views

What are projection independent ways of determining whether a normal is facing the viewer?

A position v and normal n are given in world coordinates. Also there is a view matrix V for ...
0
votes
0answers
267 views

Unity 5.3.1: Black spots on terrain after applying normal map

When applying a normal to a terrain texture and elevate the area, I see blackness on the side the light is shining. Any idea what is going on here? Here you can see what I mean (added cube to show ...
4
votes
1answer
426 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 is ...
1
vote
1answer
309 views

Normal matrix space has to be eye space?

I'm doing lighting in world space (not in eye space), so I set the normal matrix as follows: ...
1
vote
1answer
107 views

Effect of vertex winding on normals and shading

I have implemented a Phong and Gourand shader for a triangle mesh that is being imported from an STL file. It appears to be working fairly allright but some triangles seem to be what I can only ...
5
votes
1answer
456 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......
0
votes
2answers
2k views

How can I make a trail renderer flat with the normal of the nearest face?

I'm making a basic skid system for a car model using a trail renderer. I have everything setup and working properly except that the trail renderer always faces the camera. I want the trails to be ...
0
votes
1answer
126 views

World Space Normals Are Black

My world space normals appear fine for most of a mesh. However, some of the normals are black. I was wondering if anyone had any ideas why this is. This happens for any mesh, not just this sphere. ...
3
votes
1answer
1k 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 ...
2
votes
0answers
54 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....
3
votes
1answer
102 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
1
vote
2answers
101 views

Malformed/Pixelated Vertex Normals

I am trying to generate vertex normals for a given triangles/vertices list with the following code: ...