Reply
Reply
 
Thread Tools Display Modes
MikeF's Avatar
Old (#1)
So i'm doing some work that would really take advantage of this fur shader http://unifycommunity.com/wiki/index...le=Fur_(Unity3)

rite now the alpha controls where the fur emits from the mesh, but on masked areas it just turns black instead of transparent, which is what i need.

i'm not very well versed in unity's shader language so i'm not sure if this is possible, but any suggestions would be most appreciated
Portfolio -- www.mikefortais.net --
Offline , polycounter, 1,190 Posts, Join Date Nov 2004, Location Toronto, Ontario  
   Reply With Quote

MikeF's Avatar
Old (#2)
and heres the shader incase you dont care to download it


Shader "Fur"
{
Properties
{
_FurLength ("Fur Length", Range (.0002, 1)) = .25
_MainTex ("Base (RGB)", 2D) = "white" { }
_Cutoff ("Alpha Cutoff", Range (0, 1)) = .0001
_EdgeFade ("Edge Fade", Range(0,1)) = 0.4
_LightDirection0 ("Light Direction 0, Ambient", Vector) = (1,0,0,1)
_MyLightColor0 ("Light Color 0", Color) = (1,1,1,1)
_LightDirection1 ("Light Direction 1, Ambient", Vector) = (1,0,0,1)
_MyLightColor1 ("Light Color 1", Color) = (1,1,1,1)
}
Category
{
ZWrite Off
Tags {"Queue" = "Transparent"}
Blend SrcAlpha OneMinusSrcAlpha
Alphatest Greater [_Cutoff]
SubShader
{



Pass
{
ZWrite On


CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
constantColor(1,1,1,1)
combine texture * primary double, constant
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.05, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.1, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.15, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.2, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.25, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.3, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.35, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.4, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.45, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.5, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.55, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.60, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.65, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.70, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.75, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.8, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.85, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.9, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
Pass
{
CGPROGRAM
// Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
#pragma exclude_renderers gles
#pragma vertex VertexProgram
#include "FurHelpers.cginc"

v2f VertexProgram (appdata_base v)
{
v2f o;
FurVertexPass(0.95, v, _FurLength, o.pos, o.fog, o.color, o.uv);
return o;
}
ENDCG
SetTexture [_MainTex]
{
combine texture * primary double, texture * primary
}
}
}
Fallback " VertexLit", 1
}
}
Portfolio -- www.mikefortais.net --
Offline , polycounter, 1,190 Posts, Join Date Nov 2004, Location Toronto, Ontario  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch