Showing posts with label vertex colors. Show all posts
Showing posts with label vertex colors. Show all posts

IDMapper add-on for Blender is now free

 In a previous article I mentioned that I stopped publishing add-ons on blender market because basically I was done with it it: I didn't earn enough to warrant the amount of effort that goes into maintaining and supporting add-ons.

However, there is still quite some interest in some of the add-ons, and so I decided to open source some of the add-ons and make them available for free. The first one was Snap! then it was Weightlifters turn, my very first add-on published on BlenderMarket (now Superhive), back in 2014 (!), and now IDMapper.

Technically IDMapper already was open source, at least the source code was, but now I'm also open sourcing the manual, and that means that you can download the source from this GitHub repository (the releases section), and the manual is available too.


This repository is still a work in progress, but the code will run on 4.4. For now, simply download weightlifter.py and use the install from filesystem in the add-ons section. Then read the manual!


To give you some idea of its capabilities, there is a video on YouTube.



Weightlifter add-on for Blender is now free

Weightlifter


In a previous article I mentioned that I stopped publishing add-ons on blender market because basically I was done with it it: I didn't earn enough to warrant the amount of effort that goes into maintaining and supporting add-ons.

However, there is still quite some interest in some of the add-ons, and so I decided to open source some of the add-ons and make them available for free. The first one was Snap! but now it is Weightlifters turn, my very first add-on published on BlenderMarket (now Superhive), back in 2014 (!)

Weightlifter is the Swiss army knife of recording mesh attributes to vertex weights or -colors. Anything from whether a vertex is visible from the camera to its slope or curvature can be converted to weight maps or vertex colors, and much more.

Technically Weightlifter already was open source, at least the source code was, but now I'm also open sourcing the manual, and that means that you can download both the source and the manual from this GitHub repository.


This repository is still a work in progress and the manual hasn't been updated for Blender 4.x yet, but the code is and will run on 4.4. For now, simple download weightlifter.py and use the install from filesystem in the add-ons section. Then read the manual!


To give you some idea of its capabilities, there is a video playlist on YouTube (but they show old versions of Blender).


IDMapper add-on verified for Blender 4.1

  


I am pleased to announce that IDMapper is now verified for Blender 4.1. 

It has been tested against version 4.1.1 of April 16, 2024, and no changes were needed.

Blender 4.0 introduced quite a few breaking changes, so this version is not backwards compatible with 3.x

Although no new functionality was introduced in this release, please be aware of the following:

  • IDMapper can currently not work with facemaps, because they are no longer supported in 4.0. This may change in the future (hopefully, see this discussion) and if possible I will try to get this back into IDMapper. Meanwhile, I did create a small, free add-on to make selecting faces from facemaps possible in 4.0 which may be useful in some workflows.
  • Color picking in Face Paint Mode (with the S-key) is no longer restricted to the 3d-View area, so colors can be picked from anywhere in the Blender application (although still not outside of it).

IDMapper simplifies creation and editing of vertex color layers that can be used as ID-maps in texturing software like Substance Painter or Quixel. It aims to reduce the time it takes to create an ID-map significantly, especially for complex hard surface models. It uses powerful heuristics to create an ID-map from scratch and lets you interactively adjust the results. It offers options to use existing information, like uv-seams, but can also intelligently assign the same color to similar mesh parts. 

The new version is available on BlenderMarket.

This previous article showcases some of IDMapper's functionality.

IDMapper add-on ported to Blender 4.0

 


I am pleased to announce that IDMapper is now available for Blender 4.0. 

It has been tested against the daily of November 3rd, but I expect no changes will be needed for the 4.0 release candidate or the final release.

Blender 4.0 introduced quite a few breaking changes, so this version is not backwards compatible with 3.x

Although no new functionality was introduced in this release, please be aware of the following:

  • IDMapper can currently not work with facemaps, because they are no longer supported in 4.0. This may change in the future (hopefully, see this discussion) and if possible I will try to get this back into IDMapper. Meanwhile, I did create a small, free add-on to make selecting faces from facemaps possible in 4.0 which may be useful in some workflows.
  • Color picking in Face Paint Mode (with the S-key) is no longer restricted to the 3d-View area, so colors can be picked from anywhere in the Blender application (although still not outside of it).

IDMapper simplifies creation and editing of vertex color layers that can be used as ID-maps in texturing software like Substance Painter or Quixel. It aims to reduce the time it takes to create an ID-map significantly, especially for complex hard surface models. It uses powerful heuristics to create an ID-map from scratch and lets you interactively adjust the results. It offers options to use existing information, like uv-seams, but can also intelligently assign the same color to similar mesh parts. 

The new version is available on BlenderMarket.

This previous article showcases some of IDMapper's functionality.

IDMapper ported to Blender 3.6 LTS

IDMapper has been ported to Blender 3.6 LTS

