Already new standard material, based on NodeMaterial?

I went back and extended the SimpleMaterial sample to meet my needs. Works quite well so far, except that the ShadowGenerator sometimes does not generate a shadow. I asked another question today in this forum because it’s another topic.

Thanks so far for your help!

1 Like

@mattes3 Did you succeed in implementing a material for height dependant texturing with propper lightning/shadowing? I could use such a thing for my current project as well. I’ve played around with the worldmonger groundMaterial, but it lacks lightning/shadowing AFAICS.

Hi @holger,
yes, I succeeded in doing so. The shadows are cast on the terrain because I included the standard shader includes in my terrain shaders that I derived from the Worldmonger example. It worked pretty much out of the box because I used the SimpleMaterial class as a blueprint.

how are the standard shader includes included? I’m currently using the unmodified ground.fragment.fx and ground.vertex.fx shaders from worldmonger. Sorry, but I don’t fully understand I’m relatively new to this.
Any help appreciated!

I was totally new to that as well. I took these three files as templates and mixed the Worldmonger shader into a copy of them:

In simple.*.fx, you see include statements like this:

#include<shadowsVertex>[0..maxSimultaneousLights]

Statements like that include the standard shader snippets that reside in this directory:

You can find the included files pretty easily when you click “Find file” on Github and type some of the characters of the filename. Github will search the file for you.

Let me know if this helps.

Hi @mattes3,
thanks for the quick reply! As you suggested I’ve made a copy of the 3 simple* files and put them under the name groundMaterial into my project. Beside the renaming it needed no further modification to use them as a new material with a single texture for my terrain.
Now I need to make the neccessary modifications and patch the woldmonger code in. Please could you confirm if these steps are correct

  1. modifying my new groundMaterial so it can handle the needed textures (ground, rock, sand, grass, snow, blend) and set the appropriate uniforms into the shaders
  2. place the worldmonger fragment/vertex code at the right place (wherever that is :slight_smile: ) into the shaders of the new groundMaterial to handle the height dependant texturing

Thanks again for any help!

Hi Holger,
Sounds good to me. I did it tgat way and it worked!

Hi @mattes3 it worked out so far, thanks for all the help!

Good job @holger. Have fun!
Matthias