PDA

View Full Version : How to read RGB of nearest polygon/ point of separate object?



WaxSteel
12-09-2011, 09:09 AM
I have a globe with an image map applied to it (continents). I then have DP instance on the globe placing instances of flags

I'm trying to recolour DP instances based on the average colour of the nearest polygon of the surface they sit on/ are near.

There are many examples of recolouring the instances using Extended spot info node (object ID) > Sequencer > Gradient > Color
e.g http://35.vincent.newtek.com/forums/showpost.php?p=1078059&postcount=488

but I need the colours to be based on the nearest colour of the base, rather than the random gradient. DP Nearest Point seems to offer a promising link to another object but no colour info from the point is there.

Any advice welcome

WaxSteel
12-09-2011, 09:19 AM
Typically after posting this I'm now thinking of another way.

I could instead manually create separate weight maps for each continent area and use those as placement guides for separate different coloured flags, using the multiple instance options in DP instance.

Still, it would be interesting to crack recolouring instances in one go, via nodes

dpont
12-09-2011, 09:22 AM
I had a tip for that, but not sure it works with all
kind of projection mapping,
using the same color mapping for the instanced Reference
than your custom object (your globe)
connecting the Instance Info node Position ouput
in the Replace Spot node (DP Filter) for
overwriting the Spot position for this surface.

Denis.

dpont
12-09-2011, 09:52 AM
Check this thread,
http://forums.newtek.com/showthread.php?t=121290

Denis.

WaxSteel
12-09-2011, 10:46 AM
Thanks Denis,

Hmmm, Seems I'm getting the entire image duplicated onto every instance equally - not stretched out.

I'm using the image node in 2d textures > image

Even trying it on a flat plane (overhead camera) as below its doing the same thing. Pretty sure the texture is not set to tile. Have tried it with all the types of projection mapping available in the image node, apart from uv

http://www.pixelkanvas.co.uk/other/instance%20texturing_1.jpg
http://www.pixelkanvas.co.uk/other/instance-texturing-nodes.jpg

dpont
12-09-2011, 10:55 AM
If your Image node is set in local coordinates,
you need to overwrite the Local Position (Object Spot) in the
Replace node instead of the World Position.

Denis.

dpont
12-09-2011, 11:01 AM
Since Replace Spot overwrite position coordinates
I'm sure this couldn't work with UV Mapping.

Denis.

dpont
12-09-2011, 12:59 PM
DP Instance with Surface Distribution,
same image node for surfacing both floor and tube Reference object,
simple Y Planar mapping in Local coordinates,
overwriting the Object Spot with the Instance Position
for the tube object.

100161

Denis.

WaxSteel
12-12-2011, 08:33 AM
Thanks Denis.

That works great, after setting the image node to use world coordinates for the "ground" surface. Then copy pasting the node into the surface of the reference object, so it matches up.