I am happy to announce that I have updated IDMapper to work with Blender 3.6.

It sports a few bug-fixes and internal changes to work with the newer Blender versions, and also has two bits of new functionality:

  • you can change the color of the help text shown in face paint mode, to better adapt it to your theme (in the add-on preferences), and
  • the IDMapper operator is now applied to all selected objects, instead of just to the active object. This ensures that assigned colors are unique across those objects. If you prefer the old behavior you can select that in the add-on preferences

I have also created a new demo video that shows the basic workflow when using the add-on in Blender 3.6



IDMapper simplifies creation and editing of vertex color layers that can be used as ID-maps in texturing software like Substance Painter or Quixel. It aims to reduce the time it takes to create an ID-map significantly, especially for complex hard surface models. It uses powerful heuristics to create an ID-map from scratch and lets you interactively adjust the results. It offers options to use existing information, like uv-seams, but can also intelligently assign the same color to similar mesh parts. 

The new version is available on BlenderMarket.

IDMapper ported to Blender 3.3 beta

IDMapper has been ported to Blender 3.3 beta

That may sound a bit premature, but I am confident no changes will be needed for the official release of Blender 3.3. However, if necessary we update the add-on again of course.

Note that this version will not run on older versions of Blender.

 

IDMapper simplifies creation and editing of vertex color layers that can be used as ID-maps in texturing software like Substance Painter or Quixel. It aims to reduce the time it takes to create an ID-map significantly, especially for complex hard surface models. It uses powerful heuristics to create an ID-map from scratch and lets you interactively adjust the results. It offers options to use existing information, like uv-seams, but can also intelligently assign the same color to similar mesh parts. 

The new version is available on BlenderMarket.

IDMapper just got support for face-maps

IDMapper just got support for face-maps

It is now possible to assign vertex colors based on the face-map membership of faces.


If your workflow involves face-maps already, it is now super easy to create a vertex color layer (ID-map) based on those face-maps.

IDMapper simplifies creation and editing of vertex color layers that can be used as ID-maps in texturing software like Substance Painter or Quixel. It aims to reduce the time it takes to create an ID-map significantly, especially for complex hard surface models. It uses powerful heuristics to create an ID-map from scratch and lets you interactively adjust the results. It offers options to use existing information, like uv-seams, but can also intelligently assign the same color to similar mesh parts. 

The new version is available on BlenderMarket.

IDMapper updated for Blender 2.83 LTS


I just finalized testing the IDMapper add-on and it's now ready for Blender 2.83 LTS.

IDMapper simplifies creation and editing of vertex color layers that can be used as ID-maps in texturing software like Substance Painter or Quixel.

It aims to reduce the time it takes to create an ID-map significantly, especially for complex hard surface models.

It uses powerful heuristics to create an ID-map from scratch and lets you interactively adjust the results. It offers options to use existing information, like uv-seams, but can also intelligently assign the same color to similar mesh parts.

There are no functional changes in this release but I did perform a small bug fix. However, if you don't encounter problems in your workflow, there is no pressing need to upgrade.

The new version is available on BlenderMarket.

New release of IDMapper

A new release of IDMapper is currently available on BlenderMarket
This new version is a bugfix release that besides minor fixes also fixes an error that might occur when trying to assign colors based on material ids. Furthermore the manual has been updated to reflect Blender 2.8x layouts and the add-on has been tested against Blender 2.81-beta.

New version of WeightLifter for Blender 2.80



A new version of WeightLifter (20190728) has been released on BlenderMarket.

I has some bug-fixes to keep it compatible to the latest release candidate but more importantly it sports an updated manual and a new feature to combine baked weight maps into one. This feature is useful if you use the maps as density maps in a particle instance and want to prevent frame-to-frame jittering for example. It is illustrated in this video


IDMapper ported to Blender 2.80


IDMapper has now been ported to Blender 2.80 and is available from BlenderMarket.

There were a fair number of bumps along the road with regard to some parts of the Python API so be aware that Blender 2.80 is still in beta and you might still encounter some difficulties!

WeightLifter ported to Blender 2.80


WeightLifter has now been ported to Blender 2.80 and is available from BlenderMarket.
Porting this add-on was a bit more work than porting NodeSet Pro, so be aware that Blender 2.80 is still in beta and you might still encounter some difficulties!

IDMapper: December 2017 release available on Blender Market

I have released an updated version of the IDMapper add-on to Blender Market.

New features

