Fur Demo Ported

Luminary
Posts: 5,143
Joined: 2002.04
Post: #1
I've ported the real-time fur demo that was recently in NeHe's news to the Mac. I don't know if I'm allowed to distribute it (there was no license or contact information for the author), so here it is Wink

http://203.79.121.211/~keith/fur10-mac.tar.gz

Note that my box is only on about 16 hours a day, so if you can't get it, try again every few hours, or find out what time it is in New Zealand and figure out if I'm likely to be awake Rasp

Requires Mac OS X to run, possibly Jaguar to compile (compiled version included).

Also possibly of interest to people is the MilkShape3D model-loading code it contains.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
"Fur" those of you who can't be bothered reading the code:

B toggles drawing the polygonal body
F toggles drawing the fins (silhouette outline fur)
S toggles drawing the shells (non-silhouette fur)
P pauses the rotation
R turns off the rotation and returns the model to a fixed position
Quote this message in a reply
Founder
Posts: 1,138
Joined: 2002.04
Post: #3
Let me know if you need us to host it.

cheers and good work

Carlos A. Camacho,
Founder
iDevGames
Quote this message in a reply
henryj
Unregistered
 
Post: #4
This might be a good start for a 'how to make mac opengl code go fast' tutorial. It's already pretty quick, but a quick glance at the code makes me think it could go faster.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
Heh, it's only quick on a GeForce 4Ti Grin

On my 4MX at home it's pretty jerky. Cutting the number of shells in half should help with that of course...
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #6
It's only running at 19fps on my 2x867/256/GF4MX (as opposed to 61fps on a 733/1152/GF4Ti). The OpenGL Profiler reports hardware wait time up at 1G (!). The Fur process as a whole is only taking 12.5% of the CPU time, and the two most expensive calls are flush and some kernel threading routine... looks like a job for lower fill-rate requirements rather than a job for code optimization!
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
Even halving the number of shells only gets me up to 27fps, and the fur looks significantly worse! I'm guessing this is going to remain a high-end technique for a while Wink
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #8
thanks for porting the fur demo to GLUT/Cocoa! Im sure if Classic users want they can port it to Classic GLUT pretty easily. It looks really cool - it'll be interesting to add it to an animated figure.

There might be a way to get some better performance out of fur. I notice that the 'fins' are only really noticeable when they are 'face-on' to the camera - when a fin is 'edge-on' to the camera you only really see a line. When I turn off fins I get a noticeably higher framerate (although I haven't measured it). So if I compute normals for each edge - I could cull drawing any fin where: edgeNormal dot cameraForwardVector isnt 'close' to zero. In other words - only draw the fins that are close to being perpendicular to the camera forward vector.

cheers,
Codemattic
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #9
Interesting that the fins make such a difference. I might measure what they're doing.

NVidia (in their fur demo) fade out the fins based on angle to camera, presumably to zero fairly quickly. I wonder what we'd gain here by doing that Huh

I'm thinking this whole thing needs vertex programming. Would probably simplify the code a bit, too.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #10
OK, without the fins I get 56fps (as opposed to 26 with them; this is with half the number of shells). Now to find out why they're so slow!
Quote this message in a reply
w_reade
Unregistered
 
Post: #11
I reckon it looks better without the fins anyway - the confluences of fins bring the vertices into unwonted prominence, in my opinion. Ahem.

It's very cool, by the way.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #12
If you reduce the number of shells, or enlarge the window (to about 1600x1200), you'll see why you need the fins.

Where the fins contribute most to the image, you're seeing the cross-section of the shells, which means you can see gaps in the hairs. It looks kinda silly Smile
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #13
I just turned on alpha testing, and now I get 42fps (up from the 26) with fins, and 100 without. Heed the wisdom of the OpenGL gurus! Always enable alpha test when you enable blending!

I've put the changed version (half the shells, alpha test) in the same place as the old one. Should just about be bearable on slower machines now...

PS. 1000th post!
Quote this message in a reply
Member
Posts: 164
Joined: 2002.04
Post: #14
Also maybe I'm just confused, but is it drawing each fin twice?

Anyways I'm very interested in this technique since I'm thinking of making a game with animal-ish characters (tho not cute and cartoony Smile )
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #15
I don't know. I haven't looked closely at the code.

It might well be culling back-faces and drawing each fin twice, once each way round. That would make sense.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SDL already ported to Mactel? MarkJ 8 4,655 Jul 1, 2005 10:49 PM
Last Post: ravuya
  OffsetBumpMapping ported arekkusu 7 4,262 Apr 10, 2005 08:14 AM
Last Post: arekkusu