Stylised Terrain Material


#1

Finally decided to sit down and experiment with what Shaders can be done in Armory. To start off with I decided to work on this terrain material.

Fairly simple setup. I’ve basically just taken the height from a given vertex and used that to drive a colour ramp. To get the hard gradient I set the colour ramp to constant.

I also attempted to fake sun light using an empty. Using drivers I was able to set the X,Y,Z values from the empty, to then get a dot product from the geometry normals. However, it seems that drivers do not update while running. Hence it would be nice to be able to get lamp data, and just get the sun’s vector.

Also still work in progress is the water. What I would like to be able to do is recreate a foam line where land meets the edge. Usually this can be achieved using scene depth. However, I am unsure on how to access scene depth in Armory.

Thanks


#2

Very cool! I created a ticket for drivers support and fixed the Camera Data node in this patch. Camera Data - View Z Depth should now return linear depth.


#3

@lubos

The Z depth works, however I think that’s not quite what I’m after.

I believe what is needed is access to a “Depth Fade” as UE4 calls it. It is a way of getting an intersect between materials “translucent material intersects an object with an opaque material” - https://answers.unrealengine.com/questions/372899/material-intersection.html?sort=oldest

Something like this would be useful not only for water foam, but also things such as energy shields that could clip through other objects.

EDIT:

Another way might be to use Dynamic Paint.

Current it is possible to get the vertex colour of a mesh, hence it could be possible to use Dynamic Paint to paint the vertices of the water to create the foam effect. Only issue with this is that the Shader isn’t updated in realtime to reflect the movement of objects.


#4

Is there anything on this?


#5

I haven’t touched this in a while. Not sure if any of the extra Engine features I asked about have been developed any further.