normals

Normal vectors for an eight vertex cube

痴心易碎 提交于 2019-12-02 05:22:22
I was playing around with WEBGL and today and a encountered a problem with my cube's vertex normals . I checked my code with a cube mesh from internet and it works great. The thing is that the cube from internet has 24 vertices (4 for each face * 6 faces) which is way to much for I cube I think. FIDDLE MY CUBE | FIDDLE INTERNET CUBE (my code stars at line 200) I figured out that a cube needs no more than 8 vertices and 12 indices. But when I render my cube I get a weird shape on screen like this(because of the normals?): This is the cube form internet in almost the same rotation position as my

Smooth cone normals

谁都会走 提交于 2019-12-01 13:27:28
I'm trying to calculate smooth normals for a cone. In looking around for code samples and explanations, I consistently come across directions for face normals. I've posted a couple pictures below of what I'm doing. The first -- which basically just normalizes the vertex position -- gives me decently smooth shading, but the edges are "missing" and the bottom face isn't solid. The second has edges, but the shading is flat (face normals) and my light isn't reflecting off of them correctly. The cone is built out of GL_TRIANGLES. Click the images for larger versions. (source: bantherewind.com )

How to correct winding of triangles to counter-clockwise direction of a 3D Mesh model?

ぃ、小莉子 提交于 2019-12-01 06:22:32
First of all let me clear .. I am not asking about 2D mesh, to determine the winding order of 2D mesh its very easy with normal-z direction. Second is, I am not asking any optimized algorithm, I do not worry about the time or speed, I just want to do it with my mesh. When I triangulate a 3D object using Greedy Projection Triangulation algorithm, This problem happens. check the attached images. If I apply 2D approaches to this model using "Calculate Signed Area" or "Cross production of AB and BC vectors of a triangle", it only solves the 2D mesh but how about a 3D mesh? First we need to check

Flip normals in three.js on sphere

时间秒杀一切 提交于 2019-12-01 05:44:23
I have been searching around and haven't found any really good answer to my question yet.. The thing is that I have this sphere.. just a basic sphere, and I want to flip the normals so the sphere gets the sort of "hollow/carved effect" and then plater on apply my textures to the "inside" of the sphere. any ideas of how to flip the normals? Also.. if its not possible to do this in three.js.. would it be possible to import a model where the normals are already flipped and get the effect I'm looking for? You can flip the normals in your geometry by reversing the winding order of your faces. You

How to correct winding of triangles to counter-clockwise direction of a 3D Mesh model?

不羁岁月 提交于 2019-12-01 04:59:59
问题 First of all let me clear .. I am not asking about 2D mesh, to determine the winding order of 2D mesh its very easy with normal-z direction. Second is, I am not asking any optimized algorithm, I do not worry about the time or speed, I just want to do it with my mesh. When I triangulate a 3D object using Greedy Projection Triangulation algorithm, This problem happens. check the attached images. If I apply 2D approaches to this model using "Calculate Signed Area" or "Cross production of AB and

Flip normals in three.js on sphere

半腔热情 提交于 2019-12-01 02:56:46
问题 I have been searching around and haven't found any really good answer to my question yet.. The thing is that I have this sphere.. just a basic sphere, and I want to flip the normals so the sphere gets the sort of "hollow/carved effect" and then plater on apply my textures to the "inside" of the sphere. any ideas of how to flip the normals? Also.. if its not possible to do this in three.js.. would it be possible to import a model where the normals are already flipped and get the effect I'm

How to unify normal orientation

主宰稳场 提交于 2019-12-01 01:23:58
问题 I've been trying to realize a mesh that has all face normals pointing outward. In order to realize this, I load a mesh from a *.ctm file, then walk over all triangles to determine the normal using a cross product and if the normal is pointing to the negative z direction, I flip v1 and v2 (thus the normal orientation). After this is done I save the result to a *.ctm file and view it with Meshlab. The result in Meshlab still shows that normals are pointing in both positive and negative z

Three.js: Convert face normal from local space to world space

梦想与她 提交于 2019-11-30 23:10:15
I have a THREE.PlaneGeometry , with ComputeFaceNormals() . I create two meshes using this geometry, with different rotations applied to them. I want to compute the two angles between the camera and the two meshes central face normal. It should be : vLocalCamera = vCamera.position - mesh1.position; mesh1.normal() . vLocalCamera = cos(angle); The problem is that I don't know how to get the mesh normal in world coordinate (from geometry and mesh rotation) with three.js API If you want to convert a face or vertex normal, normal , from local space to world space, you do it like so: var normalMatrix

Can I specify per face normal in OpenGL ES and achieve non-smooth/flat shading?

ぐ巨炮叔叔 提交于 2019-11-30 18:51:12
I want to display mesh models in OpenGL ES 2.0, where it clearly shows the actual mesh, so I don't want smooth shading across each primitive/triangle. The only two options I can think about are Each triangle has its own set of normals, all perpendicular to the triangles surface (but then I guess I can't share vertices among the triangles with this option) Indicate triangle/primitive edges using black lines and stick to the normal way with shared vertices and one normal for each vertex Does it have to be like this? Why can't I simply read in primitives and don't specify any normals and somehow

Calculating normals between 2 meshes ending up in seams

萝らか妹 提交于 2019-11-30 12:22:11
My Task I currently creating a terrain for Unity3D which is specialized for mobile-devices with low memory for a running app. Allowing a terrain with a size of 15.000 x 15.000 kilometers and a height from -1.000 meters to 10.000 meters and it's only limits are the space on the hard disk. Situation Everything is running fine right now except that the normals between different meshes ( each mesh has a subdivision level ) are not calculated correctly. Here are two pictures which visualize the problem: The problem only occurs on a transition from one subdivision level to another. If both mesh have