4
$\begingroup$

I am currently working on making a realistic grass shader in blender, but there's one thing I'm stuck on. I made a few different variations of textures in substance designer to make some of the grass blades look dead or discolored. I split the grass up into multiple particle effects each with a different texture, and while it looks okay, it's too inefficient for me since I already use multiple particle effects each with different object counts and size/rotation settings, so it becomes noticeable that each texture variant is applied to a different particle layer. You can see what I mean here:

enter image description here

I have never found any resource online that can show me how assign a different texture based on particle index, so I spent some time messing around and got this as my node setup. I divided by 15000 (number of particles in my test layer) to get a value from 0-1, then rounded it to a whole number.

enter image description here

...And to my surprise it works! But not really. You can see in my test render (I used a solid red and blue texture so I can visualize it better) that the texture variation is split down the middle of my render. I did not know this how particle index works.

enter image description here

So basically what I'm getting at is I need to know either: how can I randomize particle index distribution, or is there a better way altogether to do this? I should also mention that in my particle settings under "Emission" I have the "Random" box ticked.

$\endgroup$
4
  • 2
    $\begingroup$ There are no issues for me: i.sstatic.net/pTpwY.png. Your problem is probably somewhere else. Could you simplify it and share the .blend? $\endgroup$ Commented Apr 22, 2018 at 13:55
  • 1
    $\begingroup$ I agree with @JaroslavJerrynoNovotny: works fine for me also with a simple plane. Could you spend a few words about yout particle generation setup? Are you using an array modifier to replicate the emission surface? Does the problem persist even if you use the "Random" output in the "Object Info" node instead of yours math nodes? $\endgroup$
    – Carlo
    Commented Apr 22, 2018 at 14:15
  • $\begingroup$ @JaroslavJerrynoNovotny I edited my original post to include the .blend $\endgroup$
    – jkofskie
    Commented Apr 22, 2018 at 14:22
  • $\begingroup$ @Carlo Thank you!! I never thought of using the object info node in this case. It was giving me mostly a mix of both colors so I plugged it into my round math node and now it works perfectly. Thanks again. $\endgroup$
    – jkofskie
    Commented Apr 22, 2018 at 14:31

1 Answer 1

1
$\begingroup$

You can make a color ramp, it's color and not texture, but you can take an object info node, put the random into a color ramp, and the color of the ramp into the color of diffuse node. So it will take a color in the ramp randomly. I hope it will help you.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .