Grass Module 2

Everything related to 3D programming
Kelebrindae
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 01, 2008 3:23 pm

Re: Grass Module

Post by Kelebrindae »

Hi, Alexi.

If you replace:

Code: Select all

         vertex_program_ref vs_Grass {
            param_named_auto offset custom 1
         }
by

Code: Select all

         vertex_program_ref vs_Grass {
            param_named_auto offset costime_0_x 10000.0
         }
in grass.material, you can skip the calls to "Grass::Update(hGrass)" in the PB code.

=> you loose a little control over the grass blades, but it could lead to a big performance increase (all the animation is done in the shader + no need to access the entities, so you can use static geometry).
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Grass Module

Post by Bananenfreak »

Uhh, thank you alexis. I will test it as soon as possible :)
Image
Kelebrindae
Enthusiast
Enthusiast
Posts: 151
Joined: Tue Apr 01, 2008 3:23 pm

Re: Grass Module

Post by Kelebrindae »

You're welcome! :)
You can find all the "auto" parameters here: http://www.ogre3d.org/docs/manual/manua ... d_005fauto
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Grass Module 2

Post by Samuel »

Alexi wrote: Shadows actually not working, maybe the shader master samuel will take a look. :)
I'm not even close to a master. A master would know what he's doing. Half the time I'm guessing. :D

Sorry for the late reply. I've been busy, but I finally found the time to look through the shader.
The original script was setup to use a shadow caster and receiver.
As far as I know we can't use them because we need to enable them in Ogre with

Code: Select all

SceneManager::setShadowTextureCasterMaterial("ShadowCasterName");
SceneManager::setShadowTextureReceiverMaterial("ShadowReceiverName");
So, I don't think there's much we can do about the shadows for now.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Grass Module 2

Post by Bananenfreak »

Hmm, then cut the Piece with shadow out of the material,... . If TextureAdditive works in your example, it could be possible that we see right shadows (I believe there were big grammar issues).
Image
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Grass Module 2

Post by Samuel »

http://www.purebasic.fr/english/viewtop ... 77#p421777
This was a method I used in the past to allow TextureAdditive shadows on an alpha image.
Unfortunately, I can't get it to work in this case.

I believe it doesn't work now because we are using shaders to create the wind effect.
The shader has control over the texture and how it gets applied to the scene.
In my old example I was just using a simple material script without shaders.

If someone can get my old example to work with shaders or find some other way to create the shadows that would be great.
If not then we will probably have to wait until we can get more control over the shadow materials.
Assuming I understand all this correctly. If and when we get control of the shadows. We will be able to create shaders for soft shadows and other cool shadow effects.
User avatar
Bananenfreak
Enthusiast
Enthusiast
Posts: 519
Joined: Mon Apr 15, 2013 12:22 pm

Re: Grass Module 2

Post by Bananenfreak »

No shadow isn´t right... :lol:
Image

"Shadows" are only updated at the end of move from left to right or right to left. And... It´s not really a shadow. I think it casts itself...
And also there is one terrainbug. I posted it already a few months ago.
Image
Post Reply