Hi,
Would it be possible to have this scripted graph working with an image texture input instead of a string value ?
That way one could, for instance, link an image node with UV transform information directly to the script. I tried to do it but I don't know the first thing about LUA. I just managed to change the string input to a texture one, but all I get is a blank material.
Thanks for this anyway, it comes very handy!
Cheers,
Yugs
            
			
									
						
										
						Create random textures over instances
Could you please help and make this script working under V4?
            
			
									
						
							 3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
			
						Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
As far as I can see the script still works under version 4.
--
Roeland
            
			
									
						
										
						It's possible to create a similar script with texture inputs, how exactly depends on what exactly you want to achieve. Do you want one image texture input with a bunch of random additional transforms applied to it?Yugs wrote:Would it be possible to have this scripted graph working with an image texture input instead of a string value ?
--
Roeland
Would be very welcome.It's possible to create a similar script with texture inputs, how exactly depends on what exactly you want to achieve. Do you want one image texture input with a bunch of random additional transforms applied to it?
Would it be possible to create an Amount and Scale input for the scatter node? I would like to reproduce a texture like this on a big surface
Actually OSL should be able to simulate this I think
- Attachments
- 
			
		
				- klinkers-abbeystones_968x584_Pic_362.jpg (24.67 KiB) Viewed 10851 times
 
Octane 2022.1.1 nv535.98
x201t - gtx580 - egpu ec
Dell G5 - 16GB - dgpu GTX1060 - TB3 egpu @ 1060 / RTX 4090
Octane Render experiments - ♩ ♪ ♫ ♬
			
						x201t - gtx580 - egpu ec
Dell G5 - 16GB - dgpu GTX1060 - TB3 egpu @ 1060 / RTX 4090
Octane Render experiments - ♩ ♪ ♫ ♬
Yes, this can be done using an OSL texture: You can start from the laminate example here: viewtopic.php?p=326508#p326508
Set the plankAspect to 1.0 for square tiles.
However, this shader will generate a random offset for every row of tiles. To get a regular pattern like in your picture find and replace the lines
with
            
			
									
						
										
						Set the plankAspect to 1.0 for square tiles.
However, this shader will generate a random offset for every row of tiles. To get a regular pattern like in your picture find and replace the lines
Code: Select all
    // random offset for each row
    float x = p[0] + noise("cell", y, 0);
Code: Select all
    // alternate offset for each row
    float x = p[0] + 0.5 * ((int) y & 1);
Getting there! Is it possible to add a random rotation for the square planks/tiles? In practice you would only need 4 options, each 90 degrees turned. In order to get the right irregularity for now I solved it roughness.
            
							
			
													
					Last edited by whersmy on Tue Apr 10, 2018 9:30 am, edited 1 time in total.
									
			
						
							Octane 2022.1.1 nv535.98
x201t - gtx580 - egpu ec
Dell G5 - 16GB - dgpu GTX1060 - TB3 egpu @ 1060 / RTX 4090
Octane Render experiments - ♩ ♪ ♫ ♬
			
						x201t - gtx580 - egpu ec
Dell G5 - 16GB - dgpu GTX1060 - TB3 egpu @ 1060 / RTX 4090
Octane Render experiments - ♩ ♪ ♫ ♬
Share the scene please - great job.
            
			
									
						
							 3090, Titan, Quadro, Xeon Scalable Supermicro, 768GB RAM; Sketchup Pro, Classical Architecture.
Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
			
						Custom alloy powder coated laser cut cases, Autodesk metal-sheet 3D modelling.
build-log http://render.otoy.com/forum/viewtopic.php?f=9&t=42540
Here we go. Usable for buildings as well if displacement is not necessary.
            
							- Attachments
- 
			
		
		
				- Tiles.orbx
- (3.13 MiB) Downloaded 587 times
 
Octane 2022.1.1 nv535.98
x201t - gtx580 - egpu ec
Dell G5 - 16GB - dgpu GTX1060 - TB3 egpu @ 1060 / RTX 4090
Octane Render experiments - ♩ ♪ ♫ ♬
			
						x201t - gtx580 - egpu ec
Dell G5 - 16GB - dgpu GTX1060 - TB3 egpu @ 1060 / RTX 4090
Octane Render experiments - ♩ ♪ ♫ ♬
Yes. The script as it is contains code to randomly rotate the texture by 180°:
We can extend this code: for instance this randomly picks any of the 8 combinations of rotation (0°, 90°, 180°, 270°) and mirroring.
            
			
									
						
										
						Code: Select all
    int flip = (rnd - floor(rnd)) < .5;
    // make UV mapping per cell and evaluate the right texture
    float plU = x - floor(x);
    float plV = y - floor(y);
    if (flip)
    {
        plU = 1 - plU;
        plV = 1 - plV;
    }Code: Select all
    int flip = (int) ((rnd - floor(rnd)) * 8);
    // make UV mapping per cell and evaluate the right texture
    float plU = x - floor(x);
    float plV = y - floor(y);
    if (flip & 1)
    {
        // flip U
        plU = 1 - plU;
    }
    if (flip & 2)
    {
        // flip V
        plV = 1 - plV;
    }
    if (flip & 4)
    {
        // flip over diagonal
        float tmp = plU;
        plU = plV;
        plV = tmp;
    }
 
                                                                
                             
						



