Gamestudio Links
Zorro Links
Newest Posts
Max Number of Strategies in /Strategy folder
by Martin_HH. 06/16/26 11:13
Z9 getting Error 058
by jcl. 06/16/26 09:51
How to select between IB accounts by script?
by AndrewAMD. 06/13/26 15:44
Zorro tutorial ideas?
by AndrewAMD. 06/13/26 15:01
Zorro 3.01 recoded MMI function issue
by 11honza11. 06/13/26 11:40
Stooq now requires an API key
by AndrewAMD. 06/11/26 17:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
0 registered members (), 2,804 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Student_64151, Koti, curry, DeepxKalsi, Samed
19219 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
question: fur shader for terrain #415844
01/24/13 16:11
01/24/13 16:11
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline OP
Expert
sivan  Offline 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 laugh


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: question: fur shader for terrain [Re: sivan] #415848
01/24/13 16:55
01/24/13 16:55
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
well, from my understanding the issue is whats called over draw. say you apply it to an object that takes 50% of the screen... that means 50% of the screen will be rerendered and blended for each "shell" of the fur. not sure if your aware how the shader works but what it does is extrude the polygons and makes the extruded layers use the alpha map to create grass for each pixel by stacking visible pixels on top of eachother. I had an idea a while ago to make less extrusions by taking the bottom shell and making the distance its extruding slightly random so that it tilts the polygons a little more making the pixels of the "hairmap" not so parrallel to the original surface.

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 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
i just experimented with something like fur shader:


Code:
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();
	}
}



Visit my site: www.masterq32.de
Re: question: fur shader for terrain [Re: MasterQ32] #415863
01/24/13 21:56
01/24/13 21:56
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline OP
Expert
sivan  Offline OP
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
thanks for the explanation, I had a rough idea how it works. maybe only a close section of the terrain should be processed, using something like a depth shader in pssm shadows.
MQ32, I will check what it is, I see its operation depends on the number of skins and their alpha...


Free world editor for 3D Gamestudio: MapBuilder Editor
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 Offline
Expert
MasterQ32  Offline
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:


Visit my site: www.masterq32.de
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 Offline OP
Expert
sivan  Offline 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.


Free world editor for 3D Gamestudio: MapBuilder Editor
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 Offline
Expert
ratchet  Offline
Expert

Joined: Apr 2008
Posts: 2,488
I prefer high FPS than slow even with crap grass laugh
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 laugh ?

Last edited by ratchet; 01/25/13 08:43.
Re: question: fur shader for terrain [Re: ratchet] #415917
01/25/13 15:22
01/25/13 15:22
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
@ratchet. seriously dude. acknex is not a crap engine. just because you have to implement High end features on your own does not mean its that difficult. the Masterq32's first scene has fine grass and at the distance of sivans game you probably wouldnt even need a density that high.

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 Offline
Expert
Kartoffel  Offline
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 smirk
(and I think it's everything else than efficient)

Last edited by Kartoffel; 01/25/13 15:49.

POTATO-MAN saves the day! - Random
Re: question: fur shader for terrain [Re: Kartoffel] #415919
01/25/13 15:48
01/25/13 15:48
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
I've done some improvements, but without shaders i think i hit the limit...


Visit my site: www.masterq32.de
Page 1 of 2 1 2

Moderated by  Blink, Hummel, Superku 

Gamestudio download | 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