Skip to main content
added 52 characters in body
Source Link
Chebhou
  • 19.7k
  • 54
  • 100

if you can get the texture coordinate from another node " since getattribute is not woring " what is lef is a simple vector manupilation here is simple osl code for shift and scale :

#include "stdosl.h"

#include "stdosl.h"

    shader texture_mapping(
        float x_shift = 0,
        float y_shift = 0,
        float y_scale = 0,
        float x_scale = 0,
        point UV_In = point(0.0, 0.0, 0.0),
        output point UV_Out = point(0.0, 0.0, 0.0))
    {
    
        UV_Out = point((UV_In[0]+x_shift)*x_scale, (UV_In[1]+y_shift)*y_scale, UV_In[2]);
    }

if you can get the texture coordinate from another node " since getattribute is not woring " what is lef is a simple vector manupilation here is simple osl code for shift and scale :

#include "stdosl.h"

shader texture_mapping(
    float x_shift = 0,
    float y_shift = 0,
    float y_scale = 0,
    float x_scale = 0,
    point UV_In = point(0.0, 0.0, 0.0),
    output point UV_Out = point(0.0, 0.0, 0.0))
{

    UV_Out = point((UV_In[0]+x_shift)*x_scale, (UV_In[1]+y_shift)*y_scale, UV_In[2]);
}

if you can get the texture coordinate from another node " since getattribute is not woring " what is lef is a simple vector manupilation here is simple osl code for shift and scale :

#include "stdosl.h"

    shader texture_mapping(
        float x_shift = 0,
        float y_shift = 0,
        float y_scale = 0,
        float x_scale = 0,
        point UV_In = point(0.0, 0.0, 0.0),
        output point UV_Out = point(0.0, 0.0, 0.0))
    {
    
        UV_Out = point((UV_In[0]+x_shift)*x_scale, (UV_In[1]+y_shift)*y_scale, UV_In[2]);
    }
Source Link
Chebhou
  • 19.7k
  • 54
  • 100

if you can get the texture coordinate from another node " since getattribute is not woring " what is lef is a simple vector manupilation here is simple osl code for shift and scale :

#include "stdosl.h"

shader texture_mapping(
    float x_shift = 0,
    float y_shift = 0,
    float y_scale = 0,
    float x_scale = 0,
    point UV_In = point(0.0, 0.0, 0.0),
    output point UV_Out = point(0.0, 0.0, 0.0))
{

    UV_Out = point((UV_In[0]+x_shift)*x_scale, (UV_In[1]+y_shift)*y_scale, UV_In[2]);
}