0
$\begingroup$

I can programatically generate PLY files with RGB color values as attributes for each vertex, like below

ply
format ascii 1.0
element vertex 126272
property float x
property float y
property float z
property uchar red
property uchar green
property uchar blue
element face 252540
property list uchar int vertex_index
end_header
-5.38773 -92.173 13.6437 0 0 0
-5.7427 -92.1753 13.6356 0 0 0
-5.10993 -92.1504 13.2691 0 0 0
-5.43053 -92.1653 13.366 0 0 0
-5.75901 -92.1091 13.238 255 0 0
-4.93855 -92.0976 13.0949 255 255 0
-5.32676 -92.0818 12.9526 0 255 0
-5.86176 -92.0882 12.8743 0 255 255
......
3 0 1 3
3 4 3 1
3 0 40 1
3 41 1 40
3 0 3 48
3 0 48 40
3 1 41 49
......

Then I can import the PLY file into Blender (I am using v2.78/79), add a camera (and light and material, etc.), and render it as color images. That works totally fine.

Now I want to change the idea to only generate grayscale images with intensities at each vertex be exactly the value I assign to each vertex in PLY file, like below:

ply
format ascii 1.0
element vertex 126272
property float x
property float y
property float z
property float intensity
element face 252540
property list uchar int vertex_index
end_header
-5.38773 -92.173 13.6437 0
-5.7427 -92.1753 13.6356 -3.5
-5.10993 -92.1504 13.2691 4.2
-5.43053 -92.1653 13.366 2
-5.75901 -92.1091 13.238 -1
-4.93855 -92.0976 13.0949 -2
-5.32676 -92.0818 12.9526 0
-5.86176 -92.0882 12.8743 0.1
......
3 0 1 3
3 4 3 1
3 0 40 1
3 41 1 40
3 0 3 48
3 0 48 40
3 1 41 49
......

What I want to know is, after importing the PLY file to Blender and setting up a camera, what should I do further to let Blender generate a grayscale image that has the exact intensities I assigned at each vertex? I.e. I don't want Blender to change the intensities for me, but I do need it to render several grayscale images from different viewpoints.

Please note that I do have both positive and negative intensities at vertexes. I know these output grayscale images are not easy to be viewed in any image viewer, but that is not an issue for me.

Please kindly help. Thanks!

$\endgroup$
14
  • $\begingroup$ Assuming the vertex colors got imported correctly: Material -> Input -> Vertex Color node outputs - you guessed it - vertex colors. $\endgroup$ Oct 24 '20 at 9:08
  • $\begingroup$ I do not see the "Input" menu under the "Material" tab. Please refer here imgur.com/a/LbZJslX for my screenshot. I am using Blender 2.79b. $\endgroup$
    – John Yang
    Oct 26 '20 at 17:03
  • $\begingroup$ in the shader editor: SHIFT A -> Input -> Attribute (there was no node for it yet directly). In the field of the attribute node fill in the name of your vertex colors. If there aren't any, they did not get imported $\endgroup$ Oct 26 '20 at 19:06
  • $\begingroup$ There must be some extra steps that need to be configured. I already did what you said several times, but no luck - I got some all-black images after clicking the "Animation" button in the "Render" tab. Could you please do it on your computer and verify it? If necessary, you can download the PLY file I have been using from here: dropbox.com/s/pno9e1nxe6ysndn/lh.pial.ply?dl=0 Thanks! $\endgroup$
    – John Yang
    Oct 26 '20 at 21:51
  • $\begingroup$ Blender did not import the vertex colors. I tried in 2.8 as well. Doesn't seem to be implemented. I checked the ply, there is no information about color. There is an attribute called intensity but it ranges from -3 to +3 or something, can't be color. $\endgroup$ Oct 27 '20 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.