|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Fur shader on Wiki doesnt work
#45568
05/11/05 21:35
05/11/05 21:35
|
Joined: Jan 2003
Posts: 798 New Zealand
Bright
OP
User
|
OP
User
Joined: Jan 2003
Posts: 798
New Zealand
|
Hey guys, Ive been trying to get a fur shader from the 3DGS Wiki working but it doesnt seem to want to  . Does anyone have a proper working fur shader script? Thanks,
KAIN - Coming soon...
|
|
|
Re: Fur shader on Wiki doesnt work
[Re: Bright]
#45571
05/12/05 09:43
05/12/05 09:43
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
basically it would look like this: Code:
float4x4 matWorldViewProj;
void mainVS( in float4 position:POSITION, in float4 normal:NORMAL, in float2 texCoord:TEXCOORD0, out float4 pos:POSITION, out float4 nrm:COLOR0, out float2 oT0:TEXCOORD0, uniform float offset ) { position.xyz+=normal.xyz*offset/100; //scale vertexposition in normals direction pos=mul(position,matWorldViewProj); nrm=normal; oT0=texCoord*14; //scale for fur density }
texture mtlSkin1;
sampler noiseMap=sampler_state { texture=(mtlSkin1); };
float4 mainPS( in float4 nrm:COLOR0, in float2 texCoord:TEXCOORD0, uniform float alpha ) : COLOR { float4 noise=tex2D(noiseMap,texCoord); noise.a=alpha*noise.r; return noise; }
technique test1 { pass p0 { VertexShader=compile vs_1_1 mainVS(1); PixelShader=compile ps_1_4 mainPS(1); //you could use another pixelShader here which picks the modelTexture } //fur part: pass p0 { CullMode=0; AlphaBlendEnable=1; BlendOp=1; srcBlend=3; destBlend=7; VertexShader=compile vs_1_1 mainVS(10); PixelShader=compile ps_1_4 mainPS(0.9); } pass p0 { VertexShader=compile vs_1_1 mainVS(11); PixelShader=compile ps_1_4 mainPS(0.8); } pass p0 { VertexShader=compile vs_1_1 mainVS(12); PixelShader=compile ps_1_4 mainPS(0.7); } pass p0 { VertexShader=compile vs_1_1 mainVS(13); PixelShader=compile ps_1_4 mainPS(0.6); } pass p0 { VertexShader=compile vs_1_1 mainVS(14); PixelShader=compile ps_1_4 mainPS(0.5); } pass p0 { VertexShader=compile vs_1_1 mainVS(15); PixelShader=compile ps_1_4 mainPS(0.4); } pass p0 { VertexShader=compile vs_1_1 mainVS(16); PixelShader=compile ps_1_4 mainPS(0.3); } pass p0 { VertexShader=compile vs_1_1 mainVS(17); PixelShader=compile ps_1_4 mainPS(0.2); } pass p0 { VertexShader=compile vs_1_1 mainVS(18); PixelShader=compile ps_1_4 mainPS(0.1); } }
while the number of passes and the given values there depend on your preffered smoothness of the fur. i used a noise texture but you could also set up a texturemap for the furparts btw: someone may know better blendStates for this
|
|
|
Re: Fur shader on Wiki doesnt work
[Re: ello]
#45572
05/16/05 00:38
05/16/05 00:38
|
Joined: Jan 2003
Posts: 798 New Zealand
Bright
OP
User
|
OP
User
Joined: Jan 2003
Posts: 798
New Zealand
|
Wow, works great, is there a way to make the fur more thicker(taller)?
KAIN - Coming soon...
|
|
|
Re: Fur shader on Wiki doesnt work
[Re: Bright]
#45573
05/16/05 03:57
05/16/05 03:57
|
Joined: Jan 2003
Posts: 798 New Zealand
Bright
OP
User
|
OP
User
Joined: Jan 2003
Posts: 798
New Zealand
|
Nevermind, I found it. Ello, your a LEGEND  :D:D Thanks heaps dude this shader works perfectly. But I was wondering, is there a way to make fur appear in the colour of the skin? Like in other fur shaders.
KAIN - Coming soon...
|
|
|
Re: Fur shader on Wiki doesnt work
[Re: Bright]
#45574
05/17/05 07:00
05/17/05 07:00
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
yes, just use the entities basic skin. say you have your texture in entSkin1 then you have to multiply it with the fur-texture (for example entSkin2). pixelshader would then look like: Code:
float4 furPS( in float4 nrm:COLOR0, in float2 texCoord:TEXCOORD0, uniform float alpha ) : COLOR { float4 base=tex2D(basemap,texCoord); //entskin1 sampler float4 fur=tex2D(furmap,texCoord); //entskin2 sampler float4 result=base*fur; result.a=alpha*noise.r; return ; }
thus you can set up the fur structure in the second skin and the coloring from the first skin but still you may need other blendStates
www.earthcontrol.dequoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
|
|
|
Re: Fur shader on Wiki doesnt work
[Re: ello]
#45575
05/28/05 16:01
05/28/05 16:01
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
Senior Expert
|
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
Ello would you please be so kind as to tell me, how to implement this shader? I'm trying to get it to work with a terrain entity, but i get errors telling me mtlSkin1 ; local variables must be numeric AND object literals are not allowed inside functions AND 'noiseMap' local variables must be numeric ... I know i use a messed up combination of the wiki shader and your shader thing, but it gives errors I don't know what to do with .... Code:
bmap bmp_fur=<fur.tga>;
function mtl_fur_init { mtl.skill1=float(0.2); // first_shell_brightness mtl.skill2=float(0.04); // brightness_increment bmap_to_mipmap(mtl.skin1); }
material mtl_fur { event=mtl_fur_init; //skin1=bmp_fur; effect = " float4x4 matWorldViewProj; void mainVS( in float4 position:POSITION, in float4 normal:NORMAL, in float2 texCoord:TEXCOORD0, out float4 pos:POSITION, out float4 nrm:COLOR0, out float2 oT0:TEXCOORD0, uniform float offset ) { position.xyz+=normal.xyz*offset/100; //scale vertexposition in normals direction pos=mul(position,matWorldViewProj); nrm=normal; oT0=texCoord*14; //scale for fur density texture mtlSkin1;
sampler noiseMap=sampler_state { texture=(mtlSkin1); };
float4 mainPS(in float4 nrm:COLOR0,in float2 texCoord:TEXCOORD0, uniform float alpha ) : COLOR { float4 noise=tex2D(noiseMap,texCoord); noise.a=alpha*noise.r; return noise; }
technique test1 { pass p0 { VertexShader=compile vs_1_1 mainVS(1); PixelShader=compile ps_1_4 mainPS(1); //you could use another pixelShader here which picks the modelTexture } //fur part: pass p0 { CullMode=0; AlphaBlendEnable=1; BlendOp=1; srcBlend=3; destBlend=7; VertexShader=compile vs_1_1 mainVS(10); PixelShader=compile ps_1_4 mainPS(0.9); } pass p0 { VertexShader=compile vs_1_1 mainVS(11); PixelShader=compile ps_1_4 mainPS(0.8); } pass p0 { VertexShader=compile vs_1_1 mainVS(12); PixelShader=compile ps_1_4 mainPS(0.7); } pass p0 { VertexShader=compile vs_1_1 mainVS(13); PixelShader=compile ps_1_4 mainPS(0.6); } pass p0 { VertexShader=compile vs_1_1 mainVS(14); PixelShader=compile ps_1_4 mainPS(0.5); } pass p0 { VertexShader=compile vs_1_1 mainVS(15); PixelShader=compile ps_1_4 mainPS(0.4); } pass p0 { VertexShader=compile vs_1_1 mainVS(16); PixelShader=compile ps_1_4 mainPS(0.3); } pass p0 { VertexShader=compile vs_1_1 mainVS(17); PixelShader=compile ps_1_4 mainPS(0.2); } pass p0 { VertexShader=compile vs_1_1 mainVS(18); PixelShader=compile ps_1_4 mainPS(0.1); } } "; }
action fur { my.skill41=float(0.16); // shell_distance my.skill43=float(12); // fur_u_scale my.skill44=float(12); // fur_v_scale my.material=mtl_fur; }
|
|
|
|