OSL - Random UV Mapping

A forum where development builds are posted for testing by the community.
Forum rules
NOTE: The software in this forum is not %100 reliable, they are development builds and are meant for testing by experienced octane users. If you are a new octane user, we recommend to use the current stable release from the 'Commercial Product News & Releases' forum.
Post Reply
User avatar
kcpr-raffaEl
Licensed Customer
Posts: 132
Joined: Thu Aug 14, 2014 12:10 pm
Contact:

I'm wondering if there is possibility to randomize texture coordinates?

Maybe using OSL?
User avatar
roeland
OctaneRender Team
Posts: 1823
Joined: Wed Mar 09, 2011 10:09 pm

A good starting point is to create an OSL Projection node.

The default looks like this, and implements UV mapping:

Code: Select all

shader OslProjection(
    output point uvw = 0)
{
    uvw = point(u, v, 0);
}
You can also implement world space linear mapping:

Code: Select all

shader OslProjection(
    output point uvw = 0)
{
    uvw = P;
}
To implement something similar as the offset texture of the Turbulence node, add a color input and add it to the UV coordinate. Then add eg. a noise texture to that input:

Code: Select all

shader OslProjection(
    color offset = 0,
    float amount = 1 [[float min = 0.01, float max = 10, float sliderexponent = 4]],
    output point uvw = 0)
{
    uvw = P + amount * offset;
}
--
Roeland
User avatar
kcpr-raffaEl
Licensed Customer
Posts: 132
Joined: Thu Aug 14, 2014 12:10 pm
Contact:

Thank you!

I'll be more specific.

I need to randomize RGB Image U and V translation for hundreds of object instances.
Like ceramic tiles with one texture but randomly distributed on each one.

Earlier I did it using Uunwrap, but maybe it's easier to randomize it with OSL?
J.C
Licensed Customer
Posts: 1859
Joined: Thu May 13, 2010 6:35 pm
Location: Wrocław

What about random texture rotation? Can it be done in OSL too?
CPU – i9 13900KF, 128GB RAM, GPU – RTX 4090
System – Windows 11
My Behance portfolio, Blender plugin FB support group
Post Reply

Return to “Development Build Releases”