06-23-2017, 10:18 PM
(06-23-2017, 10:13 PM)abenedik Wrote: It is hard to give a good timeline for better support for Techniques and Passes. This will probably come to the Ab3d.DXEngine version 2.3 (the next version 2.2 is already feature complete and will be released with next version of Ab3d.PowerToys - within one month time). This version will be probably released before end of this year.
To add support for multiple passes, you need to create your own Effect (derive your class from Effect class) and then all implement IMultiPassEffect interface. This interface is very simple - it defined 2 methods:
Code:/// <summary>
/// Gets number of passes required to render this effect.
/// </summary>
/// <param name="lights">list of lights</param>
/// <param name="renderingContext">RenderingContext</param>
int GetRequiredRenderingPassesCount(IList<ILight> lights, RenderingContext renderingContext);
/// <summary>
/// Sets the constant buffers and prepares all the shader states for rendering the specified rendering pass. Before this method is called the OnApplyPerFrameSettings method must be called to set other frame settings.
/// </summary>
/// <param name="renderingPassIndex">zero based rendering pass index</param>
/// <param name="renderingContext">RenderingContext</param>
void ApplyRenderingPass(int renderingPassIndex, RenderingContext renderingContext);
With the first method you tell the DXEngine how many rendering passes this effect required.
The second method is called before DXEngine will call DrawCall to render an object with your effect. It will be called in a loop for each pass and in each iteration renderingPassIndex to the method.
I would advice that you start with a simple custom material and custom effect with one pass - use CustomShaderMaterialSample sample in Customizations folder in the main DXEngine samples project as a template. After you will have a working version of that, add IMultiPassEffect interface to your Effects class. Implement both methods and put breakpoint into the second method to see were in the rendering process you are (you can also put breakpoint into the OnApplyPerFrameSettings and ApplyMaterial methods).
In the future I also plan to provide a sample on how to do that, but currently I do not have time to do that because of vacations.
That sounds great...I will give that a shot. I already have a custom effect anyways.

