TBH the setup in the video for Cycles looks a bit painful (and complex, simply because the number of times you have to repeat the same thing [and then combine them]), using UDIM could be an easier way to go (and not as rigid), but it wasn't a thing in Blender then.
It should be possible to make that in Octane, although you forgot about the shaders/materials (like Diffuse etc) in your test. (It would probably be best to use MixRGB nodes to put them together, and then one just one shader)
The reason the script from the thread you linked to didn't work in Blender is because it's not an OSL script, it's a Lua script. A similar script for Blender would be written in Python, which is probably possible (but adds unnecessary complexity, IMHO).
I translated the node setup I've used to an OSL script:
- Code: Select all
shader UVReMap
(
color Index = 0.5,
int Rows = 2,
int Columns = 2,
int Tiles = 1 [[string label = "Using Tiles", string widget = "boolean"]],
point Projection = point(u, v, 0)
[[string label = "Projection"]],
output point uvw = 0)
{
float IndexFloat = Index[0];
float Total = (float)Rows * (float)Columns;
float IndexFloor = floor(IndexFloat * Total);
if (Tiles) {
float perc = Total * IndexFloat;
float row = perc / ((float)Rows);
float row_r = floor(row);
float col_r = floor((row - row_r) * (float)Columns);
uvw[0] = Projection[0] + col_r;
uvw[1] = Projection[1] + row_r;
} else {
float ColX = 0.0;
float RowY = 0.0;
float ScaleX = 0;
float ScaleY = 0;
ColX = floor(IndexFloor / (float)Rows) / (float)Columns;
RowY = (float)((int)IndexFloor % Rows) / (float)Rows;
ScaleX = Projection[0] / (float)Columns;
ScaleY = Projection[1] / (float)Rows;
uvw[0] = ScaleX - ColX;
uvw[1] = ScaleY + RowY;// + IndexFloat;
}
uvw[2] = Projection[2];
}
It works with the Image Tile Tex*, but I can't seem to get that node working in Blender, and the documentation is more than lacking (
https://docs.otoy.com/BlenderH/BlenderP ... geTile.htm ).
By using the Image Tile Tex you would be able to have images named as image_1001.png, image_1002.png, image_1003.png etc
ETA: I have updated the script and it now works in Stand Alone, with Image Tiles, I would test it in Octane Blender as well, but I can't figure out how to get the Image Tile node to work in Blender.
BUT with this setup I can get it to "select one image" at random for each particle, with just three nodes (Random Color, OSL Projection and Image Tile), and it doesn't matter how many images you have, just set the appropriate properties.
ETA 2: I figured out how to use the Image Tile Tex, but it doesn't work properly:
viewtopic.php?f=114&t=73110