Not logged in, Join Here! or Log In Below:  
 
News Articles Search    
 


Submitted by Nicolas Weber, posted on January 18, 2005




Image Description, by Nicolas Weber



This is a screenshot of a little program I wrote a while back to test the shell method to render fur/grass. You can set various parameters at runtime (number of shells, fur density and fur length) and there are two different models to look at.

You can download the program along with complete sourcecode from http://www.amnoid.de/iotdfur.zip.

Note that this IOTD was only posted to keep the IOTD queue full. Instead of commenting this IOTD, comment this one: http://www.flipcode.com/cgi-bin/fcarticles.cgi?show=63738 (I posted it before IOTD feedback was implemented). The latter is way more important to me :-)


[prev]
Image of the Day Gallery
www.flipcode.com

[next]

 
Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
 
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
 
Rui Martins

January 19, 2005, 03:29 AM

Can you give some extra info on what is the shell method and how you are using it?
Thanks.

 
Nico

January 19, 2005, 04:10 AM

Sure. The grass texture stores the height of each texel in its alpha channel. Now, to render a "grassy" triangle, you do something like:

glEnable(GL_ALPHA_TEST);
for(i = 0; i < n; ++i)
{
glAlphaFunc(GL_LESS, i/n);
displaceTriangleAlongNormal();
drawTexturedTriangle();
}

That is, you draw the triangle number-of-fur-layers times, each time slightly displaced and with a higher alpha test reference value, so each time more of the texture is alpha-tested away. For a 'real' model, you do this for all of its triangles. Each of the triangle layers is called a "shell". The displacement is done in a vertex shader, fur-height determines the inter-shell distance.

The idea is from Lengyel's "Real time fur" paper, but with a single texture with an alpha channel instead of the volumetric textures they use:
http://www.cs.princeton.edu/gfx/pubs/Lengyel_2001_RFO/index.php
I didn't implement the fins, though.

Nico

 
Rui Martins

January 19, 2005, 10:39 AM

Nice Trick !

Did you try to use vertex normals, instead of the poly normal, so that the poly either grows or shrinks according to the normals and the Layer being drawn ?

|_____/
A representation of a face with the edge normals

Layers of poly (fur) resized according to vertex normals
|
_________
________
_______
______
Base Poly

The ideia is to form a truncated (eventually skewed, depends on normals) pyramid with the several layers. Like projecting each poly edge into each plane layer, using the "average" of both vertex normals (which defined the edge), has a projection direction vector.

This could solve the problem the fins try to solve, at least I think so.
It also allows for fur to seem continuous, even on some sharpe edges, since the normals are shared between adjacent faces (polys).

 
This thread contains 3 messages.
 
 
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.