[Bf-cycles] UV, not working well in OSL Script node

Lukas Tönne lukas.toenne at gmail.com
Tue Oct 9 09:17:12 CEST 2012


Had a little discussion with Dalai about how to make sure such shaders
are still portable to non-cycles renderers. Apart from the brute-force
solution (always request UV in the OSL script node), we came up with
two options:

1) Use a generic "Vector" input, like other nodes. This has the
advantage of being flexible, but is not as simple as using u/v globals
directly.

2) Use shader metadata to encode cycles attribute requests:

surface
example_shader_1
    [[ string attributes = "UV,SomeCustomAttribute" ]]
(
    output closure color fora = 0
)
{
    fora = color(u, v, 1.0) * emission();
}

Still this second approach would only work when actually writing the
node *for cycles*. Using a shader from other render engines which
doesn't have this request feature/limitation would still not work
without manual fixing ...

Maybe it should be added as an option on user level: Simple checkbox
list in advanced options (sidebar) to enable UV and other requests.
Not very elegant though.

On Tue, Oct 9, 2012 at 8:41 AM, Brecht Van Lommel
<brechtvanlommel at pandora.be> wrote:
> The sphere looks correct to me. The u,v values here are like the
> Parametric output in the Geometry node (barycentric coordinates in the
> triangle), not a UV layer. If the plane has that material assigned too
> that would be a problem, but otherwise don't see the bug.
>
> For the UV layer though, there is a bit of a design issue here. Cycles
> only exports mesh data layers when they are requested by the shader
> (to save memory and export time). However for an arbitrary OSL shader
> I don't know how to determine automatically if they need such
> attributes.
>
> Brecht.
>
> On Tue, Oct 9, 2012 at 8:19 AM, Dalai Felinto <dfelinto at gmail.com> wrote:
>> Hi there,
>>
>> I'm testing the OSL node (in lukas' branch) and I noticed that u,v is
>> not getting the information from Blender.
>> See file http://www.pasteall.org/blend/16845 or image:
>> http://www.pasteall.org/pic/38655
>>
>> The test shader source is very simple:
>> ####
>> surface
>> example_shader_1
>> (
>>     output closure color fora = 0
>> )
>> {
>>     fora = color(u, v, 1.0) * emission();
>> }
>> ####
>>
>> Any clues on whether it's a todo in cycles, or something in the "OSL
>> script" node implementation?
>> Thanks,
>> Dalai
>> _______________________________________________
>> Bf-cycles mailing list
>> Bf-cycles at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-cycles
> _______________________________________________
> Bf-cycles mailing list
> Bf-cycles at blender.org
> http://lists.blender.org/mailman/listinfo/bf-cycles


More information about the Bf-cycles mailing list