Controlling the grass

Started by reck, October 18, 2009, 03:11:19 PM

Previous topic - Next topic

reck

I'm controlling the placement of grass through a distance shader which is working ok. However the grass is growing through all the fake stones in the scene. How can I continue to keep the grass placement through the distance shader but on top of this tell it not to show grass where there are fake stones?

Thanks

reck

Here is the node network.

I've highlighted the 2 nodes that should control the grass placement along with the grass population itself. As you can see at the moment the grass is controlled just via the distance shader. I also somehow need to tell the grass population to not grow where the Fake stones are (fake stones shader 01).

dandelO

I'd think you could make your distance shader the colour function(or possibly child layer) of a surface layer(delete fractal breakup, it's not required for this), then use the invert of the fake stones as its blending shader. So the surface layer is now only going to appear where the distance shader says but not where there are stones. I can't make anything to describe it just now but something like that should work.

aymenk2003

As dandelO said ...I want to add something ...
when you duplicate the fake stone shader give it a white color...


N.KAID
Le peu que je sais, c'est à mon ignorance que je le dois.

reck

dandelO I just tried your suggestion but the grass is still coming out the fake stones. As you can see from the screengrab I created a surface shader (deleted the fractal breakup) and connected up the existing Distance shader 02 to the colour function. Then I connected up the fake stones shader as the Blend shader and inverted it. I also tried connecting up the distance shader as a child layer of the surface layer but it didn't make any difference, it looks like it's ignoring the blend shader all together. Can you see where I might have gone wrong?

aymenk what do you mean duplicate of the fake stone shader? I'm using the single fake stone shader is already used in the node network earlier, not a duplicate.

dandelO

Yes, I'm sure Njeneb is right. I should have said to duplicate the stone shader so it isn't plugged into a previous chain. If you use the same one it will take data from all previous shaders, too(in this case, te entire surface of the planet).
That should help.

reck

Well i'm still not getting this to work, even after following the instructions from dandelO and aymenk2003. This time,as suggested, I made a copy of the fake stone shader, made the colour pure white and attached it as a blend shader to the surface layer. This has no effect and the grass continues to grow through the rock exactly as before.

Can you see where i'm going wrong?


Henry Blewer

I use the distance shader in the Blend by Shader of the Surface layer. Connect the fake stones into the distance shader in its own Blend by Shader. You may still have to invert the fake stones.
So, it flows like this:                              Surface Layer-> Blend by Shader [distance shader]
Now open the distance shader:                Distance Shader -> Blender by Shader [fake stone shader]                       
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

reck

But njeneb the Distance shader doesn't have a "Blend by shader" option!


Henry Blewer

Sorry, I have some flu or something. I meant distribution shader. My brain took a vacation....
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

reck

Sorry njeneb I don't understand. Are you saying I need to add a distribution shader now? If so what am I doing with it?

littlecannon

#11
Are you inverting the stones shader you're using as a mask? If not the the stones you have made white would tell the grass to grow on the stones and not around them. You would need to invert the mask to make the stones black and the surrounding areas white. Hope this helps a bit. You could also make the stones in the mask a fraction bigger, so you could get a "bald spot" around where the stone is lying... maybe.

Cheers,
Simon.
I just need to tweak that texture a bit more...

Henry Blewer

If I have fake stones, I use the slope function of the distribution shader to keep the grass off the stones. It won't work for the small scale stones, but if you have large scale stones it works fine. I give the distribution shader a maximum slope of around 10. The smaller scale stones won't have enough slope to stop the grass, but the large ones will. For really huge stones, the grass will grow on the top of the stones. This is ok with me, larger stones often get covered by soil. I wish I could run a task of T2, but the computer is already running two instances of the program. I will make a demo tgd file for you so you can see what I do in use.
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

reck

HI litttlecannon, yeah I inverted the stone shader.

njeneb I like the sound of this, especially as no other method of keeping the grass off the stones is working. It doesn't really matter about the small stones, it's the bigger ones that are causing the problems. An example would be nice.

I wish there were a simple way to stop objects, grass, flowers, trees whatever from growing on fake stones. Just a checkbox within the fake stones shader object saying something like "prevent objects appearing" would be cool.

Henry Blewer

There is this way also. Make a new Surface Layer for just the fake stones. Turn off the color of the Surface Layer. Now use the Blend by Shader input to cause the grass to 'grow' on the previous layer (I usually name one layer 'Grasses' even if the color is not green)
The fake stones should cover/mask the grass objects out.
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T