This adds a new UV Map node to Cycles with the option to choose which UV map to use.
Details
- Reviewers
Brecht Van Lommel (brecht) Thomas Dinges (dingto) - Maniphest Tasks
- T37954: Add UV Map node for Cycles
- Commits
- rBScb7cfd3ab6be: Cycles: add dedicated UV Map node, easier to find and has convenient auto…
rCf242e51d22fc: Cycles: add dedicated UV Map node, easier to find and has convenient auto…
rBACcb7cfd3ab6be: Cycles: add dedicated UV Map node, easier to find and has convenient auto…
rBcb7cfd3ab6be: Cycles: add dedicated UV Map node, easier to find and has convenient auto…
Diff Detail
Event Timeline
For now, it doesn't update when the UV map is changed. It stays tied to the active UV Map, if that makes sense.
For now it's not that different, I must agree. Some options are to be added like "From Dupli" and "UV Project", so that probably will make it different from the Attribute Node, I uploaded it for an initial review before tackling the rest, as it is my first development project (in or out of Blender). Then it's one of the quick hacks, so people must have had agreed on this.
For how to do UV project, you can look for MA_MAPFLAG_UVPROJECT in shadeinput.c of Blender Internal. Then in kernel_triangle.h you can implement an attribute lookup function that works in a similar way.
What this is supposed to do is interpolate the UV coordinates in screen space instead of in world space. The code in shadeinput.c seems to be project the coordinates to screen space and then computing the barycentric coordinates u/v/l in the space, and then using those to interpolate the UV coordinates from the vertices.
It's not required to implemented that part, you can do it if you think it's interesting.
| intern/cycles/render/nodes.cpp | ||
|---|---|---|
| 2352 | It doesn't take the UV map name into account because there's no code here to do that. ATTR_STD_UV just gives you the default UV map. To get an attribute by name you need to do the same as AttributeNode::compile if the uv map name != "". | |
Okay so now "From Dupli" doesn't work anymore, I did try to figure that out, I got some idea but I'd really like your feedback on this.
For "UV Project": I find this option interesting, but due to lack of time I won't do it now. I'll submit another patch later down the road (or revision to this diff if it's not committed by then), sounds good to you ? I still need to clean this diff from any mention of uv project.
Doing the projection in a separate patch sounds good to me.
I probably won't add this patch for 2.70, we're in bug fixing and polishing mode now, but I'll review this soon.
While writing the OSL shader, I ran into an issue: choosing the name of the uv map doesn't work. This also doesn't seem to work with the OSL Attribute node.
I haven't tried since then, but I couldn't get the Attribute node to work in OSL, at least inputing/changing the attribute name didn't do anything. And as I'm (kinda) reusing its code, then yes there might an issue with the getattribute() function. I'll go ahead and do some more testing to see if it's a bug or if my setup was wrong and I'll let you know.
Closed by commit rBcb7cfd3ab6be (authored by @Kévin Dietrich (kevindietrich), committed by @Brecht Van Lommel (brecht)).