Terrain objects have a “base map distance” parameter on them; portions of the terrain beyond that distance appear to use an alternate rendering method.
But which shader represents that rendering method? I’m working on some alternate terrain shaders for our current project, and basing them off of the terrain shaders in the “builtin shaders” package. But as far as I can tell, none of those appear to be the shader used for this low-res basemap portion of the terrain. Is there another one, hidden somewhere?
I am using Unity 3.1 and all terrain within the Base Map Dist. parameter, is rendered with the “Hidden/TerrainEngine/Splatmap/Lightmap-FirstPass” built-in shader, which I have managed to override, as is mentioned here.
I would also like to override the far terrain. Could anyone please inform me which built-in shader I should override to accomplish this? Many thanks in advance.
AFAIK, far or near use the same shaders. Of which there are two.
The first you already mentioned (Lightmap-FirstPass) is used for the first 4 textures that are applied on the terrain.
For every further group of 4 textures you apply, the same additive pass shader is used: “Hidden/TerrainEngine/Splatmap/Lightmap-AddPass”
You can find the original version in the built-in shaders.
NB My goal is to not-show the terrain in Unity v3, and do-show the trees and other terrain-stuff. Meddling with the ‘addpass’ shader, I did not gain any desirable results.
Using the info from Aras, I succeeded in overriding near, as well as far terrain, using a self-written shader for “Hidden/TerrainEngine/Splatmap/Lightmap-FirstPass” and another similar self-written shader for “Diffuse”.
This -is- a solution, however the drawback to affect any other diffuse object is kind of nasty. Because other assets that use the normal diffuse shader (or diffuse assets imported in the near-future somewhere) shall also become invisible. Therefore extra care for all other diffuse objects-other-than-terrain will have to be coded into the Unity Editor to use some local copy of the original “Diffuse” shader.
It does not feel right to be affecting diffuse objects (in FbxPostProcessor) when all I want is to change behaviour on the far (and near) terrain. Does anyone have any info on maybe another way to get to the shader on the far terrain, like in run-time change the shader for the far-terrain or something? Thank you in advance and to all: good luck with the shaders in v3.
I’m actually having a similar problem. If the far terrain is rendered with a regular diffuse, it is a problem for me, i end up with ‘holes’ in my rendertextures – this is alleviated if i override the Diffuse texture and write: o.Alpha = 1;
For the time being, i’m going to test this out and see if this is good enough.
However, if i override that, it (may?) have dire consequences for the rest of my scenes. Would love it if this diffuse shader were overrideable/selectable in a more manageable way. I’m using alternate shaders for most everything that needs alpha channel data, to share textures with other applications using this: http://syphon.v002.info Much thanks to Aras for helping me get that working with Unity properly!