Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 81fd05b

Browse files
committed
Added a paragraph on sample shading.
1 parent 770aa49 commit 81fd05b

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

10_Multisampling.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,29 @@ The difference is more noticable when looking up close at one of the edges:
255255

256256
![](/images/multisampling_comparison2.png)
257257

258+
## Quality improvements
259+
260+
There are certain limitations of our current MSAA implementation which may impact the quality of the output image in more detailed scenes. For example, we're currently not solving potential problems caused by shader aliasing, i.e. MSAA only smoothens out the edges of geometry but not the interior filling. This may lead to a situation when you get a smooth polygon rendered on screen but the applied texture will still look aliased if it contains high contrasting colors. One way to approach this problem is to enable [Sample Shading](https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#primsrast-sampleshading) which will improve the image quality even further, though at an additional performance cost:
261+
262+
```c++
263+
264+
void createLogicalDevice() {
265+
...
266+
deviceFeatures.sampleRateShading = VK_TRUE; // enable sample shading feature for the device
267+
...
268+
}
269+
270+
void createGraphicsPipeline() {
271+
...
272+
multisampling.sampleShadingEnable = VK_TRUE; // enable sample shading in the pipeline
273+
multisampling.minSampleShading = .2f; // min fraction for sample shading; closer to one is smoother
274+
...
275+
}
276+
```
277+
278+
In this example we'll leave sample shading disabled but in certain scenarios the quality improvement may be noticeable:
279+
280+
![](/images/sample_shading.png)
258281

259282
## Conclusion
260283

images/sample_shading.png

22.3 KB
Loading

0 commit comments

Comments
 (0)