OSL Random Tile Texture

Maxon Cinema 4D (Export script developed by abstrax, Integrated Plugin developed by aoktar)

Moderators: ChrisHekman, aoktar

Post Reply
Koler
Licensed Customer
Posts: 6
Joined: Fri Jul 28, 2017 12:00 pm

Hello everyone

I want to create a tile material as in the attached file (Reference material). I have 4 sets of maps (diffuse, roughness, normal, displacement) for 1 element of the pattern and I want to place them randomly inside the pattern. I tried using some OSL textures from Octane OSL utilities and SimpleTile.OSL https://github.com/ADN-DevTech/3dsMax-O ... eTiles.osl, but unfortunately I could not achieve the desired result. If someone has experience in creating such materials, I would be very grateful for help. For convenience, I created a simple test scene, it can be found in the attachment.
Attachments
OSL_Tile.zip
Test scene
(182.1 KiB) Downloaded 74 times
Reference material
Reference material
User avatar
SSmolak
Licensed Customer
Posts: 1157
Joined: Sat Feb 07, 2015 5:41 pm
Location: Poland
Contact:

Hi, as I know there is no working OSL script for that in Octane but you can use three methods :

1. Using Octane Instance ID for different objects :
ID.jpg
It needs some preparation. Individual polygons should be extracted to objects using C4D Polygon Islands to Objects. After that Octane Object tag is needed for all of them, select them all and in Instance ID put "num+1" to make every object individual Instane ID number.

2. Using random Vertex Map :

Select polygons and use random_vertex_color.py script to create Vertex Map with random colors.
random_vertex_color.zip
(1.07 KiB) Downloaded 59 times
3. Using Fracture but this is buggy at the moment ( reported it ) but there is limited workaround.
For this method you can use build-in nodes or using OSL :
RandomInstanceColor.osl
(144 Bytes) Downloaded 64 times
All examples with materials using three methods:
random_tiles.zip
(154.25 KiB) Downloaded 72 times
tiles.jpg
Just replace RGB Spectrum nodes with your Texture Images

I see that this code from your link works fine. Also we have built-in nodes like Tile patterns, OSL c4d-tiles.osl.

Some threads :

viewtopic.php?f=9&t=79536
viewtopic.php?f=30&t=74396
viewtopic.php?f=30&t=78482

but the best is Q-Tile Pro : https://3dtools.info/tilepro
Architectural Visualizations http://www.archviz-4d.studio
User avatar
roeland
OctaneRender Team
Posts: 1822
Joined: Wed Mar 09, 2011 10:09 pm

Yeah this comes up sometimes, there are a few ways to achieve this. It depends on whether you have the tiles as separate images or as one texture atlas, and whether the tiles are separate objects or one mesh.

For the one mesh / separate image tiles case, one way is to load the sets of images into an image tiles node, and use a to use an OSL shader as UV input. This image tiles node is similar in concept as UDIM, although the OSL shader I attached assumes the images are arranged in one vertical row.

The custom OSL shader by itself has a projection and transform input similar to any built-in texture, so you can put it on a wall with box mapping.
laminate tiles example.orbx
(4.54 KiB) Downloaded 62 times
User avatar
SSmolak
Licensed Customer
Posts: 1157
Joined: Sat Feb 07, 2015 5:41 pm
Location: Poland
Contact:

roeland wrote:
The custom OSL shader by itself has a projection and transform input similar to any built-in texture, so you can put it on a wall with box mapping.
The attachment laminate tiles example.orbx is no longer available
Thank you it looks that great script you presented here but why it looks different in Cinema 4D, without plank size ?
osl_tiles_C4D.jpg
Architectural Visualizations http://www.archviz-4d.studio
User avatar
roeland
OctaneRender Team
Posts: 1822
Joined: Wed Mar 09, 2011 10:09 pm

SSmolak wrote:Thank you it looks that great script you presented here but why it looks different in Cinema 4D, without plank size ?
It is possible that the Cinema4D plug-in is not able to map the type of that input to a UI widget. This is a version with 2 float inputs for the tile size:
Attachments
laminate tiles example.orbx
(33.61 KiB) Downloaded 66 times
User avatar
SSmolak
Licensed Customer
Posts: 1157
Joined: Sat Feb 07, 2015 5:41 pm
Location: Poland
Contact:

roeland wrote: It is possible that the Cinema4D plug-in is not able to map the type of that input to a UI widget. This is a version with 2 float inputs for the tile size:
It looks good now except text strings :
osl_tiles2_C4D.jpg
osl_tiles2_C4D.jpg (9.35 KiB) Viewed 1406 times
Thank you for creating this. I will test it soon :)
Architectural Visualizations http://www.archviz-4d.studio
User avatar
SSmolak
Licensed Customer
Posts: 1157
Joined: Sat Feb 07, 2015 5:41 pm
Location: Poland
Contact:

If someone interested I added option to offset tiles between rows and moving whole pattern by X and Y.
Attachments
Tiles Projection.zip
(863 Bytes) Downloaded 62 times
Architectural Visualizations http://www.archviz-4d.studio
Post Reply

Return to “Maxon Cinema 4D”