• Dear visitors,

    The email issue has been finally solved.
    Thank you for your patience and happy browsing.

    Team ACM.

SHADER blending method for grass/sand/dirt

Mitja Bonca

Active Member
But how to select some colors, which needs to be transparent, which have almost the same shade as the colors I need to show (not transparent)?
Good example would be the mixed part of sand and grass which is just beside the tarmac?

Example image:


You can see some examples of tarmac and grass and whats in between, the mix of grass and sand.
So lets say the starting image has part of tarmac and sand or brown soil. So what I need is to create half of sand or soil trandparent, but in not repetative way. How to make it so?
 
Last edited:

luchian

Administrator
Staff member
Oh, ok. I was referring earlier to the specific skid marks example :).

Back to you question, there are definitely more ways to do this, but here is one of them:
The alpha acts like a mask, white=no transparency, black=full transparency. So in your texture, you will need to mask out the parts you wish to be transparent. Let's look at an example, from a conversion I am making.
tex_diff.jpg
tex_alpha.jpg


First image, is how the diffuse texture looks like. On the 2nd image you can see its alpha channel, with all the areas that will be masked out.
In-game, there is one mesh for the grass, one mesh for the sand. At this point there is no blending between them, as you can see bellow:
grass2sand_noblend.jpg


Now, if I add a supplementary mesh with a width defined by my previous "blend" texture (the one with the alpha), and use a shader like ksPerPixelAT, this is what I will get:
grass2sand_blend.jpg


So, what you actually see, is 3 meshes: 1 for sand top, 1 for grass bottom, 1 for belnding middle. I made an approximate division graph :).
grass2sand_blend_div.jpg


NOTE: again, this is just one way to do it.​
 

Mitja Bonca

Active Member
This is exactly what I wanted to know, and a bit more, maybe I wasn`t clear enough.
The main thing is how to create an alpha channel from this left image of yours for example? Do you do an additional image and then paste it into alpha channel of the diffuse image, or what you do?
Because if only selecting with magic wand tool is not enough from a diffuse image.
 

luchian

Administrator
Staff member
Just paint by hand in the alpha layer. As what you are looking to do is a "blending" zone, there is no correct or wrong shape :). Just paint in full white in the middle, as seen in image - this will assure it covers correctly and fully the border between your 2 other textures. Then add some gradually scattered brush strokes (use any brushes you have in PS) to obtain something similar to what you see in the example.
 

Gunnar333

Well-Known Member
Here is how I did the road - grass transition.



I have attached the dds texture and preview images

alpha.jpg diffuse.jpg

You can see that the texture fades from street shadow over dirt to transparent.

The asphalt_to_grass object is just a single side plane that sits about an inch above the "normal" grass object but the edge/vertexes at the asphalt side are connected to the road object.

screenshot.jpg
 

Attachments

RacingSounds

New Member
Hi guys, maybe a dumb question but I've been at this for much too long. I've created a single plane on the grass/sand edge and Ive managed to find a nice looking blend, however somehow it keeps showing up horizontally instead of vertically along the grass/sand edge. I have tried several things, but somehow I can't figure it out. If needed I could post a pic of it! Thanks in advance if anyone has a thought on this

Edit: I fixed it by redoing the UV mapping.

Now I run into this problem where instead of a nice transition I get gravel on either side. I'm using the fresnel_nm shader, and some kunos materials just to test things out. Does anyone know how this can be fixed?

 
Last edited:
Top