Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 3 1 2 3
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 Offline OP
User
Bright  Offline 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] #45569
05/11/05 22:34
05/11/05 22:34
Joined: Nov 2003
Posts: 1,380
Switzerland; Zurich
S
Sebe Offline
Serious User
Sebe  Offline
Serious User
S

Joined: Nov 2003
Posts: 1,380
Switzerland; Zurich
I suppose it's an old DX8 shader, not? This would explain why it doesn't work.

Re: Fur shader on Wiki doesnt work [Re: Sebe] #45570
05/12/05 00:11
05/12/05 00:11
Joined: Jan 2003
Posts: 798
New Zealand
Bright Offline OP
User
Bright  Offline OP
User

Joined: Jan 2003
Posts: 798
New Zealand
Can someone recommend me a Fur shader. If so that would be sweet


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 Offline
Senior Expert
ello  Offline
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 Offline OP
User
Bright  Offline 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 Offline OP
User
Bright  Offline 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 Offline
Senior Expert
ello  Offline
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.de
quoted: 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 Offline
Senior Expert
PHeMoX  Offline
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;
}




PHeMoX, Innervision Software (c) 1995-2008

For more info visit: Innervision Software
Re: Fur shader on Wiki doesnt work [Re: PHeMoX] #45576
06/03/05 21:02
06/03/05 21:02
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline
Expert
Rhuarc  Offline
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
First thing I notice is that there is a missing '}' at the end of mainVS. This could be the cause for all the other errors in itself (the "texture mtlSkin1" is inside of mainVS because of the missing bracket, thus the mtlskin error.... etc).

-Rhuarc


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Fur shader on Wiki doesnt work [Re: Rhuarc] #45577
06/05/05 14:05
06/05/05 14:05
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
additional to what rhuarc told you, you could try to use it in a external .fx-file.

i dont know if it wasa only a temporaly bug, but long shaders dont work if they are embeded directly into the wdl


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Page 1 of 3 1 2 3

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1