Hardware 3D (C++ DirectX Graphics) Tutorial 42
Stencil buffer, multi-pass rendering, and outline special effect. Many 1st-time appearances in this video that will open up many avenues of inquiry and advancement.
Topics Covered
- Stencil buffer configuration and usage
- Object scaling stencil buffer outline effect
- Multi-pass rendering
Additional Notes
In the technique explanation chili explains that the model must be scaled up for the outline drawing (masked) pass, but he does not actually show where this is done in the actual code (doh!). Also recall that there is a mysterious bool
flag called outlining
that is set to true
in DrawOutline
before binding the bindables, and then reset to false
again (code). As usual, the constant buffer for the geometry transformation is managed by a TransformCBuf
(to be specific a TransformCBufDoubleBoi
) object which calls GetTransformXM
on the Drawable
parent. The key that enables the scaling up is that in TestCube
, we modify GetTransformXM
to check the outlining
flag, and if it is set, we add a transformation matrix that scales up by a small percent (code). This is a cludgy bit of code, and in the future a cleaner method will be used to control the outline scaling (the pool of bindables for the outline pass will have its own separate TransformCBuf that adds the scaling without the need to set/check dumb flags).