Tag Info

Accepted

What is a vertex color?

Vertex colors aren't that relevant when you have a fully textured 3d mesh. But it gets interesting when you have an untextured but colored mesh. In that case you assign a color to every vertex. The ...
• 120k
Accepted

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

You could easily find the normal by calculating two vectors, V1 = P2-P1, and V2 = P3-P1, and then find the cross product N = V1 x V2. Then you normalize N. Depending on the ordering of the vertices (...
• 507

What is a vertex color?

In theory, Vertex Color allows to color a model without having to bother with textures. This is quite common in CAD. In practice, it's just one more slot you can use to push data into the vertex, ...
• 9,935
Accepted

3D models budget. What matters more number of triangles or vertices

Let's imagine a big grid mesh, like one we might use for terrain. We'll render n triangles worth of it, covering say half our 1080p screen, in a single draw call. ...
• 135k
Accepted

How to randomly generate biome with perlin noise?

There are three main steps here: Use some method to assign biomes to regions (this is the hard part, with multiple strategies I'll break down shortly) For each point in your mesh or tile/node in ...
• 135k

What are normal, tangent and binormal vectors and how are they used?

I know this is old but i would like to add a little practical information. As stated by others but more specifically related to graphical programming. A Normal aka (a surface normal) is orthogonal to ...
• 101

What is a vertex color?

Vertices can have colors, it's a property just like the normal of it. In 3d enviroments a triangle gets colored based on their vertices' color information. The closest fragments to vertex A get the ...
• 14.9k
Accepted

How does the following code generate a full screen quad?

it doesn't generate a quad, instead it generates a fullscreen triangle. The outputs end up as: ...
• 7,381
Accepted

When does it make sense to use Index Buffers?

The example you use of a cube is a very specific, and somewhat contrived, one where indexing does not provide it's full benefit. For most real-world examples the constraints you mention do not exist, ...
• 20.2k
Accepted

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

Typically, your list of indices looks like this: ...
• 135k
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 ...
• 135k

Generating a UV map for a procedural mesh

If we take as the requirements: no distortion no constraints on seam placement OK to overlap faces then we can use a pretty simplistic approach, independently rotating each face into a 2D plane and ...
• 135k

I want to cut a pizza slice out of a 2D circle using mouse input in Unity. What data structures and geometric formulas would be best for this?

In theory this isn't that complicated -- given a point a somewhere on the surface of the circle, project a ray from the center of the circle through that point of length r. The endpoint of that line ...
• 1,690

Easy way to edit vertex attributes

You could simply use multiple textures on the vertices, where each channel of each texture contains the value of some attribute. Then you can paint the attributes in any program that allows you to ...
• 2,632
Accepted

Easy way to edit vertex attributes

If you use weight painting instead of vertex colors, you could export the model in any format that supports skeletal animation.
• 9,029

Algorithms for calculating vertex normals in 2D polygon

First, obtain the normals for each edge of the polygon. The normal for an edge is given by the normalized cross product of the edge vector (p2 - p1) with the 2D ...
• 932
Accepted

What does 'vertex splitting' mean?

As described in the two answers I linked in the comments, each vertex we send to the GPU is one unique combination of {position, normal, texture coordinate 1, texture coordinate 2, tangent, vertex ...
• 135k

What is the use of multiple vertex color sets

Vertex colours are just arbitrary extra data you can pack into a mesh - you don't have to use them as literal colours when rendering. So frequently, these get used as control weights for a variety of ...
• 135k

Accepted

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

Solved by reversing the indices for the problematic bottom face. Indices are now: ...
• 51

It is actually easier than you think. The way this works is really simple, it is a lot like video. So, when you watch a video(I am sure you know this already but just as a reminder) you are not ...
• 482

3D models budget. What matters more number of triangles or vertices

Neither. Unless you're talking truly massive numbers of tris (millions), what you care about is: Number of rendered pixels Cost of fragment shader Number of draw calls (with the limit strongly ...
• 9,935
Accepted

Matrix transformations vs manipulating vertex data directly

It's usually faster to use matrices and keep the vertices the same for multiple reasons: The GPU makes optimizations based on the fact, that the vertices don't change. There are ways to make OpenGL ...
• 14.9k

OpenGL NDC initial values

In whatever coordinate system you want. It doesn't matter for OpenGL, it only needs to receive them in NDC at the end. For example, if you want an ortographic projection, where 1 unit equals 1 pixel ...
• 14.9k

Why is the depth test not done on geometry before rasterization?

You can determine if a triangle is behind another triangle. However, that's not the operation you would need to do if you wanted to do culling at the triangle level. You would have to determine if ...
• 1,237