Procedural Grass Geometry Shader [GLSL 4.0 v.3 && GLSL 1.5 v.2] AMD fully supported!

Yes that worked but i have another problem.

Hey, after some time I get a new question. Why I can use only the first four textureslots? For example when I move the stencil map to the fifth slot and change the “shader.setSampler(‘Texture1’,0)” to “shader.setSampler(‘Texture1’,4)” it don’t works because no grass will be placed. But when I interchange the first four textureslots and set the right slotindex in the shader it works.

Sorry that I ask again but no one has an idea? Or can’t you understand my question?

Okay, I found out that it’s probably a bug.

Anyway I have another little question, Why you don’t use a simple time Property instead of

own['Time'] = time.monotonic() - own['startTime']

?

Can you use some of this evil wizardry to instance a game object, and draw it over static instances of invisible cubes ?

  1. all objects with the property ‘Dupe’ are gathered in a position and rotation matrix ?

  2. a object is drawn over each instance of the cubes, if they are within the camera futurism?

It is called frustum, for you to know;)

I always transpose them for some reason.

Hah… Yeah… They may sound similar, but they’r meaning is very diverse:D

The grass doesn’t move in the wind with fullV3 but it does in the liteV2. I’m using Blender 2.75, Nvidia 880GTX. Any reason why this is happening? An how to fix it?

Thanks :slight_smile:

The grass doesn’t move in fullV3 for me. Using Blender 2.75, with an Nvidia 880GTX card. Any reason/fix for this?

Look at post 48 on page 3 there is a Link to a fixed code that you can copy to replace the current code in the blendfile.

After looking at my problems with this… (An orange screen) I have concluded that I have gsls 1.3 or 1.4? And have to up grade to 1.5 or higher… Sad day:-(

Very good! I was able to transfer everything to my project fine.

However, when I view the sky through the camera (in my own blend, not yours) it doesn’t show up. However, if I move out of camera view, it renders just fine. Any solutions?

EDIT: Nevermind, my camera distance wasn’t far enough. :spin:

I use time.monotonic() because it is separate from the fps. The time property updates once per frame, making it inaccurate. For instance; if I was to use a time property the wind speed of the grass would be twice as fast at 60 fps vs 30 fps. I use time.monotonic because it keeps things like the wind speed the same no matter what the fps is.

I really wish blender would base the time property on an actual clock instead, for many reasons…

I am sorry BPR, but I do not have the time right now for additional projects. I have split myself between too many projects and need to wrap some of them up before I tackle more…

I need more info to troubleshoot your problems…
What OS are you using?
Are there any errors in the console?
Check the readme for additional info to post…


I have started work on updating the shader again.

To start with, I have now included code that updates the number of lights automatically. When a new light is added to the scene, it will detect the new light/s, update the lighting information, and reset the shader (deletes the source and recompiles the shader). The fps stutters for a couple frames when this occurs (perhaps 2 frames?) and cannot be prevented, so I would recommend changing this as a menu item.

The second change that I have working is making the number of instances (invocations) a property that can be altered. Again, this will require the shader to be reset and will stutter for a couple frames, so I also recommend this variable be changed as a menu item.

The last change that I have put into the code is the final LOD level. As with the other two LOD levels, the grass will fade out before it ‘pops’ out of existence. It looks quite smooth IMHO. However, I had to adjust the second LOD level to accommodate the final level. If I had left it as it was, the grass would have extended too far out. I extended the example ‘ground’ to test the final LODs.

Pics from slightly elevated positions to showcase the LOD levels:




With those changes complete, I will be turning my attention to additional lighting methods that the user can choose between. I have already mentioned what I have planned to implement earlier, but to reiterate they are: per-object, per-vertexGroup, per-vertex, and per-fragment. They will be implemented in the same method as the above changes to number of lights and instances, so it will require the shader to be reset (which, again, causes a stutter).

Once I complete the changes to the lighting, I will post a new update to the full version first. Afterwards I will adapt the changes for the lite variant, which should not take long since most of the changes will be the same.

oh I haven’t seen that before. Nice to hear that you found time to work on the shader again and that are cool features what you described. I’m very interested to test it when it’s finish.:slight_smile:

any new work on this?

do you think you could help me impliment ‘autoGrass’?

I was thinking any vertex that has a green value over .5 gets grass

also I was thinking any vertex over .5 blue gets rocks emitted / pebbles

1 Like

Did you pm yarbrough08?He created this script.

@bpr, since upbge now have build-in geometry shader, you can now learn glsl. :slight_smile:

Congratulations! This is very useful.
I use the lite version.
Can you make this run on upbge 0.1.4?
On UPBGE it shows these errors:


I found a strange issue. I get errors with


const float A = 0.15;     //For Uncharted2Tonemap\\
const float B = 0.50;     //|                   |\\
const float C = 0.10;     //|                   |\\
const float D = 0.20;     //|                   |\\     removed
const float E = 0.02;     //|                   |\\     removed
const float F = 0.30;     //|                   |\\     removed
const float W = 1000.0;   //For Uncharted2Tonemap\\

but not

const float A = 0.15;
const float B = 0.50;
const float C = 0.10;
const float D = 0.20;
const float E = 0.02;
const float F = 0.30;
const float W = 1000.0;

Idk why but it seems like the comments are causing issues.