# Grass

## Recommended Posts

Started to work on new asset, this time for grass generator:

http://vimeo.com/31327529

Now I have build simple solution with random scale, rotation and blade bend and small movement with motion fx, so they move like real grass in wind. Also grass can be painted on surface to determine position.

Still far from acceptable results.

In next days I have planned to add:

*different colours, will paint different geometry

*will try to make grass more random

*improve grass motion

Little bit more info on my blog post

I will ask for help, when time comes.

Also hip file to have a look:

GRASS_GEN_v1.hipnc

##### Share on other sites

Keep up the good work and yes keep us in the loop.

##### Share on other sites

Keep up the good work and yes keep us in the loop.

Thanks.

Now about about problem (it will be better to understood if you open attached scene)

My goal is to make, different colours, will paint different geometry.

So, to select by color, I used CR, CG, CB local variables. After little testing I noticed, that they are behaving strange, does CR = Color Red? Or it means sometthing else, because its not doing that I want.

I wanted to select red color, but only expression work was like this:

`\$CG&lt;1`

the thing is that, its select red color, which means, that "G" in "\$CG" is not standing for Green. I think that, expression \$CR>0, would be more logic, isnt it?

And if paint black color, its selecting all colors, so all geometry with specific color will be painted, but black have 0,0,0 color.

I looked in details view and got more confused , because color numbers were pretty strange.

Can anyone me explain that or suggest better way how to do that?

grass_gen_rnd_select_color1.hipnc

Edited by Tom
##### Share on other sites

You initialize the surface to white. That's rgb of (1,1,1). Next you paint red, white and black around the surface with original initialized white still there. This means that if you select on say red with \$CR > 0, you will also get the initialized white value.

It is always a good thing to properly initialize your attributes before you start to modify them. This is the same as when you write code or create a VOP shader. Initialize variable/attribute to 0 then build on top of that. No surprises.

See jw1 example attached.

At some point in time you will want to move away from Cd color and create your own attributes and paint in to those. For example you could create a float parameter that you can use to alter the hue of the grass and call it hueshift.

This is why you may want to create your own attributes for different types or initialize the surface to black then paint your colors.

See jw2 example attached. The default Mantra Surface has an added hsv shift built in to it that picks up the geometry attribute hue_shift if present. I personally like to add subtle hue shifts and a tiny bit of saturation modulation with procedural noise for grasses, shrubs and tree leaves all driven by geometry based procedural noise so you can see things on geometry. Please render out an image to see the grass with the applied width float attribute controlling the grass width at render time. Add a ramp parameter to the Attribute Create SOPs using the Modify Parameter dialog to allow you to shape the grass profile.

----

You may want to consider using the Fur SOP with the accompanying Fur Procedural with the shared CVEX context to build your grass system on top of.

grass_gen_rnd_select_color1_jw1.hipnc

grass_gen_rnd_select_color1_jw2.hipnc

##### Share on other sites

Thanks for tips ! Now I have much more ideas to test on grass. Need to arrange them according to my skill.

Still VEX is my weakest side in Houdini. Can you suggest some tutorials (free tuts would be better) about that or other useful information?

Edited by Tom
##### Share on other sites

For tuts on VOPs and VEX, as always hunt out Peter Quint on Vimeo. His channel is amazing chocked full of wonderful exercises clearly explained.

VEX/VOPs come out of the shading language world with many constructs pulled right out of the RenderMan world. Most vops are quite low level and are bare wrappers on the functions nested inside them. Having said that, any good book or web site on learning RenderMan can be applied to VOPs. The biggest thing to remember in VOPs is that type is king. Floats to floats and are the dark green. Vectors to vectors and are bright green. etc. Most things are quite simple in VEX such as adding a vector or 3x3 or 4x4 matrix to a Point to move the point. Yep it's that simple. No need to understand how to construct a vector or matrix, just know how to make and use them pretty much blindly.

If you have any questions, just fire away. I say dive in head first and get in to trouble then ask questions. Nothing like a good bout of frustration followed by a "yeah get it whatever" moment. I'm too old for those "lightbulb" moments any more.

##### Share on other sites

• 7 months later...

So I started working again on this asset, because I have project in progress, where I need this.

I want to create SOP OTL to paint on geometry, the problem is to bring paint handle from the network wich is in otl.

Any one know how to do that?

Edited by Tom

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×