Graphics Reference
In-Depth Information
void PS_SurfaceUpdate (
in float4 gammaPos : SV_Position , // atlas pos of gammaton
in float4 gammaMat : MATERIAL , // material of gammaton
out float4 newMat : SV_Target0 ) // new surface material
{ // get current and initial material on surface
float4 curMat = g_TexMatCur . Load ( gammaPos );
float4 orgMat = g_TexMatOrg . Load ( gammaPos );
// calculate transfer rates and update material
newMat = curMat transferRate ( curMat , gammaMat );
newMat = max ( orgMat , newMat ); // clamp
}
Listing 3.6. Gammatons are expanded to quads in a geometry shader and are splatted
into the atlas. This pixel shader removes material from the surface. Here, four material
slots are updated at once.
dering pipeline as point list. In a geometry shader the material to transfer is
calculated again and is added to the gammatons. Additionally, we chose this
shader to handle collisions, i.e., to compute new bounce and float directions for
the gammatons. Doing this in OptiX is possible as well. The respective geometry
shader is outlined in Listing 3.7. We decided to keep inactive gammatons in the
stream, as it eases launching of new gammatons.
3.3.4 Aging Rules
Aside from the transport of material by gammatons, the actual aging process is
the other key aspect of our system. The idea is to model the temporal aging
phenomena that take place if certain materials co-occur, by a set of generic rules.
In our system, rules are implementations of a shader interface that alter a material
set. In the simulation, we assign the chosen rule permutation by dynamic shader
linkage . This concept is an advance from uber-shaders, for which registers are
always allocated for the worst case branch, and sets of specialized shader files,
which are hard to maintain due to their combinatorial growth. Dynamic shader
linkage draws a profit from inlining selected functions (e.g., chosen rules) at bind
time, thus enabling an optimal register allocation, while providing object-oriented
aspects for the definition of rules. We chose to apply the rules to every material
atlas texel by rendering a fullscreen quad, i.e., by using a pixel shader. The
parameters of the rules are again stored in presets and are fetched at runtime
from a single constant buffer. The interface, a sample implementation and the
respective pixel shader are outlined in Listing 3.8. Practice showed that for many
involved processes plausible approximations can be found by means of simple
rules, as described next.
Search WWH ::




Custom Search