Skip to content

Commit

Permalink
Add a 3D antialiasing demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Calinou committed Jun 14, 2022
1 parent ae57eb2 commit 462a76d
Show file tree
Hide file tree
Showing 38 changed files with 2,038 additions and 0 deletions.
41 changes: 41 additions & 0 deletions 3d/antialiasing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# 3D Anti-Aliasing

This project showcases the various 3D antialiasing techniques supported by Godot.

- **Multisample antialiasing (MSAA):** High quality, high performance cost.
Does not blur the image.
- Does not affect shader-induced aliasing (such as specular aliasing) or alpha
scissor materials, so these will remain aliased.
- **Fast approximate antialiasing (FXAA):** Medium quality, low performance cost.
Slightly blurs the image.
- **Temporal antialiasing (TAA):** High-quality, low performance cost. Slightly
blurs the image (but less so than FXAA).
- Antialiasing quality is worse on fast-moving objects than other methods,
especially at lower framerates since the TAA won't have enough time to
converge on those objects.
- Can introduce ghosting artifacts on moving objects, especially if motion
vectors are not correctly generated from a given material shader.
- **Supersampling (SSAA):** The highest-quality technique, but also the most
expensive. Does not blur the image.
- 200% resolution scale is equivalent to 4× SSAA, as each dimension is
doubled. For example, if running in a 1920×1080 window at 200% render scale,
the 3D framebuffer will be 3840×2160.
- SSAA can be used together with FXAA or TAA to counter the blurring added by
those algorithms, while further improving antialiasing quality.

Godot allows using multiple antialiasing techniques at the same time. This can
be useful to obtain the best possible quality, or to find a better performance
tradeoff.

Language: GDScript

Renderer: Vulkan Clustered

## Screenshots

![Screenshot](screenshots/3d_anti_aliasing.png)

## Licenses

Files in the `polyhaven/` folder are downloaded from <https://polyhaven.com/a/dutch_ship_medium>
and are licensed under CC0 1.0 Universal.
7 changes: 7 additions & 0 deletions 3d/antialiasing/checker.LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# License for `checker.png`

Copyright (c) 2020 Kenney

Licensed under CC0 1.0 Universal.

Downloaded from https://kenney.nl/assets/prototype-textures
Binary file added 3d/antialiasing/checker.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions 3d/antialiasing/checker.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://chjqieyps5n5r"
path.s3tc="res://.godot/imported/checker.png-6bb199bedbd039461e4248c1d0b9691d.s3tc.ctex"
path.etc2="res://.godot/imported/checker.png-6bb199bedbd039461e4248c1d0b9691d.etc2.ctex"
metadata={
"imported_formats": ["s3tc", "etc2"],
"vram_texture": true
}

[deps]

source_file="res://checker.png"
dest_files=["res://.godot/imported/checker.png-6bb199bedbd039461e4248c1d0b9691d.s3tc.ctex", "res://.godot/imported/checker.png-6bb199bedbd039461e4248c1d0b9691d.etc2.ctex"]

[params]

compress/mode=2
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/size_limit=0
detect_3d/compress_to=0
7 changes: 7 additions & 0 deletions 3d/antialiasing/default_env.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]

[sub_resource type="Sky" id=1]

[resource]
background_mode = 2
sky = SubResource( 1 )
Binary file added 3d/antialiasing/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions 3d/antialiasing/icon.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://8c1xtc7yj6s5"
path.s3tc="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.s3tc.ctex"
path.etc2="res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.etc2.ctex"
metadata={
"imported_formats": ["s3tc", "etc2"],
"vram_texture": true
}

[deps]

source_file="res://icon.png"
dest_files=["res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.s3tc.ctex", "res://.godot/imported/icon.png-487276ed1e3a0c39cad0279d744ee560.etc2.ctex"]

[params]

compress/mode=2
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
7 changes: 7 additions & 0 deletions 3d/antialiasing/paint.LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# License for `paint.png` and `paint_normal.png`

Copyright (c) 2010 johndn

Licensed under CC BY 3.0 Unported.

Downloaded from https://opengameart.org/content/splatter-pack
Binary file added 3d/antialiasing/paint.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions 3d/antialiasing/paint.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://ccgkupemr6e1q"
path="res://.godot/imported/paint.png-26dd29729d733230544ae1ff468a1f09.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://paint.png"
dest_files=["res://.godot/imported/paint.png-26dd29729d733230544ae1ff468a1f09.ctex"]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added 3d/antialiasing/paint_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions 3d/antialiasing/paint_normal.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://bm6eht0bqttpo"
path="res://.godot/imported/paint_normal.png-19220cbebecc985555347664ad1f1180.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://paint_normal.png"
dest_files=["res://.godot/imported/paint_normal.png-19220cbebecc985555347664ad1f1180.ctex"]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added 3d/antialiasing/polyhaven/dutch_ship_medium.bin
Binary file not shown.
Loading

0 comments on commit 462a76d

Please sign in to comment.