It features some cosmetic changes but more importantly it hosts a ton of new features developed based on user feedback, including:
Baking
you can now directly bake a vertex color layer to an image without the cumbersome route of setting up materials, emission shaders and dummy images necessary in the regular way. Just 1-click and a couple of seconds later you'ĺl have you color id-map as an image in the UV-image editor
Vertex groups to vertex colors
there is now an option to assign unique vertex colors based on vertex group membership of vertices. This 1-click option lets you quickly convert vertex groups to vertex colors
Create materials based on vertex colors
this option creates a material for each unique vertex color and assigns the vertices with this color to the material.
Better color list management
If you use a predefined list of colors to use in id-maps across different models the color list lets you manage these colors. It is now possible to add items to this list for any vertex color nor yet present, simplifying the maintenance of those lists
And of course there are lots of smaller improvements too.

The new features are highlighted in this video:

This video is part of a small playlist with additional tutorials:

Availability

IDMapper is available in my Blender Market shop:
https://blendermarket.com/creators/varkenvarken

New version of WeightLifter introduces baking and animation

A new version of WeightLifter is available on BlenderMarket.

WeightLifter is an add-on that can calculate all sorts of information and store this into vertex groups or vertex color layers. It can for example determine the visibility of vertices for a certain camera or the distance to some light source and much more, information that can for example be used as a density map in particle systems.

New features

The newest version introduces some new modes like calculating a flow map or the mesh deformation but the most exiting new feature is the ability to bake any weight map for each frame in an animation. This way can quickly regenerate a vertex group for each frame while rendering, effectively animating a weight map, something which is not possible otherwise.

To illustrate how to do this, I have created a short video that shows the workflow for creating an animated density map that lets the proximity to a lamp drive the emission of particles.

Add-on: make vertex colors unique across selected objects

Say you have carefully assigned vertex colors to your mesh to be used as a color ID mask in a texturing program. And now you want two copies of this mesh and you want to assign different materials while using the same texture set for both objects to save on the number of textures. Assuming you have given each mesh a uv-mapping that covers a different set of uv-coordinates this shouldn't be an issue if you could make the vertex colors unique across this meshes.
This is where this add-on comes in handy: it will count the number of vertex colors used in all selected objects and reassign colors in such a way that all the colors are unique with the selected objects.
For example, starting with two meshes with identical color assignments








You will end up with something like this:



Note that none of the colors used in the left mesh appear in the right mesh and vice versa.

Availability

As usual the add-on is available for download from my GitHub repository (right click on the link and select Save as ...)
After you have installed and enabled the add-on, a new menu entry will be available in object mode: Object → Make vertex colors unique.
It might be a bit odd not to have this in vertex paint mode but it operates on more than one selected object and selecting objects is not possible in vertex paint mode so this is a bit less inconvenient.

Version 20170918 of IDMapper available on Blender Market

I have released an update version of the IDMapper add-on to Blender Market.

In the video I demo the new functionality and I have listed the release notes at the end of this article.

If you would like more information on all the functionality, have a look at this article. A complete workflow demonstration is available in this demo video.


Release notes

Version 20170918

  • Add ID Color List management
  • it is now possible to load, manage and save named lists of colors and to pick colors from this list when working in Face Paint mode. This is convenient if your studio uses smart materials for example and you have a list of predefined ID map colors you want to use for many different assets. Unlike Blender's built-in palettes, these colors have names, can be searched and sorted and loaded/saved as .csv files.
  • Add color picking outside select object in Face Paint mode
  • Number of undo levels in Face Paint mode is now configurable

IDMapper - create ID-maps the easy way

it's always exiting to announce a new product on Blender Market and today I am pleased to announce IDMapper.


IDMapper is a Blender add-on that lets you create a vertex color layer that can be used as an ID-map by texture paint tools like Substance Painter.

When creating textures for models you often want to reduce the actual number of textures, for example because your GPU can only handle a limited number of textures or maybe simply because juggling a large number of textures for a single model is such a hassle.

Whatever your motivation, texture painting software lets you apply different materials to a texture with ease but you still need to identify areas. An ID-map makes it very simple to apply a material to faces that have a certain color, often by letting you pick a color from the ID-map with an eye-dropper tool.

You will still need to create the vertex color layer that can be used as an ID-map and that's where IDMapper can help.

The first thing it offers are powerful heuristics to assign a unique vertex color to regions consisting of related faces. What is considered related can be tweaked interactively and any resulting distinct regions with very similar geometry can still be assign the same vertex color, simplifying for example the assignment of colors in hard-ops modelling in situations where your mesh contains repeated features like handles or bolts.

The second feature is an operator that acts like a new face paint mode. Instead of applying blended colors to vertices in a painterly manner as with Blender's vertex paint mode, this operator keeps colors uniform across a face, something often desirable when assign materials to mesh parts. It also lets you assign new colors to colored regions and resize or smooth these regions interactively.

And finally it offers some convenience functions to combine different vertex color layers and copy vertex color layers from one mesh to another, probably more high poly, mesh.

A short video showcasing the main features is available on Youtube:


IDMapper is available in my Blender Market shop

Weightlifter Watershed Demo

I just uploaded a new version of my WeightLifter add-on to BlenderMarket.

