Dear Blender users,
I am currently developing a script to load molecular structures into Blender.
It is based on the following code, but supports some different file formats: blmol source
Anyway, everything is working nicely and I can plot not only simple structures but also isosurfaces (molecular orbitals, electron densities, …).
Here are some images:
This is with the current default materials.
After tweaking by hand things can look quite fancy.
But I did not find a good tutorial that explains how to create ColorRamps in Blender (2.81).
Any suggestions on the coding part?
Also, if you have suggestions for nice material settings, do not hesitate to tell me.
I had some trouble figuring out ColorRamps as well, I hope this helps!
val_to_rgb = nodes.new('ShaderNodeValToRGB')
elements = val_to_rgb.color_ramp.elements
# accessing/assigning color
# first color
elements[0].color = (1,1,1,1)
# add new color and set its position
# position (float in [0, 1])
elements.new(0.5)
Just so you know, you could also import Avogadro generated pov files from the Persistence of Vision addon, which will keep its primitives non polygonal, and also has basic support for isosurfaces (output)