I have a DNA model that I created and imported from a 3D chemistry modeling program (Avogadro). I exported the model in .wrl format (the only 3D format allowed for export by Avogadro) and imported into Blender. Unfortunately, there's a bug in Blender 2.8x that does not allow color to be imported in .wrl format.

So, I need a workaround. I need to color each molecule a different color based on its object dimensions. For example, the phosphorous molecule is a particular size as are carbon, oxygen, nitrogen, and hydrogen. I've spent a few hours now scanning the various forums for an answer. I have yet to find a solution.

Ideally, I'd also like to color the little stick bonds between each atom based on the colors of the two atoms it is binding together. That's not a deal-breaker, though. I can get away with making the stick bonds a single color.

See the attached images for the shader setup I have right now and the result it's producing.

enter image description here

enter image description here

  • $\begingroup$ The node tree above works if your objects have a "scale". In your case it seems they all belong to the same object and has the scale applied. Is this the case. BTW, if there is a bug in 2.8x, can't you import the model in a working release (2.79?) and then copy paste it in 2.8x? $\endgroup$
    – Carlo
    Commented Jun 22, 2020 at 22:42
  • $\begingroup$ Hello, is this one object containing all the meshes, or are each sphere individual objects ? $\endgroup$
    – Gorgious
    Commented Jun 23, 2020 at 7:05

1 Answer 1


You're so close - you just need to swap one of your Math nodes for a Vector Math node, and the other for a MixRGB. Note the divide factor for the mix node is set to 1 (anything less covers less than the whole surface). See below:


NOTE - The scale I had initially was too big, apparently, I had to scale all the objects down (except for the empty) to get it to look right, but I was working fast and carelessly. I'm sure it can look "right" at any scale, it may just have to be adjusted by adding a Map Range node between the MixRGB and the ColorRamp - Just connect the color output of the MixRGB to the value input of the Map Range.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .