Grass/Fur example

Software: Away3D 4.x

inSertCodE, Sr. Member
Posted: 16 November 2011 06:35 PM   Total Posts: 105

Hi. I’ve been looking for a while now and I can’t find any grass/fur example code. Is there any out there?

What would be the least GPU consuming way to do it?

Anyone can share some code tips on how is this done
http://www.geepers.co.uk/media/flash/software/FurExample1.swf
?

   

Avatar
Greg Caldwell (Greg209), Administrator
Posted: 16 November 2011 10:41 PM   Total Posts: 45   [ # 1 ]

Hi

I do mean to get the source out for the fur demo on that link, but I just haven’t got around to it yet. Sorry.

The fur example was based on the information found here, which explains the process very well :-

http://www.xbdev.net/directx3dx/specialX/Fur/index.php

Hopefully I will get around to publishing the code and blogging a bit more about it soon. Watch this space.

Greg

 

 Signature 

Home page : http://www.geepers.co.uk
Mobile apps : Sum It All Up

   

inSertCodE, Sr. Member
Posted: 16 November 2011 11:42 PM   Total Posts: 105   [ # 2 ]

Thanks for taking the time to reply Greg. I’m looking forward to you’re tutorial.
In the meantime I would like to try and make a fur class of my own.
I just need few tips to clear things out and see if I got the process right…
The basic idea is to create couple of lairs of parallel surfaces to each surface that needs fur. Each lair is alpha-blended to show only the fur pixels and they build up in each lair.
Am I on the right track?

If yes I got some additional questions…
How do you avoid the visual gap between the lairs, by adding more lairs and making them more dense right?

I have another issue… The map that I wanna build should be around 150x150 squares - around 45.000 poly. As I see from the example you refereed above you need at least 6 lairs to make it graphically appealing. That would mean that I would need little less than 250.000 polys (not all surface will be grass) just for terrain. With that in mind my estimate is that a single map would have 600k to 900k polys with everything in it. Normally not everything would be rendered at once but, would that run at good fps on machines with weaker grap.cards - which support DirectX but are not so strong, and all that is put in a web browser?

I haven’t done much stress tests on such computers so am only asking this as an estimate from your experience. I wouldn’t want to spend many programing hours just to find out that it will choke down most of the PCs smile

 

   

Avatar
Greg Caldwell (Greg209), Administrator
Posted: 17 November 2011 10:56 AM   Total Posts: 45   [ # 3 ]

Yes, you’re on the right track smile So yes, multiple layers of the mesh, each with a reducing alpha value, the further it is from the base mesh, to fake the appearance of each pixel ending in a sharp tip.

The other thing to note is the texture(s) being used. In the demo, there is a fur texture that defines where the blades of grass are - this is tiled and repeated (check the Grass Scale slider). The other textures (top an bottom) provide the colour across the blade. In the demo, the fur texture not only provides the location of the grass blades but also the blades length - this is an alpha value combined with the layer alpha value. Then of course there is the height map which is also combined - so you can cut the grass.

In the grass demo, there are somewhere 50 layers (if memory serves me well - which it doesn’t that often), so the problem is that you will increase the number of polys quite quickly.

I’ve noticed some performance issues with this process and at the moment I’ve not found a solution. The transparent nature of the meshes affects performance. The texture scaling (unfortunately) affects performance and obviously the size rendered size of the object affects performance.

I’ve got a more recent version in the wings which is implemented better but unforuntately doesn’t yeild much (if any) additional performance but does allow you to change the numebr of layers dynamically. I really must find time to get onto it.

To help performance it might be an interesting experiment to only use the grass on suitably close squares.

Hope that helps somewhat.

 

 Signature 

Home page : http://www.geepers.co.uk
Mobile apps : Sum It All Up

   

Avatar
kurono, Sr. Member
Posted: 09 December 2011 07:49 AM   Total Posts: 103   [ # 4 ]

What’s about sources of FurBulder and FurMethod, Greg? It would be very-very helpful. Could you share it, please?

 

   

Avatar
SasMaster, Sr. Member
Posted: 13 December 2011 03:24 PM   Total Posts: 127   [ # 5 ]

I can give you my fur/grass demo source code but it is done using Flare3D shading language.Besides you should know that it has a heavy impact on GPU and CPU .I suppose Greg doesn’t share it for this very reason.AS3 just can’t handle any 3d stuff that a normal C++ opengl app can run easily.

 

 Signature 

This looks like a job for superman
http://blog.alladvanced.net

   

Avatar
Greg Caldwell (Greg209), Administrator
Posted: 13 December 2011 03:48 PM   Total Posts: 45   [ # 6 ]

Hey guys,

I promise I will get around to getting the sources out, I’ve just been very busy on non-3D related stuff for a good while and not had the chance to get it more fit-for-purpose and yes, it’s a performance hog.

I was trying different methods to improve performance but they ended up just being slightly better implementations with little performance gain :(

Anyway, they will be out, it’s just a question of when.

Greg

 

 Signature 

Home page : http://www.geepers.co.uk
Mobile apps : Sum It All Up

   

John Brookes, Moderator
Posted: 13 December 2011 07:20 PM   Total Posts: 732   [ # 7 ]

No Idea if this is anything like that other thing (never seen it, just blank)

Random messimg about with an old Papervison thang Ben Hopkins did.
Just grab a fur texture and change the embed path.

looks like
http://www.shrewballooba.co.uk/Fluffy/

src
http://www.shrewballooba.co.uk/Fluffy/Fluffy.as

 

   

Avatar
kurono, Sr. Member
Posted: 16 December 2011 04:33 PM   Total Posts: 103   [ # 8 ]

Yes, the idea is simple. I even have improved a “furball” example (adapted previously for Away3DLite) to simulate wind waves by displacement of layers according to height-coordinate. But it’s “brute-force” approach.

But Gregs code is much more advanced and can be applied for any kind of surface. It isn’t so obvious because of using pure AGAL.

 

File Attachments
MainPlane.as  (File Size: 7KB - Downloads: 262)
   

Avatar
kurono, Sr. Member
Posted: 04 February 2012 04:21 PM   Total Posts: 103   [ # 9 ]

So… A lot of time has left. Are any updates or demos for FurMethod? We’re looking forward to your brilliant shader, Greg smile

 

   

Avatar
kurono, Sr. Member
Posted: 28 April 2012 10:31 AM   Total Posts: 103   [ # 10 ]

At last I’ve made my own shader smile

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X