Skip to main content
29 votes
Accepted

How do game engines avoid recalculating normals upon mesh rotation?

They don't. When you rotate a mesh, the normals in memory are not changed in any way. All that changes is the object's transformation matrix is updated. The raw mesh vertex and normal data remains ...
DMGregory's user avatar
  • 136k
16 votes

How do game engines avoid recalculating normals upon mesh rotation?

DMGregory's answer explains how this is actually handled, but I'd like to point out a couple of misconceptions: Assume that a face of a mesh is defined by vertices ...
Kevin Reid's user avatar
  • 5,543
10 votes
Accepted

Performance of manipulating a mesh in realtime

Yes, you can change a mesh at runtime. get the current mesh from your object using Mesh mesh = GetComponent<MeshFilter>().mesh. Alternatively, if you want to ...
Philipp's user avatar
  • 121k
7 votes

Applying a face image to a mesh head

I am one of the developers of the itSeez3D application you linked in your post. Accidentally stumbled upon your question. @Kevin van der Velden provided an entirely relevant reference here, I would ...
Aleksei Petrenko's user avatar
7 votes
Accepted

How do I generate a sphere mesh in Unity?

So, I've already done some research on this and I've found an Icosphere generation code on Unity Wiki and it's not terribly hard to find, but still I wanted to share what I have on the matter, since ...
John Hamilton's user avatar
7 votes

Texturing different block types on an optimized voxel mesh

Nice idea by the author. From experience... High vertex counts aren't that much of a problem (100Ks, millions even). Dealing with complex UV mapping is far more so. Sometimes it is worth staying ...
Engineer's user avatar
  • 30.2k
6 votes
Accepted

How to make low poly ground look better

A texture is a simple idea. You say you've tried some and they didn't look good. If you created the texture out of polygons would it look better? Or better yet, maybe try making the ground a flat ...
user1118321's user avatar
  • 2,642
6 votes
Accepted

Texturing different block types on an optimized voxel mesh

Quoting the meshing page you link: It isn’t too difficult to modify the code deal with either multiple block types or different normal directions. What you would do is modify the array called “mask” ...
DMGregory's user avatar
  • 136k
6 votes
Accepted

What is the purpose of tangent and bitangent vertex attributes?

Tangent and bitangent vectors are used for tangent space normal mapping / lighting and certain forms of displacement mapping. In a tangent space normal map, we store the per-pixel normal in the ...
DMGregory's user avatar
  • 136k
6 votes

Should I model with quads or with n-gons?

It doesn't really matter. 3d models with faces that have more than 3 vertices don't really exist in 3d graphics*. They are a usability-convention of the modeling program. 3d rendering engines can only ...
Philipp's user avatar
  • 121k
5 votes
Accepted

How do you compute the tangent space vectors with normals given in the mesh?

Summarizing the clarifications above as an answer: There are multiple ways to generate tangent spaces for a mesh, and not all of them agree on the result. This is a common source of rendering errors ...
DMGregory's user avatar
  • 136k
5 votes
Accepted

How can I convert my list of vertices and indices to a list of triangles?

Typically, your list of indices looks like this: ...
DMGregory's user avatar
  • 136k
5 votes
Accepted

How to UV map a procedural cylinder mesh? (Unity)

It looks like you're trying to use (rotated) vertex positions as UV coordinates. When you're using this to look up into a 2D texture, only the x & y values are used and the z is ignored, giving ...
DMGregory's user avatar
  • 136k
5 votes

How does 3D mesh morphing work?

In the Sims 4, you can drag to reshape the face when you create a sim. How is the geometry morphing implemented? Only guys with access to the code can tell you that. In general, how do you code a ...
wychmaster's user avatar
5 votes
Accepted

How does LOD (Level of Detail) work in Unity?

Unity doesn't generate FBX files. The Unity Editor lets you import FBX files, which Unity converts into its own propriety file formats when you build your game. Each LOD is a separate mesh and will ...
Kevin's user avatar
  • 6,544
