cekuhnen
(cekuhnen)
December 30, 2013, 1:40pm
1
Lets say you have a folder with 10 different wood textures,
do you know if any way to maybe randomize the input for
the image texture node?
The idea is to focus on building the wood floor by hand with individual
objects but let a random option swap out the image textures.
DruBan
(DruBan)
December 30, 2013, 3:38pm
2
Object info node - you can use either the object index or random and feed that value into a switcher group (made by you) to pick the texture.
cekuhnen
(cekuhnen)
December 30, 2013, 3:42pm
3
Hi DruBan,
I am not sure if I follow you. How can you use the object index or random with a switcher group?
spaced
(spaced)
December 30, 2013, 4:12pm
4
An OSL Script would work, or if you want it to render on GPU then something like:
The ‘Greater Than’ outputs 1 or 0 (based on true or false), so the Mix will output either input rather than blend them.
DerekWatts
(DerekWatts)
December 30, 2013, 4:36pm
5
Interesting trick. Funnily, if you assign the object mesh-data with no active users, it breaks the functionality. How is the ‘random’ identity of the object assessed/stored?
DruBan
(DruBan)
December 31, 2013, 11:56am
6
Hi CeKuhnen. From your other thread I guess you are abandoning this approach? Using Blenderallday’s UV coordinate jittering technique in combination with different images might be the best solution. Anyway Spaced has laid out above how to use the math node to make a switcher, so you should be good now, but post back if you want a five-pole switch I have one lying around somewhere.
BTW randomizing color can be done this following way too which might be faster from scratch just by virtue of fewer nodes and render faster too by virtue of fewer (none) logic ops…
spaced
(spaced)
December 31, 2013, 3:33pm
7
Hopefully it was obvious the RGB nodes were placeholders for Image Texture node, but good point to make it clear
If you want a random RGB colour (not a specified range), then:
zgorg
(zgorg)
July 5, 2019, 12:25am
8
well exactly the same question and nobody answered to the question: Random texture from a folder… a script is needed…
Korchy
(Korchy)
July 5, 2019, 5:30am
9
You can do in this way
This is a way, not real solution, some more node manipulations may be needed.
zgorg
(zgorg)
July 14, 2019, 9:00pm
10
Still no real quick solution. Would be great if someone could crack this an easy way. a script would be awesome
Debuk
June 24, 2021, 7:16am
13
I posted a solution to this in another thread, that was in principle about the same problem, have a look over there:
Well its very cluttered. A cleaner setup solution could be like this ( example with 3 textures )
[randomtex1]
And the nodegroup:
[randomtex2]
Some notes:
take care that the nodegroups are independent,
give the nodegroup TexNo values from 0…n-1
set n as value in the AmountOfTextures labeled value node.
choose your textures in each nodegroup
There are also other proposals and ideas in there.
I added a slighty variated version:
I am not sure what I like more from a readability standpoint, but the finalizing adds in my solution could also be internalized like this:
[randomtex3]
[randomtex4]