Jump to content

Terrain Texturing Shader


SpiderPig
 Share

Recommended Posts

I'm looking for someone to write a terrain shader that will texture a terrain model based on height and slope.

 

I want it to use uniforms for the height and slope of each layer so I can change them through code.

It will need to use at least four layers - each with diffuse, normal and specular maps. If it can use more layers that would be better.

Also I would like the option to use an alpha map to further control where textures are shown.

 

The terrain is a cube, pictured below;

 

post-243-0-13066100-1495147933_thumb.png

 

Would like it by the end of the month if possible.

Will pay for the work too. PM me if interested. smile.png

Link to comment
Share on other sites

Not sure you can allocate 13 channels? (4 diffuse, 4 normal, 4 specular + 1 for alpha), can't test right now.

Might work if you pack specular into the alpha channel of the normal texture, then you would need only 9. (4 color, 4 normal with specular as alpha) + one mask alpha.

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

float slope = 1.0-ex_normal.y;
vec4 g1=texture(texture0,ex_texcoords0*42);
vec4 g2=texture(texture1,ex_texcoords0*42);
vec4 g3=texture(texture2,ex_texcoords0*42);
vec4 g4=texture(texture3,ex_texcoords0*42);
vec4 g1full=texture(texture0,ex_texcoords0);
vec4 g2full=texture(texture1,ex_texcoords0);
vec4 g3full=texture(texture2,ex_texcoords0);
vec4 g4full=texture(texture3,ex_texcoords0);
g1=mix(g1,g1full,0.2);
g2=mix(g2,g2full,0.2);
g3=mix(g3,g3full,0.2);
g4=mix(g4,g4full,0.2);
outcolor = g1;
outcolor = mix(outcolor,g2,smoothstep(0.0,0.05,slope));
outcolor = mix(outcolor,g3,smoothstep(0.01,0.125,slope));
outcolor = mix(outcolor,g4,smoothstep(0.125,0.26,slope));

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

  • 2 weeks later...

I'm not sure if you got anyone to work on this, but I would suggest replacing one of Leadwerks texture unit bindings with your own bindings. This way you can support texture arrays, which allow you to have 256+ textures for a single texture unit. This way, you also get sampling modes and mipmapping to work correctly (which can't get with a texture atlas).

  • Like 1
Link to comment
Share on other sites

Leadwerks allows up to 16 (1-layer) textures to be bound to a material. You can bind your own OpenGL texture array to one of these units, giving you at least 256 texture (I think that's the minimum in the specification). They all must be the same resolution, have the the same number of mipmap levels, and be the same format though.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...