Skip to content
Snippets Groups Projects
Commit 96534161 authored by kgingras's avatar kgingras
Browse files

height based shader

parent 862e7590
No related branches found
No related tags found
No related merge requests found
Showing
with 186 additions and 38 deletions
Assets/BlackHex.png

75.4 KiB

fileFormatVersion: 2
guid: 948ffeab02ade3a4e8b26ff552b0ec82
timeCreated: 1454619264
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
Shader "Custom/HeightDependentTint"
{
Properties
{
_MainTex ("Base (RGB)", 2D) = "white" {}
_HeightMin ("Height Min", Float) = -1
_HeightMax ("Height Max", Float) = 1
_ColorMin ("Tint Color At Min", Color) = (0,0,0,1)
_ColorMax ("Tint Color At Max", Color) = (1,1,1,1)
_ColorMid ("Tint Color At Mid", Color) = (1,1,1,1)
}
SubShader
{
Tags { "RenderType"="Opaque" }
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
fixed4 _ColorMin;
fixed4 _ColorMax;
fixed4 _ColorMid;
float _HeightMin;
float _HeightMax;
fixed4 tintColor;
struct Input
{
float2 uv_MainTex;
float3 worldPos;
};
void surf (Input IN, inout SurfaceOutput o)
{
half4 c = tex2D (_MainTex, IN.uv_MainTex);
float h = (_HeightMax-IN.worldPos.y) / (_HeightMax-_HeightMin);
if(h<_HeightMax/2){
tintColor = lerp(_ColorMid.rgba, _ColorMin.rgba, h);
}
else{
tintColor = lerp(_ColorMax.rgba, _ColorMid.rgba, h);
}
// tintColor = ((h /_HeightMax) * 255, 1, (h /_HeightMax) * 255, 1.0);
o.Albedo = c.rgb * tintColor.rgb;
o.Alpha = c.a * tintColor.a;
}
ENDCG
}
Fallback "Diffuse"
}
fileFormatVersion: 2
guid: 03eb77c556cce484ebd76cdaa4deeb97
folderAsset: yes
timeCreated: 1454465229
guid: 6d74913036a4c3040a87e3a391a0bde4
timeCreated: 1454619064
licenseType: Free
DefaultImporter:
ShaderImporter:
defaultTextures: []
userData:
assetBundleName:
assetBundleVariant:
No preview for this file type
File added
fileFormatVersion: 2
guid: 739cac77f5ce9a540bfb250448cc5554
folderAsset: yes
timeCreated: 1454465229
guid: 6041cfc716306774d995f090bb574d58
timeCreated: 1454619350
licenseType: Free
DefaultImporter:
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 4b3818b4bb4ea2d4a8dbb7c6c290dfad
folderAsset: yes
timeCreated: 1454465229
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 9764338fccaaffc47bb233946af14b7f
folderAsset: yes
timeCreated: 1454465230
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: c623f439f49b2474ebe2c85b312587ac
folderAsset: yes
timeCreated: 1454465230
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: c2d7fe69ad137354fa5180904757ccb7
folderAsset: yes
timeCreated: 1454465230
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 2a01b677ccb3d7a4ab321f4632002f66
guid: e73d15018264fec4a87027af8a728e19
folderAsset: yes
timeCreated: 1454539362
timeCreated: 1454618936
licenseType: Free
DefaultImporter:
userData:
......
Assets/WhiteHex.png

68 KiB

fileFormatVersion: 2
guid: c6190aa43c897dd43bd195c9c450a0c6
timeCreated: 1454619256
licenseType: Free
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: .25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 8
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: .5, y: .5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment