Norrin
August 13, 2014, 8:20pm
1
Im really hoping someone can help me with this.
Im trying to customize how two textures should blend. What I want is a sharp nonuniform outline on the edge of a texture. (Illustrated with the red line below) How can I do this?
Right now im testing on a model, but is it possible to customize the unity terrain shaders to work like this?
Update
Rust has sort of done this here:
Rust texture blending
But since i want to blend together two solid colors, it should be easier.
ToonTerrain.cginc
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
// Edits by Glynn Taylor. MIT license
// Includes code for splitmap by https://twitter.com/adamgryu and triplanar mapping by https://github.com/keijiro. MIT License
#ifndef TERRAIN_SPLATMAP_COMMON_CGINC_INCLUDED
#define TERRAIN_SPLATMAP_COMMON_CGINC_INCLUDED
struct Input
{
float3 localNormal : TEXCOORD0;
This file has been truncated. show original
ToonTerrain_Add.shader
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
// Edits by Glynn Taylor. MIT license
// Includes code for splitmap by https://twitter.com/adamgryu and triplanar mapping by https://github.com/keijiro. MIT License
Shader "Hidden/ToonTerrainAdd" {
Properties {
[HideInInspector] _Control ("Control (RGBA)", 2D) = "black" {}
[HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
[HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {}
[HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {}
This file has been truncated. show original
ToonTerrain_First.shader
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
// Edits by Glynn Taylor. MIT license
// Includes code for splitmap by https://twitter.com/adamgryu and triplanar mapping by https://github.com/keijiro. MIT License
Shader "ToonTerrain" {
Properties {
[HideInInspector] _Control ("Control (RGBA)", 2D) = "red" {}
[HideInInspector] _Splat3 ("Layer 3 (A)", 2D) = "white" {}
[HideInInspector] _Splat2 ("Layer 2 (B)", 2D) = "white" {}
[HideInInspector] _Splat1 ("Layer 1 (G)", 2D) = "white" {}
This file has been truncated. show original
In ToonTerrain.cginc line 44 Splitmap function, change value 0.1 to 0.4 for outline effect.