Grass gen & L-system "nature"


(RipSting) #1

What’s up? It’s been awhile since I’ve visited the forums, but I’d like to announce the upcomming version of my grass generator! Here’s an image I created with my script in combination with the L-system tree generator by Armagan.

http://www.fireengine51.org/blender/grass.jpg

Grass stats:
281528 faces
took 55.57 seconds to generate
Subsurf level 1

Render stats:
1 spotlight with a 2560 kilobit shadow buffer
1 quadratic, spherical point light
52.81 seconds to render the scene

So the render took about 53 seconds… compare that to the hours it would take if those blades of grass were comprised of static particles! Also, the grass can receive and cast shadows!!! Since the grass is a mesh, IT’S ANIMATABLE! This version overcomes the vertex limit errors of previous grass/hair generators. You no longer have to split up the ground mesh! This can still run on multiple ground meshes at once as well!

Download it at http://www.fireengine51.org/blender/grass3.zip


(dreamsgate) #2

Yeah RipSting, I love it, just downloaded it, gonna play with it right shortly.

You rule!


(rogerm3d) #3

Downloaded too. Time to make fields of uh, grass and uh ,more grass. :stuck_out_tongue:
Like the pic too. pretty cool looking green grass and tree.


(Tobur) #4

Thanks very much for the great grass generator. I was allready working on a picture with grass made with the first generator in it but I will see if I can make it more realistic with the new script.

By the way, I’m missing the GUI of the old script. Will there be a GUI in the next release???

Tobur


(RipSting) #5

By the way, I’m missing the GUI of the old script. Will there be a GUI in the next release???

Sorry, but there isn’t a GUI right now… I’m working on integrating a wind script with the grass, and it would be extremely hard to make a GUI for a linked-script. Who knows if I’ll finish it though.

The picture I uploaded contains 281,528 faces, but I reduced it to 61,434 without degrading the quality. I just tweaked the segments(2), length(50), and density (40). Also made it look a little more random by increasing the gravity to 200. Shows that more is not always better.


(kaktuswasse) #6

doesnt work for me :frowning: Python says no module
named random


(PILER) #7

very nice, but dupliverts would work good too :wink:


(RipSting) #8

doesnt work for me Python says no module named random

You NEED to download python 2.0.1 (http://www.python.org/2.0.1/)!!! Random is an external module that comes with Python 2.0.1.

Once you install it, you’ll have to set a reference to it in your Windows environment variables (not sure how you do it in Linux).

For windows 9x/ME:
In c:\ there should be a file named autoexec.bat
Right-click on it and choose edit

paste this line of code in:
SET PYTHONPATH = C:\PYTHON20;C:\PYTHON20\DLLS;C:\PYTHON20\LIB;C:\PYTHON20\LIB\LIB-TK

Save it and close, then double-click autoexec.bat

For windows NT/2000/XP:
Right click on My Computer and select properties
Under the Advanced tab, click “Environment Variables”
Under System variables, click New
Variable name is PYTHONPATH
Variable value is C:\PYTHON20;C:\PYTHON20\DLLS;C:\PYTHON20\LIB;C:\PYTHON20\LIB\LIB-TK

This should take care of it!


(VelikM) #9

Nix systems

Try adding the line ‘import random’ on the line above ‘from random import random’
Then your going to get the error (very likely) ’ File “/usr/local/lib/python2.1/random.py”, line 143, in seed

import time

ImportError: No module named time’

Work around for that is at http://www.michaelv.f2s.com/blender.html look for ‘A fake time.py module to trick Pythons random() into working’ towards the bottom of the page. Put the script in your python dir. with the rest of the python scripts.
After that the script runs until this error message "RipSting’s Grass generator running…

Traceback (most recent call last):

File “Grass3”, line 121, in ?

AttributeError: mats"
The line reads “me.mats.append(matGrass)” is that a typo (mats) that is?
P.S. This is will only work on nix systems (I’m using OS X) (the work around for time.py that is)


(RipSting) #10

AttributeError: mats

I had tried to assign a grass material to the grass meshes as they were created, but I couldn’t get it to work reliably. I didn’t bother to take out the faulty code because it wasn’t generating any errors on my windows machine. But now I did and re-uploaded the .blend so you shouldn’t get that error.


(theeth) #11

nice job!

A couple of suggestion though:

Maybe you could use the Blender.Window.draw_progressbar function to show the progress of the script.

You can do a GUI for a runtime script if you use an external runtime file or an external data file for the settings. If you want help with that, just tell me.

As for GUIs, I can help you there too.

Martin


(VelikM) #12

That works! Nice script, it may have worked on a linux box, I think OS X is a little picky some times. :-?
I don’t have to add ‘import random’ any more, it works as is. :smiley:


(LohnS) #13

WWOOOOOOO, this is cool, thanx man, very handy stuff =D


(dreamsgate) #14

I love it, last night I was using it all over the place, I added grass to planes, spheres and a bear and a panther. It makes a pretty decent fur too. :stuck_out_tongue:


(kaktuswasse) #15

cool,works now


(Jolly Gnome) #16

Agh! How do I get it to work? I have Python 2.0.1 installed (or at least I THINK I have… I unpacked it, used ./configure and ./make ), but when I press alt-p, nothing happens (yes, I use the grass3.blend file)…


(Jolly Gnome) #17

Ah, I didn’t do the “make install” part :slight_smile:
When that’s done, I’ll try it again :wink:

edit—
No, does not work… :frowning: so the upper question is still valid


(theeth) #18

Did you get any error message in the console? The script takes a while to finish to run, so it might seems like Blender has crashed, but it’s still running.

Martin


(Jolly Gnome) #19

It doesn’t react in anyway… no messages in konsole, blender does nothing…


(VelikM) #20

Did you set the path to the python /lib in the top header (in Blender)?
Pull the top of the top 3D window down and add the python path (full path), it’s between the Auto save button and the Font button on the left side.
http://www.alaskalights.com/misc/addpath.jpg