villadelivery.blogg.se

Blender dmesh
Blender dmesh









blender dmesh
  1. #BLENDER DMESH FOR FREE#
  2. #BLENDER DMESH DRIVER#

When benchmarking indexed drawing in the blender institute, I found a pleasant surprise: Even though full triangle meshes need some extra storage for indices and will not use tranformed vertex cache, the NVIDIA driver in my GPU still draws such meshes faster. Here we only contemplated on a simple position – normal format, but if we include UV layers, tangents and whatnot, cost per vertex is much higher and so is the cost of data duplication and the savings we get when we avoid it. However, given that good topology is based on quad meshes and that data savings get more substantial with more complex data formats, the benefits by far outweigh the issues. In full triangle mesh case, we end up using more memory (remember, those tricks work only if triangles belong to the same ngon). Also, they only save us memory if we use quads and ngons. Vertex indices require a small amount of storage, which is 1 integer per vertex, or 3 per triangle, so they are not free.

#BLENDER DMESH FOR FREE#

Not only have we eliminated data duplication, but every time a duplicated vertex is encountered, we get it for free (almost). Every time a new vertex index is encountered, the GPU checks if the index exists in its cache and if it does, the GPU avoids all shader work on that vertex and reuses the result of the cache. GPUs have a small cache of vertex indices where vertices that are transformed by the vertex shader are stored. This does not only de-duplicate vertex data but has another benefit. Using this, what we do is upload all vertex and normal data once and then use indices to create triangles from these data. OpenGL has an easy way to to reuse data, called “indexed drawing”. Blender does allow normals of different polygons to be different for each vertex, but vertices and normals that belong to the same polygon are the same. The problem is that this introduces quite a lot of data duplication as you can see in the following picture:Īs is evident, Position 1, Normal 1, Position 3, Normal 3, and Position 4, Normal 4 are used duplicated for each triangle that uses those data. For simplicity let’s consider an Ngon with 5 vertices with position and normal data. Currently blender writes all data associated with a triangle in a buffer and draws the buffer with a single command. Reusing vertex data with indexed drawingīlender uses tessellation to convert quads and ngons to triangles, the only diet a GPU can consume. Warning, this will get very technical, very quickly.











Blender dmesh