This commit is contained in:
Miloslav Ciz 2023-12-17 18:21:35 +01:00
parent 3eaceb1bb7
commit 3461c669cf
5 changed files with 38 additions and 31 deletions

View file

@ -1,6 +1,6 @@
# Bilinear Interpolation # Bilinear Interpolation
Bilinear interpolation (also bilinear filtering) is a simple way of creating a smooth transition ([interpolation](interpolation.md)) between [discrete](discrete.md) samples (values) in 2D, it is a [generalization](generalization.md) of [linear interpolation](lerp.md) to 2 dimensions. It is used in many places, popularly e.g. in 3D [computer graphics](graphics.md) for [texture](texture.md) filtering; bilinear interpolation allows to upscale textures to higher resolutions (i.e. compute new pixels between existing pixels) while keeping their look smooth and "non-blocky" (even though blurry). On the scale of quality vs simplicity it is kind of a middle way between a simpler [nearest neighbour](nearest_neighbour.md) interpolation (which creates the "blocky" look) and more complex [bicubic interpolation](bicubic.md) (which uses yet smoother curves but also requires more samples). Bilinear interpolation can further be generalized to [trilinear interpolation](trilinear.md) (in computer graphics trilinear interpolation is used to also additionally interpolate between different levels of a texture's [mipamap](mipamp.md)) and perhaps even bilinear [extrapolation](extrapolation.md). Many frameworks/libraries/engines have bilinear filtering built-in (e.g. `GL_LINEAR` in [OpenGL](ogl.md)). Bilinear interpolation (also bilinear filtering) is a simple way of creating a smooth transition ([interpolation](interpolation.md)) between [discrete](discrete.md) samples (values) in 2D, it is a [generalization](generalization.md) of [linear interpolation](lerp.md) to 2 dimensions. It is used in many places, popularly e.g. in 3D [computer graphics](graphics.md) for **[texture](texture.md) filtering**; bilinear interpolation allows to upscale textures to higher resolutions (i.e. compute new pixels between existing pixels) while keeping their look smooth and "non-blocky" (even though blurry). On the scale of quality vs simplicity it is kind of a middle way between a simpler [nearest neighbour](nearest_neighbour.md) interpolation (which creates the "blocky" look) and more complex [bicubic interpolation](bicubic.md) (which uses yet smoother curves but also requires more samples). Bilinear interpolation can further be generalized to [trilinear interpolation](trilinear.md) (in computer graphics trilinear interpolation is used to also additionally interpolate between different levels of a texture's [mipamap](mipamp.md)) and perhaps even bilinear [extrapolation](extrapolation.md). Many frameworks/libraries/engines have bilinear filtering built-in (e.g. `GL_LINEAR` in [OpenGL](ogl.md)). Of course this method may be used to smooth not just textures but anything, for example terrain [heightmaps](heightmap.md) or just any discrete mathematical function that we simply want to have defined everywhere, it's not just graphics thing, but here we will focus on its application in [graphics](graphics.md).
``` ```
####OOOOVVVVaaaaxxxxssssffffllllcccc////!!!!;;;;,,,,....---- ####OOOOVVVVaaaaxxxxssssffffllllcccc////!!!!;;;;,,,,....----
@ -111,4 +111,8 @@ The program outputs:
6 6 6 6 5 5 5 4 6 6 6 6 5 5 5 4
7 7 7 6 6 5 5 4 7 7 7 6 6 5 5 4
8 8 7 6 6 5 4 3 8 8 7 6 6 5 4 3
``` ```
**Cool [hack](hacking.md) to improve bilinear interpolation** (from https://iquilezles.org/articles/texture): bilinear interpolation doesn't looks as good as bicubic but bicubic is a lot more complex on hardware and bandwidth as it requires fetching more texels -- there is one trick which [shader](shader.md) programmers use to improve the look of bilinear filtering while not requiring fetching more texels. They use the `smoothstep` function on the interpolation parameter which eliminates instant "jumps" at edges between texels, it replaces straight lines with a smoother curve and so makes the [derivative](derivative.md) of the result continuous -- basically it looks a lot better. Still not as good as bicubic but close enough.
TODO: code for the above

View file

@ -13,7 +13,7 @@ Here is a comparison of the Creative Commons licenses/waivers, from most free (b
| name |abbreviation|free culture|use |share |remix |copyleft|attribution|non-commercial|comment | | name |abbreviation|free culture|use |share |remix |copyleft|attribution|non-commercial|comment |
|---------------------------------------------------|------------|------------|-------|-------|-------|--------|-----------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------| |---------------------------------------------------|------------|------------|-------|-------|-------|--------|-----------|--------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| [Creative Commons Zero](cc0.md) | CC0 | yes :) |yes :) |yes :) |yes :) | no :) |no need :) | no :) |[public domain](public_domain.md), copyright [waiver](waiver.md), no restrictions, most freedom, best, sadly doesn't waive patents and trademraks| | [Creative Commons Zero](cc0.md) | CC0 | yes :) |yes :) |yes :) |yes :) | no :) |no need :) | no :) |[public domain](public_domain.md), copyright [waiver](waiver.md), no restrictions, most freedom, best, sadly doesn't waive patents and trademraks|
| Creative Commons Attribution | CC BY | yes :) |yes :) |yes :) |yes :) | no :) |forced :( | no :) | no restrictions except for requiring attribution to authors | | Creative Commons Attribution | CC BY | yes?* |yes?* |yes :) |yes :) | no :) |forced :( | no :) | requires attribution to authors, `*`: limits some uses ("anti DRM"), rejected by [copyfree](copyfree.md), rather don't use |
| Creative Commons Sharealike | CC SA | yes :) |yes :) |yes :) |yes :) | yes :/ |no need :) | no :) | retired, secret license, no longer recommended by CC, pure copyleft/sharealike without forced attribution | | Creative Commons Sharealike | CC SA | yes :) |yes :) |yes :) |yes :) | yes :/ |no need :) | no :) | retired, secret license, no longer recommended by CC, pure copyleft/sharealike without forced attribution |
| Creative Commons Attribution Sharealike | CC BY-SA | yes :) |yes :) |yes :) |yes :) | yes :/ |forced :( | no :) | requires attribution to authors and copyleft (sharing under same terms) | | Creative Commons Attribution Sharealike | CC BY-SA | yes :) |yes :) |yes :) |yes :) | yes :/ |forced :( | no :) | requires attribution to authors and copyleft (sharing under same terms) |
| Creative Commons Attribution NonCommercial | CC BY-NC | NO! :((( |yes but|yes but|yes but| yes :/ |forced :( | yes :( | [proprietary](proprietary.md) fascist license prohibiting commercial use, DO NOT USE | | Creative Commons Attribution NonCommercial | CC BY-NC | NO! :((( |yes but|yes but|yes but| yes :/ |forced :( | yes :( | [proprietary](proprietary.md) fascist license prohibiting commercial use, DO NOT USE |
@ -24,4 +24,4 @@ Here is a comparison of the Creative Commons licenses/waivers, from most free (b
## See Also ## See Also
- [free culture](free_culture.md) - [free culture](free_culture.md)
- [free software](free_software.md) - [free software](free_software.md)

View file

@ -42,4 +42,5 @@ TODO: simple C code pls, maybe linear interpolation without floats
## See Also ## See Also
- [extrapolation](extrapolation.md) - [extrapolation](extrapolation.md)
- [regression](regression.md) - [regression](regression.md)
- [smoothstep](smoothstep.md)

View file

@ -46,6 +46,8 @@ Note that even things such as music/sound samples, text fonts or paint brushes m
Also **you must NOT use anything under [fair use](fair_use.md)**! Even though you could lawfully use someone else's copyrighted work under fair use, inclusion of such material would, by the fair use rules, limit what others would be able to do with your work, making it restricted and therefore not public domain. Example: you can probably write a noncommercial Harry Potter fan fiction and share it with friends on the internet because that's fair use, however this fan fiction can never be public domain because it can't e.g. be used commercially, that would no longer fall under fair use, i.e. there is a non-commercial-use-only restriction burdening your work. It doesn't even help if you get an explicit permission to use a copyrighted work in your work unless such permission grants all the right to everyone (not just your work). { I got a mascot removed from [SuperTuxKart](supertuxkart.md) by this argument, mere author's permission to use his work isn't enough to make it free as in freedom. ~drummyfish } Also **you must NOT use anything under [fair use](fair_use.md)**! Even though you could lawfully use someone else's copyrighted work under fair use, inclusion of such material would, by the fair use rules, limit what others would be able to do with your work, making it restricted and therefore not public domain. Example: you can probably write a noncommercial Harry Potter fan fiction and share it with friends on the internet because that's fair use, however this fan fiction can never be public domain because it can't e.g. be used commercially, that would no longer fall under fair use, i.e. there is a non-commercial-use-only restriction burdening your work. It doesn't even help if you get an explicit permission to use a copyrighted work in your work unless such permission grants all the right to everyone (not just your work). { I got a mascot removed from [SuperTuxKart](supertuxkart.md) by this argument, mere author's permission to use his work isn't enough to make it free as in freedom. ~drummyfish }
Also **do NOT USE [AI](ai.md)**, not even for things like upscaling and enhancements. NO JUST DO NOT. NO, your argument is invalid, just DO NOT USE IT. In theory it may be legit, but there's just huge amount of doubt, uncertainty and legal mess. To name a few potential issues: AI may create a derivative work of something it has seen in its training dataset (which even if "open"-licensed still may contain photos of non-free things that may be legal in the context of the dataset but not in the context of the generated result, e.g. "freedom of panorama"), the copyright status of AI works themselves is not as of yet clear and even once it's established, it may differ by country AND there is a danger of retroactive changes (once it becomes too easy to create PD works with AI capitalists can just push a law that will say AI can't be used for this because "[economy](crime_against_economy.md)" and yes, it may even be used retroactively, this has happened). Furthermore even if AI works are made legit, terms and condition of most usable AI software will still negate this (they already do, EVEN if you pay for it), it's not even clear if they can do this (or it may depend on territory and time) but it's a threat. Also AI is shit, [bloat](bloat.md) and serves mostly [capitalists](capitalism.md) to produce huge quantities of cheap shit for consumerist games, we just don't need this. You may think "haha I'll create one trillion PD textures and post them to Opengameart and save the world" -- that's literally what everyone is doing right now, it's the worst kind of spam that is now just killing the site, please don't even think of this. Create something small but nice, something whose legitimacy as your own work that you give away can not be questioned.
So you can only use your own original creations and other public domain works within your PD work. Here you should highly prefer your own creations because that is legally the safest, no one can ever challenge your right to reuse your own creation, but there is a low but considerable chance that someone else's PD work isn't actually PD or will seize to be PD by some retroactive law change. So when it only takes a small effort to e.g. photograph your own textures for a game instead of using someone else's PD textures, choose to use your own. So you can only use your own original creations and other public domain works within your PD work. Here you should highly prefer your own creations because that is legally the safest, no one can ever challenge your right to reuse your own creation, but there is a low but considerable chance that someone else's PD work isn't actually PD or will seize to be PD by some retroactive law change. So when it only takes a small effort to e.g. photograph your own textures for a game instead of using someone else's PD textures, choose to use your own.
{ NOTE: The above is kind of arguing for reinventing wheels which goes a little bit against our philosophy of remixing and information sharing, but we are forced to do this by the system. We are forced to reinvent wheels to ensure that users of our works can't be legally bullied. ~drummyfish } { NOTE: The above is kind of arguing for reinventing wheels which goes a little bit against our philosophy of remixing and information sharing, but we are forced to do this by the system. We are forced to reinvent wheels to ensure that users of our works can't be legally bullied. ~drummyfish }
@ -82,4 +84,4 @@ There are quite a few places on the Internet where you may find public domain wo
- **[Openclipart](http://openclipart.org)**: Vector graphics, all under [CC0](cc0.md), i.e. PD in theory, **however** there do appear pictures that are derivative works of copyrighted works for which of course this is irrelevant. Check very well anything you download from here. - **[Openclipart](http://openclipart.org)**: Vector graphics, all under [CC0](cc0.md), i.e. PD in theory, **however** there do appear pictures that are derivative works of copyrighted works for which of course this is irrelevant. Check very well anything you download from here.
- **[Blendswap](https://www.blendswap.com/)**: Site for exchanging 3D models for [Blender](blender.md), not all models are PD but the ones marked CC0 should be, however **NOT those marked as "fan art"!** - **[Blendswap](https://www.blendswap.com/)**: Site for exchanging 3D models for [Blender](blender.md), not all models are PD but the ones marked CC0 should be, however **NOT those marked as "fan art"!**
- **[Wikidata](https://www.wikidata.org/wiki/Wikidata:Main_Page)**: Database of "everything", published as a whole under [CC0](cc0.md) which should make it PD, **however** it will contain information about proprietary works which may make this status questionable sometimes. If you only use data that don't fall under this you should be safe. - **[Wikidata](https://www.wikidata.org/wiki/Wikidata:Main_Page)**: Database of "everything", published as a whole under [CC0](cc0.md) which should make it PD, **however** it will contain information about proprietary works which may make this status questionable sometimes. If you only use data that don't fall under this you should be safe.
- ... - ...

View file

@ -3,7 +3,7 @@
This is an auto-generated article holding stats about this wiki. This is an auto-generated article holding stats about this wiki.
- number of articles: 526 - number of articles: 526
- total size of all texts in bytes: 2599904 - total size of all texts in bytes: 2606069
longest articles: longest articles:
@ -23,35 +23,35 @@ longest articles:
latest changes: latest changes:
``` ```
Date: Sat Dec 16 20:32:58 2023 +0100
assembly.md
censorship.md
compression.md
copyleft.md
free_culture.md
free_software.md
fsf.md
furry.md
git.md
how_to.md
license.md
logic.md
lrs_dictionary.md
needed.md
nigger.md
noise.md
portability.md
public_domain_computer.md
rock.md
sudoku.md
usenet.md
wiki_stats.md
wiki_style.md
Date: Thu Dec 14 23:38:44 2023 +0100 Date: Thu Dec 14 23:38:44 2023 +0100
lrs_wiki.md lrs_wiki.md
main.md main.md
operating_system.md operating_system.md
wiki_stats.md wiki_stats.md
Date: Thu Dec 14 21:08:58 2023 +0100 Date: Thu Dec 14 21:08:58 2023 +0100
bloat.md
c.md
capitalism.md
hyperoperation.md
math.md
nokia.md
operating_system.md
real_number.md
shortcut_thinking.md
Date: Wed Dec 13 20:50:14 2023 +0100
4chan.md
acronym.md
axiom_of_choice.md
bbs.md
capitalism.md
chess.md
fizzbuzz.md
function.md
game_of_life.md
hyperoperation.md
just_werks.md
lrs.md
math.md
procgen.md
``` ```