24

Triangles, the reason is triangles' ratesrization algorithm is faster, and also natively supported in hardware. So it would be faster to convert one quad into two triangles and do the rasterization. Actually that is what happens when you draw a quad on modern graphics hardware. So the question is what makes it faster ? There are certain characteristics in ...


14

"Cracks" in the geometry mostly. These games have a few things in common, they have gravity and they have collision detection. These anomalies are locations where the collision detection failed in some way. It could have been sharp edges, gaps or a number of other geometry anomalies. Could even been issues with time steps in the physics engine, where the ...


12

I would try using a hash table for this (for instance, std::unordered_map if you're in C++). Build a hash table that maps from a half-edge (expressed as a pair of indices, in order) to the third index of the triangle the half-edge belongs to. This can be built by simply iterating over the triangle list and adding each triangle's three half-edges to the ...


11

There are three reasons collision margins may exist in physics simulations. As you suggested, a collision margin gives the physics engine some room for error in detecting contacts and resolving contacts, prior to actual penetration. This helps with the appearance of realism as objects do not visibly poke through the ground, etc. There are nuances here for ...


9

Your idea is correct, you just have to work more on it. Here is an article I wrote last year: http://blog.meltinglogic.com/2013/12/how-to-generate-procedural-racetracks/ It uses exactly what you described, and as you can see, the result is very good. Here is the code which explains how the mesh was generated from the spline: for(float i = 0; i <= 1.0f;)...


9

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 replace the mesh with a completely new one, create one with Mesh mesh = new Mesh(); and assign it to your object with GetComponent<MeshFilter>().mesh = mesh; When you intend to modify the ...


8

Alternatively - to provide an easier-to-implement and more efficient solution - one can check the mesh's Euler-Poincaré characteristic. Given the number of vertices V, number of faces F and number of edges E. A triangle mesh is a closed 2-manifold, if and only if V + F - E = 2. If you store your mesh as a list of vertices and indices, V and F can ...


7

vec3 norm = vec3(uViewMatrix * uModelMatrix * aNormal); The normal cannot be transformed like a point, to transform a normal you use the inverse transpose matrix. If you want the fun details of why this is here is a qoute from the OpenGL Red Book that explains it better then I ever will: Mathematically, it's better to think of normal vectors not as ...


7

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 not say it took us five years, but definitely not less than a year :) There are several problems with the simplistic approach you're describing. First of all, ...


7

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 closer to the actual description of the surface (i.e. the backing 3D array), than optimising yourself into a place where it's not as easy to change the mesh when you ...


6

Good day y'all! I've implemented knight666's answer from pseudo-code to Unity-code (C#). Some slight changes were needed but it works like charm, just attach the script to an enemy. I don't know if there are more efficient ways to do some of the things. One thing worth mentioning is that the number of vertices can be reduced from 4*quality to 2*quality+2, ...


6

For a triangle with points p0, p1, and p2, and normal n, you’ll need to compare the vectors cross(p1 - p0, p2 - p0) and n. They should either point in the same direction, or in the opposite direction, for all triangles in your mesh. Suppose your convention is that the vectors must point in the same direction. The algorithm is simple. For each triangle, ...


6

Yes it matters but there's no general rule, it depends on the specific scenario and requirements. Here's some hints: 1 Mesh Scenario Pros: Reduce drawcalls(state changes). Cons: No occlusion culling(it's done on a per GameObject resolution in Unity) Potentially time consuming updating the required vertices (depends on the geometry complexity, but for a ...


6

If you just need it once, I'd suggest you pick up some basic knowledge of a modelling tool. It's very easy to do in Blender: Delete the cube that you start with by pressing DEL. Create an UV Sphere primitive. This will create a sphere with radius 1.0 (Note: In the lower left corner you can edit the properties (segment/ring count, radius) of the sphere after ...


6

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 it took me an afternoon or so to find and modify this. First up is the Icosphere generation code, you just need to have this in a script but not on any objects. ...


6

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 plane made out of triangles, but vary the color of the triangles. Either use shades of green, or have both green and brown for grass and dirt, maybe white for ...


6

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 system that morphs different parts of a mesh? I don't know if there is any commonly agreed way of doing this, but basically what you are asking is not as ...


6

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” in the code to store an integer value which encodes the type of each block. You’d need at least 1 bit for orientation, and then you could use the rest to store ...


5

I think it's not possible to say that there is one particular reason why clipping through the world happens. Due to the differences in game engines/ physics procedures between games, any number of reasons can lead to this. Stemming off this, I'm quite sure that falling out of the world has not been eliminated, necessarily. Having a few large-scale game ...


5

I'm assuming you opened the file in Notepad. Notepad doesn't recognize some new line formats. The OBJ format does indeed use newlines as delimiters, and your files likely contain them. It's just not looking that way in Notepad. Try opening them in Notepad++ instead: I'll bet they'll appear correctly. To make sure your parser function works correctly on all ...


5

I'm not a lawyer, but this is my interpretation: Found in the Terms of Service linked in the footer of the page you linked, this is the notice given to people uploading their content: The Services allow you to submit content, including 3D models in the SketchUp and Keyhole Markup Language (KML) formats. You retain ownership of any intellectual ...


5

Let us consider the parametric definition of a sphere: where theta and phi are two incrementing angles, that we will refer to as var t and var u and Rx, Ry and Rz are the independent radii (radiuses) in all three cartesian directions, which, in the case of a sphere, will be defined as one single radius var rad. Let us now consider the fact that the ... ...


5

My guess would be that older engines probably used a quick and simple ray vs triangle test to detect collision with the geometry. That means even the tiniest gap (or a precision error in the calculations) could let the player through occasionally. More modern games will probably use a more expensive test with a sphere or capsule representing the player, and ...


5

Here is my suggestion. You just need two vectors. in the first triangle, choose the normal vector, n1 in the second triangle, choose a vector e2 from a point on the shared edge to the point not on the shared edge. Then compute their dot product: n1 . e2. If it’s positive, the angle is acute. If it’s negative, the angle is obtuse.


5

You can Destroy the component. Be careful about which object you destroy, though. If you pass a GameObject to Destroy, you will destroy the entire thing. To destroy the component, you must pass a reference to that component specifically. //example: destroys the MeshRenderer attached to this GameObject var sphereMesh = GetComponent(MeshRenderer); Destroy(...


5

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 you a planar projection: The effect is like shining your texture onto the object using an orthographic projector, along one directional axis. Portions of your ...


4

Yes, interleaved is worth it. Interleaved VBOs has no effect on the size of data. Even with separate VBOs for each attribute, you only have a single index buffer, so you need to duplicate any vertex attributes appropriately. That means that you have a single value of an attribute shared by multiple vertices, you must duplicate it for each vertex, no ...


4

You can still generate meshes per chunk, but to ensure the edges line up, you need to access voxels outside the current chunk. So, your chunks need to know about each other. When accessing a voxel in a chunk, have it access the 'world' level to retrieve the voxel. The 'world' level shouldn't care about which chunk a voxel is in. So inside your chunk it would ...


4

If the result in the image satisfies you, here's how I achieved it. Subsurfed the initial cube once Created a second cube and scaled it Added a boolean modifier to the first cube and chose union Selected the second cube as the modifier target object Ctrl+P Set the first cube as parent of the second so that both move together when moving the first cube Tab ...


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