I'm trying to get the UV coordinates of from UVMap using getattribute() as follows :

#include "stdosl.h"

shader node_uv_map(
    string name = "",
    output point UV = point(0.0, 0.0, 0.0),
    if (name == "")
        getattribute("geom:uv", UV);
        getattribute(name, UV);

with the name empty or containing the UVmap name there is no output

  • how to perform that correctly
  • is there another way to get the uvmap coordinates in osl
  • what are othor attribute that can be retrieved using getattribute beside these

Blender 2.7b


1 Answer 1


enter image description here

The texture only appeared after I added another Image Texture node (which is not realated to anything). Muting this node if enough to make the texture disappear.

The topic is also discussed on an older BA-Thread

You could use Input/UV-Map node to get the UV-coordinates:

Wiring the UV makes them accessible for getattributes

enter image description here

  • $\begingroup$ thanks that worked for me, this gives the active UVMap only so how can i choose another one through osl $\endgroup$
    – Chebhou
    Feb 10, 2015 at 17:23
  • $\begingroup$ @Chebhou you can have as many as you want by adding multiple UVMap -Nodes with different UV-Maps. (if I get you right) $\endgroup$
    – stacker
    Feb 10, 2015 at 17:35
  • $\begingroup$ i meant accessing them with their names getattribute("UVMap.001",UV) $\endgroup$
    – Chebhou
    Feb 10, 2015 at 17:39
  • $\begingroup$ @Chebhou added another example $\endgroup$
    – stacker
    Feb 10, 2015 at 17:54
  • $\begingroup$ I haven't used getattribute much, I'm thinking for this it would easier and cleaner to have multiple vector inputs and connect a uvmap node to the script node. $\endgroup$
    – sambler
    Feb 11, 2015 at 11:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .