Open MonZop opened 9 years ago
(from Issue #1 Surface) I do get the PyMOL generated surface. No MLP visulization at all; not atomic and not integrated on the surface...
this is the first mapping in grey scale.
Then it is rendered as a combined scale : from dark, opaque, rough to white, shiny, smooth (hydrophilic to lipophilic) rendered (in this case only rough/smooth and matte/shiny, without the color gradient)
And this is the Atomic MLP view.
The logical steps are: Use pyMLP to attribute to each atom its fi value (I was surprised to find the fi values in the main script) Integrate the values usign the formula of your choice (Testa is default), and produce a file .dx containing the grid of values in the 3D space of the ,molecule. For each vertex of the mesh, interpolate the local vaule in the grid, and attribute the value to the vertex, in a file .obj, with x,y,z and the resulting value in u Now the file can be sent to Blender, that will: transform the vertex u into a scale of greys (after normalizing the values to 0-1); and build a grey UV map; use the map for color; for adding bump and specular features to the mesh. The atomic MLP is a simple attribution of grey to each atom, represented in the VanderWaals sphere.
I think this code does work, but the UI behaviour could be more intuitive. At present the user must click an atom, then press atomic mlp. Maybe i'm misunderstanding the issue?
The colour gradient seems to be only partially implemented, or not imported correctly. At the moment it produces this:
@MonZop I thought using more grid subdivisions of the MLP Surface would allow the gradient to be more gradual as it appears to be in your images. What are the UI settings you used (any specific MLP formula?). Has this ever worked in the Addon version of BioBlender? If so I will be able to track down the differences introduced over time. Else simply code it fresh.
You are right. I think I had not selected the molecule (any atom of a molecule). When I do, i get the result above. also the render is with these colors.
This test scene is illuminated with a icosphere cage to give an even distribution in ambient light.
I think this shows in an amplified way the intended final effect?
The triangles visible on the surface of the sphere are due to the high gloss in that area (practically mirror-esque), the pitted / cratered area is exaggerated and would be replaced by some other preferable texture.
I don't understand, sorry
It appears that the bump and specular maps are already generated, they seem correct even.
are you using the Master_main_first_fixes ?
yes Master_main_first_fixes,
I manually added a small node material setup (not cycles..)
It is easy to programmatically generate node setups for materials / textures, if we find a nice configuration. Nodes are a little bit more flexible than the original material system, and i'd like to make it compatible with Cycles which relies on nodes for the routing.
I suppose you are using the very small peptide 1l2y. Ther distribution of the lipophilic potential on such a small surface is hard to assess. Could you test Calmodulin (File 01_CaM)? thanks I will try to set up a node system like yours
sure
Looks OK (except the green spot, visible at the start). Can you see a more intense bump in the darker area?
the green was the 'world orientation' marker (red, green, blue)
Ah, OK. I thought it might be a mapping problem (normal inverted or something like)
it appears the bump pattern is created: but what isn't happening automatically yet (or i am missing something) is the multiplication with the vertex color map to help elevate certain regions (enhance the bump) and smooth the rest
This was the flow in the earlier versions of BioBlender. In theory, it should be still the same!
Just a little explanation: Calculation of MLP is done frame by frame, because as the protein changes conformation, it may hide or expose patches with different MLP values. pyMLP includes an Atom Type Detection Library, which is used to assign a value (fi) to every atom in the pdb file. The Testa formula decays with a distance exponential and we added it to the original pyMLP, since we consider it a better function for MLP. OBJcreator is a program that uses the mesh (created by pyMOL) and the grid of values (created by pyMLP), and atributes to each vertex of the mesh the value of MLP. This is typically between -3 and 1. The MLP value is stored in the obj file, in the V field (the U filed is left blank). The file .obj is opened in Blender, where it is importe as image texture; the V values are converted to grey (between 0 and 1); and used in 3 steps: direct color (grey scale); intensity of specular; intensity of noise which is then used for generating bumps. Hope it is clear enough, in case it is not, just ask!
ObjCreator I see, this does clarify the sudden presence of the vertex_colors. Another piece of the puzzle just fell into place.
@MonZop Time permitting I will merge these explanations into https://github.com/MonZop/BioBlender/issues/19 for convenience
@MonZop
Can you see a more intense bump in the darker area?
No sign of that. Furthermore, should the lighter area show more smoothing? All the right textures / vertex_color_maps are there, but they aren't being hooked up as in the diagram. Should be a minor issue to fix for both Blender Internal materials and Cycle materials (nodes)
Seems OK. How did you get it?
The 3 components are made by the existing code.
The example image is the result of a material node setup which combines these elements, I would like to optimize the node setup first before presenting it as a realistic option.
By the way, in an ideal world, are these maps supposed to change per frame. These hydrophilic / lipophilic areas would move around as a result of molecular motion?
Yes!, this is exaclty the issue: both the surface and its features (MLP and EP) change frame by frame when the protein moves. Several groups around theworld are working to optimize the calculations in order to allow real time renders. For relatively small systems (up to few thousands atoms) results have been obtained by distributing computations to GPUs or by parallelizing; of course the major laboratories have very large dedicated machines. I am reviewing the literature to check if there are any mesh computing algorithm that are suitable for us, and might be faster and possibly avoid the need for external program (pyMOL).
I just noticed that the image above is probably not what we want. This si due to the fact that pyMOL attributes colors to the mesh, related to the identity of the underlying atom; I think that this is the color 'transformed' accoridng to the MLP code. What we want to do is substitute those colors (i do not know how they are encoded in the wrl file) with the 'color' (single value) of the lipophilic potential, calculated with pyMLP. If this is not clear I can try to explain better
Ultimately if the lipophilic potential is one value per mesh vertex, then you get a grey scale or 3 identical values for rgb per vertex color. I'm pretty sure this is already the case.. but will read that section of the code again.
from my recollection the first import of the wrl writes results in a vertex_color_map, a greyscale map, subsequently doing the 'render MLP' performs different code some of which is commented out prior to my involvement. Will read this and get a better mental model.
Feel free to elaborate.
out of interest: https://github.com/MonZop/BioBlender/issues/3#issuecomment-73238861 that first image has a light patch in the lower part, that's not due to light is it? that's the vertex color map? Could you upload or email the resulting .blend with that file..so I can look at the vertex_color_map ?
I htink that there is a missing step: the import of the 'lipophilic values' (colors), that should replace the colors provided by pyMOL. The vertex color map imported is not grey scale (same value for the 3 rgb), but real colors: indeed , if you render the mesh, it will show in green, red and blue (Carbon, Oxygen and Nitrogen, respectively).
yes, probably, proximity between a point and all other points is a relatively fast operation using a k-dimensional tree
Yes, the bright spot is precisely indication of a very lipophilic patch in that part of the protein, not light. For the file, I can send it tomorrow: it was obtained with BioBlender 0.6, the patched precompiled version, that (for reason that do not understand) does not work on this pc. But i can do it with the pc at home!
OK, I start a new issue: 'new MLP' , and move there the relevant parts
Besides the facty that the surface is necessary to display the MLP (see Issue #1), there seems to be also another problem: apparently BB cannot find pyMLP.py (which is distributed with BB, in the Bin folder)