appleseed Users Forum

Manipulating UV's in Blender, tiled textures & OSL script node use

Hi all. I am wanting to tile a bitmap texture in Blender. What method do I use in the node tree?

I managed to use asGlobals to send the UV’s to the asTexture node, but how do I now get it to tile?

Thanks

1 Like
  • In the asTexture node set S Wrap and T Wrap to Periodic
  • In the UV Editor set in the Display options Repeat Image to see the tiled texture.
  • Scale the UV as desired so that it covers several tiles

(See the blue arrows in the screenshot below for an example how to change the settings to get a tiled texture mapped to a simple plane object)

1 Like

The resulting render (passed through Blender 2.81 new Intel Open Image Denoiser compositor node) looks like this. The ground plane has the tiled texture applied.

1 Like

Great thanks guys. Gonna test it now.

1 Like

Right got it working. Quick follow up question. What is the Appleseed equivalent of the mix node? I am wanting to mix two textures.

Ok, second follow up question. Is there an equivalent to the ColourRamp node?

1 Like

What is the Appleseed equivalent of the mix node?

  • We have an asBlend node which allows one to blend up to 8 BxDFs.

A color ramp node like Cycles has is not yet implemented in appleseed.

A general overview of all shader nodes is here: Custom appleseed shaders

2 Likes

Thanks Mango3

What do you like to do with the ColorRamp?

In my own workflow, most ColorRamp’s create a stencil from a texture. Just like asCreateMask does.

You could also try OSL spline function.

1 Like

I usually use it for manipulating the grey scale values of a noise texture. So clipping the top and bottom ends with a bit of gamma correction is the most common operation. It can get more complicated of course.

So how would I use the OSL spline function?

We have added some OSL nodes for basic color grading for the upcoming release. If you have a dev-build of blenderseed or any of our other plugins you can use them already. (Note, they are not yet added to the appleseed custom shader docs in the link above.)

  • asAscCdl American Society of Cinematographers Color Decision List (ASC CDL) which can be also used for Gamma adjustment, gain, offset and saturation changes. Output clamping is optional.

  • asInvertColor to invert individual or all color channels. Useful for inverting stencil masks.

2 Likes

I just found them in the 2.8 dev version. Thanks. Gonna play with them now.

1 Like

Ah … sounds like asCreateMask could do the job.

So how would I use the OSL spline function?

You need to make your OSL script accessible for appleseed.

Excuse me. I dont have experience with newer blenderseed. There is no recent Linux build at the moment. But I believe, in the newer Blenderseed it might be easier to get custom OSL shaders working.
If you use newer Blenderseed, I heard there is a script node. This might be the easiest way. You might also tell Appleseed directly from Blenderseed where you place your custom OSL shaders.

Simple shader, uses ‘spline’ …

shader MyColorMapping(
    float X = 0,
    output color COut = color(0))
{
    // Gather some colors we like to blend
    color magenta = color(1,0,1);
    color red = color(1,0,0);
    color yellow = color (1,1,0);
    color green = color(0,1,0);
    color cyan = color(0,1,1);
    color blue = color(0,0,1);
    
    // Put them into an array
    color clist [6] = { 
        magenta, 
        red, 
        yellow, 
        green, 
        cyan, 
        blue
    };
    
    // Use array in spline function.
    COut = spline("linear", X, clist);
}

X is a float. Lets assume X is in [0…1]

‘spline’ will map X to a color, using color list ‘clist’.

That is correct. We have now an OSL Script Base node to load directly OSL source files. The advantage is that compilation and generation of the node-UI elements is more or less automatic. You just have to press a button (Reload Parameters), the UI gets generated and then you can use the node in the same way as any other.

I have used your spline shader code to illustrate the script node in blenderseed for Blender 2.80. I feed it the V-Coordinate of the sphere which is then mapped to a color for the asDisneyMaterial surface color input.

3 Likes

Wow, you guys have just blown my mind. Haha, I think I need to learn myself some OSL. Any sources that you can suggest?

1 Like

Some OSL resources:

Some great video tutorials:

4 Likes

Wonderful Mango3, That is a wealth of knowledge. Thanks.