Is it possible to transform/affect the texture coords from within the OSL shader?
I would like to be able to have my shader slip the input texture around on the surface of my object which already has uv coordinates.
Is it possible to transform/affect the texture coords from within the OSL shader?
I would like to be able to have my shader slip the input texture around on the surface of my object which already has uv coordinates.
From the osl language specification under Global Variables -
point P - Position of the point you are shading. In a displacement shader, changing this variable displaces the surface.
float u, v - The 2D parametric coordinates of P (on the particular geometric primitive you are shading).
While you don't technically alter these values, you start with them and calculate an offset position that is then used to choose the output.
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]);
}