[Verse-dev] question about geometry fragment

Eskil Steenberg verse-dev@blender.org
Sun Aug 15 21:34:31 CEST 2004


Hi

> The geometry fragment allows to define colors for each vertex, corner 
> or face, e.g. if one uses
> glColor3f(r, g, b);
> glVertex3f(x, y, z);
> to draw a model, one creates a geometry fragment that uses geometry 
> layers where r,g,b are stored. Am i right?

Sorry it is a bit more complicated then that.

The parsing of the material node starts at the output fragment and then 
you evaluate along the tree. Each fragment can be evaluated at any point 
on the surface. so a color fragment outputs a plane color, but it doesnt 
have to be used to color an object, it can just as well be used to as 
uv. A good idea is to run Connector to experiment with how the different 
fragments interact.

The shader tree is very easy to implement in software and fairly easy on 
programmable hardware, while making a good evaluation on 
non-programmable hardware is harder.

> (which is named mapping in verse.h, but control in the spec!)

Ah, thank!

> , but how do i set up which layer holds u and which v coordinates?
> Do i set (in the geometry fragment) layer_r to the u-coordinate layer 
> and layer_g to the v-coordinate layer? If it is so, it should be made 
> more clear in the spec...

Yes thats how you do it. But the geometry node is not exclusively used 
for textures thats why it is named r g b and not u v w.

> The fragment is the same for both modes, but the usage seems quite 
> different. So this layout is a bit confusing. Wouldn't it be better to 
> just store two layer names in the texture fragment instead of a 
> geometry fragment id (ok, three names for 3d-textures)?

No because textures are a recursive and can be connected to a lot of 
different fragments to get different effects. The most common one is to 
stick a matrix in between the texture and the geometry to transform the 
the mapping of the texture. If you want to evaluate a texture fragment 
on a point on the surface you take the input color  an use it as look-up 
position in to the texture.

> And, btw, why do we have standard names col_r/col_g/col_b/tex_u/tex_v, 
> when layers are referenced via material names anyway?
>
You dont need to use the standard names but it is recommended because 
some applications can then more easily figure out what the layers contain.

Say you are writing a uv editor (like I am) then it is very useful to be 
able to identify the uv layers form a geometry layer alone.

E



More information about the Verse-dev mailing list