New Terrain Shader on base of the Lighted Terrain Shader

Hello Folks, first of all, i have to thank all of you for the real good work on this Environment.

I’m working with the JME for 6 months or so and this is my first post in the forums.



A few days ago, i stucked at the developement of my current project, cause there was no posibility for

some nice textured slopy mountains in combination with a used alpha map which overrides the slopynes.



That’s the reason i start to combine the Lighted Terrain Material Definition and the Height Based Terrain Material Definition

After it’s done i want to distribute it first of all as a thank you for all who helped me with their Postings on this Site.



So here it is:

TerrainLightingHeightBased.j3md

TerrainLightingHeightBased.frag

TerrainLightingHeightBased.vert



The Path in the Material Definition has to point on the right Place.



A few Screenshots of my current project which demonstrate the Different Layers of Fragmental Shading.



Sloped Grass Texture on Alphamap on Channel Red





Non Sloped Road Texture on Alphamap_1 on Channel Green





A Combined Shot where you can see the difference between the two channels





So what changed from terrain Lighting to this one?



First of all 3 Alpha Maps are supportet, but only with their rgb values.

2 reasons for this:

First of all i needed to get rid of one Texture cause of the 12 Texture maximum.

Second in my game i use a Alpha map Generator which doesn’t work very well with an Alpha channel.



So the Diffuse Maps and Normal Maps are limited to 0 to 8



The Slope Texture is set by the Variable “SlopeColorMap”

and the Size is set by “Slope_scale”



Thats it with the Variables.



Explanation:

The Slope Coloring is done after the calculation for the first Alpha Map. So use the first alpha Map for

Terrain Textures which should be overlayed with the slopemap.



The other 2 Alpha maps are generated after that, that you can draw a road or something on a sloped grassy hill.

2 Likes

Looks nice :slight_smile:

I don’t get the difference with the actual terrain shader.

Could you explain?

1 Like

This Terrain Shader has the ability to texture the hill sides in a predefined texture which is mixed with the one defined from the alphamap like the slope texture on the height based material. The textures from alphamap 2 and 3 are solid and don’t get mixed with the slope color. so you are able to take a alphamap which say’s everything on the terrain should be “grass”, set a slope texture “dirt” and the shader generates the terrain seen in the screenshots. if you set a road on Alphamap 2 or 3 which crosses the terrain this road doesn’t get changed.



I agree that there is no real big difference from the Terrain Lightning Material Shader “BUT” if you want to generate a freeform generated Terrain then you need something like this.