How to color particles based on the texture of the object from which they are emitted, using the "grid" emission setting? I am using Blender's particle system to try to voxelize my mesh. I'd like to color the voxels based on the diffuse color of the textured mesh at the closest location to each voxel. This is an image that shows what I'm trying to do:



This Stack Exchange post explains how to color emitted particles based on the mesh from which they are emitted. The technique uses the "jittered" emission setting:



Using the technique in the post I linked to, here is what I get with "jittered" selected. You can see that the emitted cubes correctly match the color of the mesh:



When I change the emission setting to "grid", the cubes no longer match the color of the object:



I'd like to use the "grid" emission setting for voxelization, but can't figure out how to get the color of the emitted particles to correctly match the color of the mesh. 

This is what my shader nodes look like for the cube which I am using as the dupli object:



I'd appreciate any help with this! Please let me know if there's something I can clarify.
A bit 'complicated' solution, as it seems that the particles UV are relative to the mesh boundings when the 'grid' option is set, not to the parent UV map (so I don't think this is possible to tune the nodes to obtain the wanted result, if you want to use particles) :



To do it :


Tune your particle system to obtain the grid dimensions you need
Apply the particle system, by clicking convert here :





You will obtain a duplicate of the cubes (on the right here) :





This cubes are dupli from the same object, so make them single user, by selecting them all and use the "make single user/object &amp; data' menu, like below, and confirm 'selected objects'





Now join them all in order to have 1 mesh from them. As they are still all selected use Ctrl+J
Enter edit mode Tab
Them select all the vertices and unwrap U using the 'smart UV project' mode. It will give you some kind of UV grid like in the right part of the picture below :




Now we will make a bake from the original to the cube shape. This bake wont work directly because the proximity between the cubes and the original mesh is not good.
So, to overpass that :


Add a shrinkwrap modifier to the cubes and set your original mesh as target object :




Now we can bake :


1 : Add a material to your cube mesh
2 : Add a image texture with a newly created texture. Keep this node active.
3 : Select your original mesh RMB then the cube mesh with Shift+RMB 
4 : Go to the bake part of the render panel and check 'selected to active'
5 : click 'bake'





Disable or remove the shrinkwrap modifier we set above
Using the baked texture, you obtain this below, with several colors on each cube :




If you need one color per cube, (edit : one color per face !)


Go to the UV editor
Select all your UVs
Set pivot to individual origins
Then scale to 0 S0




Doing that each cube UV is reduced to one point, and we obtain this :



If needed you can separate the cube in edit mode, using P then 'by loose parts' (this may take some calculations...).