Hello! I want to create a shader with shader graph that will randomly select a channel and use that as the output texture. The idea is save on memory so using each channel as a black and white picture and color them with a gradient remap. I am fairly new to shader graph but I have to use it if I want to use vfx graph so any help or point in the right direction will be appreciated as at the moment I am a bit lost.
Hi,
first you would have to decide how you want to generate your random seed. I have made a graph for you which bases the seed on the object position (therefore it will flicker if the object is moved). But you can of course choose any method of seed generation you like.
Here is the graph (descriptions are in the group titles). I have also attached the graph file (just remove the “.txt” ending). Maybe the random range splitting can be done more efficiently. I just used the nodes I am familiar with.
It was made in Unity 2019.4.21f1, ShaderGraph 7.5.3, URP
(You can read the graph if you download the raw image.)I hope this is what you are looking for ![]()
Update: forgot an Minimum Node in the 2+ range group. Added in the graph file (still missing in the image).
Thank you! Appreciate the detailed example this helps a lot!
