Advanced Texturing and Displacement Component for Meshes and Terrains[Released]

Advanced Texturing and Displacement Component for Meshes and Terrains
Version 2.0 for Unity 4
This system allows for multitexturing a mesh or a terrain, based on a splat map with up to 4 textures. Each splat is normal mapped, and they have the option (at runtime or compile time) of being parallax mapped, relief mapped or tessellated(depending on platform/device capabilities). The level of displacement is set per texture, as is the specular colour. A specular map can be integrated into the diffuse map alpha channel using the tools provided. A full mesh normal map can be integrated with the splat normal maps, and a fallback texture can be provided as well.

Shaders compatible with Unity’s built-in terrain(up to 4 splats) are supplied, but a set of tools is also provided to export the terrain into a mesh and the required maps (although not vegetation or trees at this point).

In short, this system provides:

  • 4 texture multitexturing with normal maps
  • parallax mapping
  • relief mapping
  • per splat height based tessellation on DirectX11 capable hardware
  • per splat specular and specular colour
  • whole mesh normal map
  • whole mesh fallback texture
  • PS 2.0 fallback(4 mesh multitexture+ whole mesh normal map) that also runs on modern mobile GPUs
  • whole mesh shininess for Beast interaction
  • specular map into alpha of diffuse tool
  • tool for integrating splat heightmaps for displacement mapping
  • per material options
  • built in terrain mesh exporter
  • built in terrain splatmap exporter
  • heightmap exporter for built in terrain to generate whole mesh normal map
  • texture grayscale exporter for simplified displacement map, where displacement map for texture is unavailable
  • splatmap normalizer tool
  • simplified texture generator
  • a five level quality system

Extras

  • An experimental four splat with per-splat normal map, specular map and specular colour for Tegra 3 based mobiles with a fallback to the shader mentioned above for other mobiles. (Note: this is very resource intensive, and so should be used sparingly)
  • Included in the shader directory is an example shader that performs Parallax Occlusion Mapping with soft self-shadows. This is included so non-splatmap based objects can also have POM with colour specular.
  • A simple shader is included that used the outputs of a “Generate Simplified Textures” tool to provide basic parallax displacement and colour specular.

Screenshots

Webplayers
Note: Parallax Occlusion mapping no longer supported

The Quality settings are as follows:-
For non DirectX11 demos:

  • Very Low: Normal mapping, normal blending.
  • Low: Normal mapping, height blending.
  • Medium: Parallax mapped normal mapping, height blending
  • High: Parallax occlusion mapped normal mapping, height blending
  • Very High: Parallax occlusion mapped normal mapping, height blending and self-shadowing

For DirectX11 demos:

  • Very Low: Normal mapping, normal blending.
  • Low: Parallax mapped normal mapping, height blending
  • Medium: Parallax occlusion mapped normal mapping, height blending
  • High: Parallax occlusion mapped normal mapping, height blending and self-shadowing
  • Very High: Tessellated displacement

The Unity 4 terrain version of the component and the quality system

The Unity 4 terrain version of the component and the quality system in DirectX 11 mode.

The component and quality component used for a tree scene.

The component and quality components showing an interior “cave scene”.

The component and quality components showing an interior “cave scene” in DirectX 11 mode.

An interior “cave scene” using the simplified shader for low performance hardware.

An illustration of realtime splatmap animation, using a script to update the texture

Finally

Please read the following links to see if you think this component is right for you before buying:
Full Documentation
FAQ

[Asset Store Link]
It is available now at the Asset Store for $35.

Dude this is awesome! however I did notice that at the hill, where there is a steep angle a weird animaly occurs (it is visible when you move but I’ve attached a screenshot to show you the location) - it looks like a mirrage or something and deep “holes” appear

also it would be cool to see a demo on a large scene - will it be very slow?

What exactly would be the benefit of baking a normal map of your heightmap at the same resolution of your terrain?

Ah yes - that’s very strange - It seems to be a problem with the Parallax Occlusion mapping shaders. I’ll see if I can sort that out, and show a much bigger terrain.

It allows you to attach a full size normal map onto a terrain you’ve converted into a mesh(using the other tools provided) and then decimated.

I found the problem - it appears to be a known issue with parallax occlusion mapping when viewed at a grazing angle (which is more noticable on terrains, unfortunately). To minimize it, I’m rewriting the shaders to lerp in normal bump mapping only in those areas so it is less noticeable (which, as far as I can tell, is the usual way to fix it:) )

When that’s done, I’ll re-upload the demos + a big terrain demo and send the new package to the asset store.

Mini-update on the grazing artifact issue:

I have the fix I mentioned in the above post to reduce the issue, however, it will only work with the normal parallax occlusion mapping version. When combined with the self-shadowing version, the shader compiler runs out of bindable resources, as the fix needs more information sent to the surface shader.

As I said before, when I finish the large terrain demo, I’ll put it up in this thread and send the updated package to the asset store.

Whilst fixing the above problem, I have found another problem with the parallax occlusion mapping that appears to be specific to Unity. As the parallax occlusion mapping shaders are not of the same standard as the other forms of displacement mapping in the component, I am going to remove them. Relief mapping should provide a similar level of visual quality for non DirectX 11 tasks, and ray tracing anomalies will, of course, not affect tessellation.

Hi

How do I get a basic setup for the terrain shader to work?

I added the script to my terrain, and added splat1, but it stays white as in nothing is showing… do I have to do more for relief mapping?

EDIT: okay, at least I see the basic Texture now… if I define one in the normal Terrain script from unity.
I don’t see what I define in the Advanced displacement shader…
What I noticed is that I loose the splat texture definition everytime I hit play. They are empty if I reopen them afterwards. Why?

EDIT2: It gets even weirder:
When I open the U4Terrain scene, and replace one of the Textures with a different one, switch off the height blending, and paint the pathway new with that texture (the old one got dropped because of the replace), I see the new texture perfectly in the editor view, but I don’t see anything in the game view… WTF?

EDIT3: now I got everything to work in the Demo scene, but I always loose my splats in my own level still… why?

I’ve replied to your bug report, but I’ll expand on why you cant see the diffuse splats sometimes in the component. When you use Unity’s builtin terrain, the diffuse splats are handled by Unity’s terrain component, and can’t always be changed by an outside material, and any shader that can be used with the terrain has to follow the form of the built-in terrain shaders. This means that the diffuse textures are still there, but they can only be seen/changed in the Unity Terrain component.