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

I updated the shader to run with UPBGE.
Blenderartist: ProceduralGrassShaderLite_v2 UPBGE.blend (8.58 MB)
Dropbox: https://www.dropbox.com/s/zjgts49o9hr50zc/ProceduralGrassShaderLite_v2%20UPBGE.blend?dl=0
MediaFire: http://www.mediafire.com/file/b1mrl4mwpja4n6h/ProceduralGrassShaderLite_v2_UPBGE.blend

GREAT! :wink: I have been eyeing this for a while, but not so competent with shading so I never bothered to download it…is it fairly easy to setup? as in lod distances or grass density? I will download now and have a look, but feel free to answer…I may get stuck…I’m pretty damn old :wink:

EDIT: NVM I got in it and did some adjustments to the polygon spread and was not happy with the performance in a real open world situation…I get more performance with my own placement of objects with culling and lod…it just takes longer :slight_smile:

Its not using the geometry shader of upbge?

Its not using the geometry shader of upbge?

The original use my geometry shader hack for the BGE.
The new version use in post #98 use the built in geometry shader API from the UPBGE.

thanks Hg1

Great, it have a nice speed.

Grass is looking great in video. Unfortunately i can’t see it in my blender 2.79, i see no grass just black terrain. :frowning:

I have AMD videocard.

you must use upbge I think* but not certain what version

UPBGE supports geometry shader since version 0.1.0.
For BGE you hae to use the versions in the first post.

I used UPBGE with pleasure but last build i downloaded didn’t launched on my PC. As blender 2.8 didn’t launched as well. So i had to switch to blender 2.79

Have tested the version V2 and V3 (first post) with Blender 2.79 and it works for me.
If the latest UPBGE version don’t work you can also go back one version.

But basically I think your problem depends on your graphics card or the driver.
Which operating system do you use and which AMD graphics card do you have?

There are always problems with amd and this shader, amd should fix that haha.

V3 grass does not move

Python script error - object ‘GroundGrass’, controller ‘Python’:Traceback (most recent call last):
File “ProceduralGeometry.py”, line 586, in <module>
NameError: name ‘Radius1’ is not defined

V2 Works as it should on AMD

system used:
ryzen 5 1600
16 gb ram
saphire rx470 nitro 4gb oc+

oh and used blender 2.79

Very good :slight_smile:
But I have a problem : the .blend work on my pc, but when I import the GroundGrass on my project, the texture of the grass is not rendered and all the grass are orange.
But when I import the GroundGrass on a empty project, it’s work, I don’t understand this. Is too bad, the shader work but I can’t use it on my project. :frowning:

V3 grass does not move
[QUOTE]
Python script error - object ‘GroundGrass’, controller ‘Python’:Traceback (most recent call last):
File “ProceduralGeometry.py”, line 586, in <module>
NameError: name ‘Radius1’ is not defined

[/QUOTE]
Script: ProceduralGeometry.py
Fix initialization (Script mode) by replacing local variables with global variables.

Scrpt: sky
Fix comments fom line 77 to 83 (Nvidia).

galidraan Very good :slight_smile:
But I have a problem : the .blend work on my pc, but when I import the GroundGrass on my project, the texture of the grass is not rendered and all the grass are orange.
But when I import the GroundGrass on a empty project, it’s work, I don’t understand this. Is too bad, the shader work but I can’t use it on my project. :frowning:

Orange means a there is a Shader compile error. Maybe you use an other shader and the script don’t find the right program to overwrite. The GroundGrass need to be the last shader in Blender. But there is no good way to determine this in BGE. That is why the UPBGE is a better choice for geometry shaders.

Attachments

ProceduralGrassShader_v3.blend (8.22 MB)

I have a system in my game where vertex color red = 1 is grass

could you help me adapt the script to emit grass in upbge only from areas with a red over .75 or so?

I am not skilled in glsl at all*

also it’s all objects with a single node material
is it possible for the shader to target all tiles?

see what I mean about the tiles?

(see how you can paint grass / dirt / mud on the terrain?)

Before several test, I think that my problem is directly link with the number of objects ans textures in my project.
There are no other shader and sometime when I delete object or texture the shader work.
My project has lots of big texture and I think that is the real problem. The problem are still there with the lite version, I havn’t idea to fix the problem without reduce the asset off my project.

could you help me adapt the script to emit grass in upbge only from areas with a red over .75 or so?

The shader already only use the red color channel of the first texture.
To change the threshold value to 0.75 change the value in ProceduralGrassShader_v3.blend at line 245 in to if (Height >= 0.75).

also it’s all objects with a single node material
is it possible for the shader to target all tiles?

I don’t know how your tile system works, so I can’t give you an advice.
But you can’t mix the geometry shader with a node material. The custom GLSL shader will overwrite the blender or node material.
That is the reason why the shader use an additional plane.

Before several test, I think that my problem is directly link with the number of objects ans textures in my project.

Yes old or cheep graphic card are very limited. The maximum amount of textures per shader is limited as well the maximum shader size.
Try to don’t use to much color ramps (I don’t know why but 3 textures are bound).

nice, so I need to use 2 tiles per tile,

1 for geometry shader and 1 for ground texture,

move tile, deform geometry / recalc normals -replace mesh on geometry tile
/use shader on geometry tile.

nice, so I need to use 2 tiles per tile,

1 for geometry shader and 1 for ground texture,
I will check it out monday :3

move tile, deform geometry / recalc normals -replace mesh on geometry tile
/use shader on geometry tile.

Ok I have tried the .blend

MouseLook.py is using 6.5 ms logic!!

lol my whole game barely uses that!

NM it seems to have ironed itself out*