The video gives a short impression of the new watershed mode. You could use this watershed mode for example to calculate a realistic distribution of vegetation in large scale landscapes.

random vertex colors using Numpy

The bit of research presented in a previous article was not completely academical: speed improvements using Numpy are very welcome when for example generating random vertex colors for very large meshes.
With the results of the measurements in the back of my mind and spurred by a discussion on BlenderArtists I created a new version of the random vertex colors addon. (available on GitHub), which reduced the time to generate random vertex colors for approximately 1 million faces from 3.2 seconds to 0.8 seconds on my machine (or even 0.4s for a 32 bit variant), i.e. up to 8 times faster which is not bad.

Some explanation

Assigning random vertex colors to faces means that you have to assign colors to all the loops of a polygon the same random color (for the difference between vertices and loops, check the BMesh design document. The same applies to the regular Mesh objects we use in the code below). This can be done in a straight forward manner once you have located the vertex color layer:
mesh = context.scene.objects.active.data
vertex_colors = mesh.vertex_colors.active.data
polygons = mesh.polygons
for poly in polygons:
 color = [random(), random(), random()]
 for loop_index in range(poly.loop_start, poly.loop_start + poly.loop_total):
  vertex_colors[loop_index].color = color
Straight forward as this may be, a loop inside a loop is time consuming and so is generating lots of random numbers, especially because Python does not do this in parallel even if you have a processor with multiple cores. Fortunately for us Blender comes bundled with Numpy, which is a library that can manipulate huge arrays of numbers in a very efficient manner. This allows for a much more efficient approach (although as shown previously a significant speed increase is only noticeable for large meshes).
startloop = np.empty(npolygons, dtype=np.int)
numloops = np.empty(npolygons, dtype=np.int)
polygon_indices = np.empty(npolygons, dtype=np.int)

polygons.foreach_get('index', polygon_indices)
polygons.foreach_get('loop_start', startloop)
polygons.foreach_get('loop_total', numloops)

colors = np.random.random_sample((npolygons,3))
We can even reduce storage (and get an additional speedup) if we change the types to 32 bit variants. There will be no loss of accuracy as these are the sizes used by Blender internally. (Would you do a lot of additional calculations this might be different of course). The change would only alter the declarations of the arrays:
startloop = np.empty(npolygons, dtype=np.int32)
numloops = np.empty(npolygons, dtype=np.int32)
polygon_indices = np.empty(npolygons, dtype=np.int32)

polygons.foreach_get('index', polygon_indices)
polygons.foreach_get('loop_start', startloop)
polygons.foreach_get('loop_total', numloops)

colors = np.random.random_sample((npolygons,3)).astype(np.float32)
As shown above we start out by creating Numpy array that will hold the startloop indices and the number of of loops in each polygon as well as an array that will hold the polygon indices itself. This last one isn't strictly needed for assigning random values because we don't care which random color we assign to which polygon but for other scenarios it might make more sense so we keep it here. We get all these indices from the Mesh object using the fast foreach_get method. We then use Numpy buil-in random_sample function the generate the random colors (3 random floats between 0 and 1) for all polygons.
loopcolors = np.empty((nloops,3)) # or loopcolors = np.empty((nloops,3), dtype=np.float32)
loopcolors[startloop] = colors[polygon_indices]
numloops -= 1
nz = np.flatnonzero(numloops)
while len(nz):
 startloop[nz] += 1
 loopcolors[startloop[nz]] = colors[polygon_indices[nz]]
 numloops[nz] -= 1
 nz = np.flatnonzero(numloops)
The real work is done in the code above: we first create an empty array to hold the colors for all individual loops. Then we assign all the loops with index startloop with the colors that corresponds to the color of the polygon it belongs to. Note that startloop and polygon_indices are arrays with the same length, i.e. the number of polygons. Now we also have an array numloops which holds for each polygon the number of loops. We decrement this number of loops by one for all polygons in one go (line 3) and create an array of indices of those elements in numloops that are still greater than zero (line 4). If we are still left with one or more indices (line 5) we increment the index of the startloop for all those nonzero indices (line 6).
Line 7 then assigns again in one go a polygon color to a loop at a certain index for all polygons where there are still a non zero number of loops. And finally we again reduce our numloop counters. Note that this all works because the loop indices of all loops of a polygon are consecutive.
loopcolors = loopcolors.flatten()
vertex_colors.foreach_set("color", loopcolors)
The final lines flatten the array of loop colors to a 1-D array and write back the colors to the Mesh object with the fast foreach_set method.

Discussion

Now even though we end up with about four times as much code, it is much faster while still quite readable, as long as you get your head around using index arrays. Basically our single while loops executes the inner loop of assigning colors to loops for all polygons in parallel. The penalty is for this speed increase is memory consumption: We use 5 large numpy arrays here.