|
2 registered members (TipmyPip, Martin_HH),
2,946
guests, and 2
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
question: fur shader for terrain
#415844
01/24/13 16:11
01/24/13 16:11
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
OP
Expert
|
OP
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
hi I just got an idea to apply a fur shader (from the wiki) to a terrain to imitate grass, but unfortunately the result is really ugly. at terrain chunks there are artifacts, and the fur is also good only from a far distance. and seems to be performance eater for large objects. is it a bad idea, or can it be used somehow for this purpose? shader experts welcome 
|
|
|
Re: question: fur shader for terrain
[Re: lostclimate]
#415853
01/24/13 17:30
01/24/13 17:30
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
i just experimented with something like fur shader: 
int iRepeat;
Texture entSkin1;
float4x4 matWorldViewProj;
sampler smpTex = sampler_state
{
Texture = <entSkin1>;
};
struct VS_OUT
{
float4 pos : POSITION;
float2 tex : TEXCOORD0;
};
VS_OUT vs(
float4 inPos : POSITION,
float2 inTex : TEXCOORD0)
{
VS_OUT vsOut;
vsOut.pos = mul(inPos + float4(0, 0.7 * iRepeat, 0, 0), matWorldViewProj);
if(iRepeat == 0)
vsOut.tex = inTex;
else
vsOut.tex = 4 * inTex;
return vsOut;
}
float4 ps(VS_OUT vsOut) : COLOR0
{
float4 color = tex2D(smpTex, vsOut.tex);
clip(color.a - 0.2 - 0.05 * iRepeat);
return color;
}
technique
{
pass ground_repeat11
{
VertexShader = compile vs_2_0 vs();
PixelShader = compile ps_2_0 ps();
}
}
|
|
|
Re: question: fur shader for terrain
[Re: sivan]
#415868
01/25/13 00:17
01/25/13 00:17
|
Joined: Nov 2007
Posts: 2,568 Germany, BW, Stuttgart
MasterQ32
Expert
|
Expert
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
|
yeah was just a quick approach within 5 minutes or so had something in mind with the _repeat passes and wanted to try it last year i also tried some completely different idea: mesh merging This was the result:  Those different colored grass spots are shader faults because i din't got the normal merging right. but the grass itself looks a little bit more alive than before. maybe i can combine shader supported gras animation with mesh merging here is the same thing with a different grass model: 
|
|
|
Re: question: fur shader for terrain
[Re: MasterQ32]
#415881
01/25/13 08:09
01/25/13 08:09
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
OP
Expert
|
OP
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
nice results, but you have very different fps values in the 2 cases. the ugly is fast, the nice is very slow.
when I use grass models having about 32 tris, and clipping most of them at lod0/1 border, and some others at lod1/2, and setting lod distances to short, I can get an acceptable fps result e.g. in a 3rd person camera scene.
but this simplistic solution is not okay when I have some hundreds of units moving around having some AI, and a free RTS camera, this is why I thought of using a fur-like shader could be faster.
|
|
|
Re: question: fur shader for terrain
[Re: sivan]
#415886
01/25/13 08:42
01/25/13 08:42
|
Joined: Apr 2008
Posts: 2,488
ratchet
Expert
|
Expert
Joined: Apr 2008
Posts: 2,488
|
I prefer high FPS than slow even with crap grass You should put some adjustable Visibilty distance like games here you can adjust that. Depending on PC the user can switch on/off than change radius visibility. but this simplistic solution is not okay when I have some hundreds of units moving around having some AI, and a free RTS camera, this is why I thought of using a fur-like shader could be faster.I would say, avoid grass, and pu only a grass texture on floor and some bunches of grass here and here (by bunch i mean a single model containing lot of grass patches). You don't use some engine as optimized by veterans coders as this AAA game, so why are you pushing the engine so far lol  ?
Last edited by ratchet; 01/25/13 08:43.
|
|
|
Re: question: fur shader for terrain
[Re: lostclimate]
#415918
01/25/13 15:45
01/25/13 15:45
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
I just stumbled upon this screenshot in this thread:  So... yes, using a customized fur-shader for grass works pretty good. But I think it needs some time to create such a shader  (and I think it's everything else than efficient)
Last edited by Kartoffel; 01/25/13 15:49.
POTATO-MAN saves the day! - Random
|
|
|
|