Looking for some UV help

I’m sure there’s a script out there, but I’m somewhat comfortable with python and would like to explore modding blender a little further. what i’m looking to do is apply uv to an object in 3d mode as a projection of the X, Y, and Z axes. so for example if I had a cube selected, it would apply R/G/B to the surface of the object based on it’s location in space (red mapped to x + and -, blue to y, green to z) in a vertex paint manner, rather than mapping to a preexisting RGB sheet… to be honest i’m not even sure what to ask, but if anyone could point me to any relevant code samples or documentation they know is relevant, i’ve tried searching the forums and through google already so please don’t hound me about doing research… maybe i’m using the wrong terminology?? basically this would let me know which edges wrap to where based on a 2d texture. Think of it like making a 3d heatmap of an object so you could accurately represent it in 2d, with colors at seams being continuous between them.

Thank you for your time.

UV mapping isn’t the best approach. If I understand you correctly, it seems you want the color to depend on the position in 3D space. That’s a job for your material shader. ie - for every pixel, compute the color based on XYZ.

Here’s a simple example and the blend to go with it.


Wayne

Attachments

PositionMaterial.blend (530 KB)

yes that’s correct. essentially then i’d like to “unwrap” that colored outer surface into a 2d net with the representative colors in the same locations. also i’m assuming that the corners represent black, red, green, blue, cyan, magenta, yellow, and white? so the BSDF block is taking care of that for you?

Thanks again for interpreting my less than ideal vocabulary!

It would help to understand why you feel you need to uv map the shape, vs just coding the shader as I have done here. Are you exporting to some other app that requires uv mapped texturing? If so, then I would just add seams, unwrap, and bake the cycles colors onto your texture sheet.

so… I tried what your screenshot suggested and SOMEHOW I still fucked it up… mine has big obvious lines rather than smooth transitions and I have no clue why… please help
also the roughness doesn’t matter, I was just messing with the slider to see if it fixed anything :confused:


So now you need to think about how the xyz coords map to rgb color values. Legal rgb color values have a range of 0 to 1. Your xyz values appear to range from -1 to +1 on this cube. Its the negative values that are causing problems. Insert a Vector Curve node in front of the Diffuse BSDF node to scale your xyz coords into legal rgb color values.

Here’s a .blend

Attachments

PositionMaterial2.blend (528 KB)