possible to make a fog zone?


I have a “near” terrain which is 300x300 regular terrain object and a “far” terrain which is about 10 times bigger. I would like to have fog affect mainly my near terrain with very little getting to the far terrain. Is there a way to do this? I have already tried linear fog but I can’t seem to get it to have enough fog in the nearby trees without too much fog in the distance. Thanks.



I have at least a working answer to my question. With help from Farfarer in the Shader Lab forum and Ehren here in Unity Answers, I was able to make a custom shader for the "far" terrain that disabled fog, and this gave me the effect I wanted.

Here's how I made the fogless shader: First I followed the directions from Ehren in his post using the built-in shader Normal-Diffuse.shader. But being new to shaders, I got confused as to where to make the code changes -- not in the compiled shader that opens from the shader itself. Make the change in the code you get when you press the Edit button next to the shader name in the material inspector. Here's the code I got from Normal-Diffuse:

Shader "Diffuse" {
Properties {
    _Color ("Main Color", Color) = (1,1,1,1)
    _MainTex ("Base (RGB)", 2D) = "white" {}
SubShader {
    Tags { "RenderType"="Opaque" }
    LOD 200

#pragma surface surf Lambert

sampler2D _MainTex;
fixed4 _Color;

struct Input {
    float2 uv_MainTex;

void surf (Input IN, inout SurfaceOutput o) {
    fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
    o.Albedo = c.rgb;
    o.Alpha = c.a;

Fallback "VertexLit"

And here is the change that makes it into a fogless shader:

Put the line Fog {Mode Off} after the "SubShader {" line.
Above/below/between the "Tags" and "LOD" lines.
And also change the first line of code to "Custom/Diffuse_noFog"
or to whatever you named your custom shader.