Notifications
Clear all

[Closed] Get texture color

 JHN

Is there any way to get the value (as color value) of any map below a certain vertex?
I would like to sample the color of a texturemap and use that value to create differentiations to some stuff I create add that point.

I found sort of what I need on bobo’s site with a pflow sampling color… but I would like to retreive only a color.
My best guess would be to get the UV coords from the mesh and translate that in 2D coordinates for a bitmap, but how would I sample a noise or gradient ramp?

Any thoughts?

-Johan

6 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

For procedural maps, you could render the map into a 2D bitmap. Obviously, you would have to use the 3D map with UV coordinates for this to work. MAXScript does NOT provide a method to sample a 3D point in a procedural map, I think the fooTools extension had a method for that.

Otherwise what you found on my page is the scripted way to do it for 2D bitmaps.

 JHN

*bump… anyone? Pflow seems to be able to sample a map… aren’t there any supporting functions for this?

-Johan

I would love to help, but I have no idea either. I’d be interested in the process for doing it.

Free bump,
Colin

 JHN

I think I’m going to stick with bitmaps only.
So the procedure would be to get the bary & face hit by my ray… get UVW coords of of that.
calculate the bitmap pixel (color) using the UV’s and the bitmap width.

The thing that wonders me is… I can only seem to get the UVW’s using the “getTVert <mesh> <tvert_index_integer>” function… is this correct… because I can only get the UVW of channel 1 then… and cannot find a similar function in the meshop functions or am I missing something?

-Johan

1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

All channels are accessible using the meshop.getMapVert() and all related methods under
“Meshop General Mapping Methods”

 JHN

Ah thanks it did see the function, but somehow figured it returned barycentric coords… which doesn’t make sense offcourse since it’s a vert your querieing…

Maybe a suggestion to change this line in the help:
“Returns the coordinates of the specified map vertex as a <point3>.”
to
“Returns the UVW coordinates of the specified map vertex as a <point3>.”
?

Makes it easier to search for UVW specific functions as well.

-Johan