5.2. Effects for particular shapes

There are various places where an Effect node may be used. To apply an effect on a given shape, it can be placed on the new Appearance.effects list:

Appearance

MFNode [] effects [] # Effect

All the effects on this list (with suitable language) will be used. This allows authors to define a library of independent shader effects and then trivially pick desired effects for each particular shape. Simply placing two effects on the Appearance.effects list makes them cooperate correctly.

Figure 5.1. Toon and Fresnel effects combined

Toon and Fresnel effects combined

Note that all introduced nodes benefit from X3D mechanism to reuse the nodes by reference (the DEF and USE keywords). Reusing the Effect nodes is most natural and allows to combine existing effects in any desired way. Reusing the EffectPart nodes is also useful, when some effects would like to share a particular piece of code. For example, the same EffectPart node, with a library of useful shading language functions, may be used for many effects.