4 votes

Performance of manipulating a mesh in realtime

As Philipp said, you can change the mesh at runtime. You might have performance issues though (it's not "streaming" at all); in particular RecalculateNormals will ...
Calvin1602's user avatar
4 votes

How does 3D mesh morphing work?

We do not know the details of how they did it… However, there is a modding community for The Sims and they manage. The idea is as follows: There is one base model for body type. There are series of ...
Theraot's user avatar
  • 27.3k
4 votes
Accepted

GridMap centers meshes of different heights in cell

Select (or open) the MeshLibrary, and on the top bar you should see a "MeshLibrary" menu, there select "Update from scene" and select "...
Theraot's user avatar
  • 27.3k
4 votes
Accepted

Can I convert a Unity file with the extension ".asset" to ".prefab"?

You do not "convert" an asset to a prefab. These are different things that serve different purposes. A prefab is a game object that can exist in your scene. An asset is the raw data that a ...
DMGregory's user avatar
  • 136k
3 votes
Accepted

How to calculate verticle normals of triangular mesh

It looks like some normals are pointing the wrong way. This means that those triangles aren't wound correctly. As a quick fix you can do: ...
ratchet freak's user avatar
3 votes

Should the level design be in Unity scenes (GameObjects) or in 3D programs (mesh)

This is very project dependent. Every studio, group, and developer has a preferred method. Generally, you use meshes when it's easier to construct something in your 3D editor rather than the scene ...
Zebraman's user avatar
  • 819
3 votes

How to have multiple GameObjects sharing pieces of same material?

Have you looked into using Unity's Shadergraph to make your own shader for the material? You might be able to achieve what you want by using the worldspace position for texture/uvs. I am not good at ...
faulknerj's user avatar
3 votes
Accepted

Architecture for defining large numbers of meshes at runtime

You may want to take a look at Graphics.DrawMesh. It lets you draw individual meshes without individual GameObjects.
Ed Marty's user avatar
  • 5,239
3 votes

How to make procedurally generated terrain look realistic

First of all, note that Unity already has a very nice terrain system out-of-the-box. It gives you a lot of nice features for free like LOD, occlusion culling and a lot more. Also, it can look pretty ...
Philipp's user avatar
  • 121k
3 votes
Accepted

How to know if two surface are in the same direction?

Imagine applying a force along those normals to the faces. If the normals both face in the same direction (e.g. outward), then it would have a book closing effect, the faces would get closer. If they ...
Bálint's user avatar
  • 15k
3 votes
Accepted

Mesh made in Blender is correct in Unity3D as a rendered mesh, but "empty" as a collider?

this is just a guess that I am pulling out. but I see a missing line on the side of your stairs. No line showing up in unity seems like a hint. you can see triangles 012, 234, and 145 because of the ...
Jody Sowald's user avatar
3 votes
Accepted

How to cut a desired shape out of a mesh?

I have done this for automated medical CAD procedures as well as game engines, and will attempt to provide adequate information in order for you to accomplish this task on your own, but I will not be ...
Jon's user avatar
  • 534
3 votes

How to cut a 3D mesh like a lathe?

I implemented the effect by doing a virtual lathe. I used Unity for simplicity, but this can be done in pretty much anything. First I had to generate a cylinder: Instead of simply doing a normal ...
Bálint's user avatar
  • 15k
3 votes
Accepted

To split or not to split large 3D objects?

This question is actually anything but simple :) There are several advantages to splitting a large object, but they are situational: Each of those objects can have an own LOD group. If you set up ...
Philipp's user avatar
  • 121k
3 votes
Accepted

Procedural mesh comes out black in any shader

If you don't explicitly provide normals to your newly-made mesh, they'll be left at their default values, and the default value of a Vector3 is (0, 0, 0). Any ...
DMGregory's user avatar
  • 136k

Only top scored, non community-wiki answers of a minimum length are eligible