Difference between revisions of "Hardware 3D (C++ DirectX Graphics) Tutorial 42"

From Chilipedia
Jump to: navigation, search
(Topics Covered)
Line 5: Line 5:
 
* Object scaling stencil buffer outline effect
 
* Object scaling stencil buffer outline effect
 
* Multi-pass rendering
 
* 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 <code>bool</code> flag called <code>outlining</code> that is set to true in <code>DrawOutline</code> before binding the bindables, and then reset to false again ([https://github.com/planetchili/hw3d/blob/689910b245de53d2ad8e4fef90380a58030f2476/hw3d/TestCube.h#L16-L22 code]). As usual, the constant buffer for the geometry transformation is managed by a <code>TransformCBuf</code> (to be specific a <code>TransformCBufDoubleBoi</code>) object which calls <code>GetTransformXM</code> on the <code>Drawable</code> parent. The key that enables the scaling up is that in <code>TestCube</code>, we modify <code>GetTransformXM</code> to check the <code>outlining</code> flag, and if it is set, we add a transformation matrix that scales up by a small percent ([https://github.com/planetchili/hw3d/blob/689910b245de53d2ad8e4fef90380a58030f2476/hw3d/TestCube.cpp#L74-L77 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).
  
 
== Video Timestamp Index ==
 
== Video Timestamp Index ==

Revision as of 16:37, 29 December 2019

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).

Video Timestamp Index

Source Code

See also