How to optimize a mesh which I manually aligned - blender

I manually aligned a mesh to another mesh. Two meshes have different topologies. The resulting mesh does not have a flat and smooth surface as is illustrated in the first picture.
My question is that, if there exist algorithms or tools such as a function inside meshlab or blender etc. that can smooth and optimize my mesh.
This is my mesh.
And I want to optimize it such that it is smooth like this:

I don't see the relation between "I manually aligned a mesh" and "resulting mesh does not have a flat and smooth surface". The aligned mesh should be similar to input mesh.
Despite that, try to apply the Meshlab filter Taubin Smooth to your mesh to rearrange the topology without introducing big deformations.

Related

How to automatically tessellate a triangle's edge at T-vertices

My 3D mesh contains T-vertices. I want to keep all vertices, but automatically subdivide triangles's edges that run through/past such a vertex.
Here's an
image showing triangles with t-vertices, and after the tessellation
that I'm looking for.
I started implementing some code but really think this must already exist.
The question is if your input mesh consist on plain triangles (in which case you can't have neighbors, because you can have several neighbors by each edge) or your mesh consist on "triangle shaped polygons".
If your input are triangles, meshlab won't solve your problem.
If you have polygons, you can use the "convert mesh into pure triangles" filter.

How to keep Gmsh mesh in the bounding curves?

i am quite a beginner in Gmsh and am trying to create a mesh for hydrodynamic simulation from coastlines. I used splines for the complex coastline for simplicity, but the produced mesh crossed over the coastlines. What should i do to make the mesh not cross over the bounding curves?
Image for reference
Your mesh is simply to coarse in the moment. The points of each Triangle in the mesh lie on the real geometry/coastline but the edges are linearly connected and do not care about the geometry.
In order to refine the mesh you might try to press Mesh->Refine by Splitting a couple of times and see split the few current cells. The mesh should get finer and should not violate the geometry boarder by as much as right now.
BUT by this you'll only make the "issue" less obvious to see. On a smaller scale you will always see mesh cells that are partly "outside" the geometry borders. You cannot prevent this with concave meshes like the one you have here. If you have s.th. convex like a circle all elements will strictly lie inside the geometry border.
So as a first step, make a finer mesh until you are satisfied with the match between geometry and mesh.

How does Blender calculate vertex normals?

I'm attempting to calculate vertex normals for various game assets. The normals I calculate are used for "inflating" the model (to draw behind the real model producing a thick outline).
I currently compute the normal for each face and average all of them (several other questions on Stack Overflow suggest this approach). However, this doesn't work for sharp corners like this one (adjacent faces' normals marked in orange, the normal I'm trying to calculate is outlined in green).
The object looks like a small pedestal and we're looking at the front-left corner. There are three adjoining faces (the bottom face isn't visible; its normal points straight down).
Blender computes an excellent normal that lies squarely in the middle of the three faces' normals; it seems like it somehow calculates a normal that has minimum rotation to each of the three face normals. Blender's normal also doesn't change when the quads are triangulated differently.
Averaging the faces' normals gives me a different normal that points slightly upward in the Z-axis (-0.45, -0.89, +0.08). Inflating my model this way doesn't produce a good outline because the bottom face of the outline is shifted up and doesn't enclose the original model.
I attempted to look at the Blender source code but couldn't find what I was looking for. If anyone can point me to the algorithm in the Blender source, I'd accept that also.
Weight the surface normals by the angle of the faces where they join. It is a common practice in surface rendering (see discussion here: http://www.bytehazard.com/code/vertnorm.html), and will ensure that your bottom face is weighted stronger than the two slanted side faces. I don't know if Blender does it differently, but you should give it a try.

Blender Bending the elbow the right way on character

I started learning character rigging in blender, and when I add a mesh to the armature, the arms on the mesh look twisted. I've tried changing the rotation on the arm with the pole angle in the bone constraints, and it works but it also changes which way the elbow bends. What other way could I rectify this, so that the elbow bends the right way but the mesh doesn't look twisted.
In situations like this I always find it easiest to enable weight painting. This lets you select each bone, and see which vertices in the mesh they deform, and by how much. Try doing this, and looking around your elbow. You can paint the weights onto the mesh or remove them if you want, until you have each bone affecting the parts you want it too.
Note that every vertex must have all of it's weights combine to 100%, otherwise they will drag behind the character when you move it.

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

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 let OpenGL ES 2.0 make a flat shade on each face?
Similar question Similar Stackoverflow question, but no suggestion to solution
Because in order to have shading on your mesh (any, smooth or flat), you need a lighting model, and OpenGL ES can't guess it. There is no fixed pipeline in GL ES 2 so you can't use any built-in function that will do the job for you (using a built-in lighting model).
In flat shading, the whole triangle will be drawn with the same color, computed from the angle between its normal and the light source (Yes, you also need a light source, which could simply be the origin of the perspective view). This is why you need at least one normal per triangle.
Then, a GPU works in a very parallelized way, processing several vertices (and then fragments) at the same time. To be efficient, it can't share data among vertices. This is why you need to replicate normals for each vertex.
Also, your mesh can't share vertices among triangles anymore as you said, because they share only the vertex position, not the vertex normal. So you need to put 3 * NbTriangles vertices in you buffer, each one having one position and one normal. You can't either have the benefit of using triangle strips/fans, because none of your faces will have a common vertex with another one (because, again, different normals).