Texture Sampling #2: Bilinear & Bicubic Samples

  Рет қаралды 23,642

javidx9

javidx9

Жыл бұрын

Following on from Part 1, I look at two common sampling methods that aim to reduce artefacts, bilinear and bicubic point sampling. The former linearly interpolates between neighbouring pixels, and the latter uses even further pixels to bias cubic splines to give a smoother contour between pixels.
Demo: community.onelonecoder.com/me...
Part 1: • Texture Sampling #1: P...
Source: Released at end of series
Patreon: / javidx9
KZbin: / javidx9
/ javidx9extra
Discord: / discord
Twitter: / javidx9
Twitch: / javidx9
GitHub: www.github.com/onelonecoder
Homepage: www.onelonecoder.com

Пікірлер: 74
@braveitor
@braveitor Жыл бұрын
Very interesting. If I'd had a teacher like you back in my highschool days, I'd surely would have loved maths much more. Nice video!
@pholyn
@pholyn Жыл бұрын
Very interesting and educational topic. Thanks for making these!
@lucasmuffato4348
@lucasmuffato4348 Жыл бұрын
Hello from Brazil! I love your channel and I'm glad there are still people who make smart content on KZbin.
@SassyToll
@SassyToll Жыл бұрын
Brilliant, I learn so much from this thank you
@Turjak_art
@Turjak_art Жыл бұрын
Your videos are of great value to me. Thank you
@Garet2k
@Garet2k Жыл бұрын
You're a godsend. I'm writing my computer graphics exam in two days and texture sampling is the only topic I couldn't fully grasp
@joaovitormeyer7817
@joaovitormeyer7817 Жыл бұрын
very nice video as always! Used bilinear sample in lightmaps for my 3D engine, that way I don't need too much resolution and the lack of resolution is less noticeable.
@lasersimonjohnson
@lasersimonjohnson Жыл бұрын
I am currently writing real time software for car engine managment and just had to implement this too !
@allmycircuits8850
@allmycircuits8850 Жыл бұрын
And then there is another complication: RGB values are not linear themselves (gamma-corrected), with 128 giving almost 1/4 brightness compared to 255, as this was necessary for CRT monitors but also allowed to get good range with just 8 bits. Linear representation would require 10 to 12 bits and didn't improve image as human eye works logarithmically, it sure sees difference between 1 and 2 but can't spot difference between 999 and 1000. So for correct sampling it is actually better to convert all pixel values into linear representation, sample pixel and return to gamma-corrected value. See MinutePhysics: computer color is broken. Most visible effect of simplified methods is different brightness of textures depending on scale. Like, human averages small checkerboard correctly but when computer does it converting neighboring 0 and 255 into uniform 127, it gets 1/4 brightness instead of 1/2!
@wesleythomas6858
@wesleythomas6858 Жыл бұрын
I guess you could use 3 bicubic interpolation calculations for the following rows each time to increase performance? You’d have to do an entire columns worth of interpolated values at a time though. Starts to hurt your brain trying to describe this stuff, well done for relaying it so well David! Definitely one of your strengths!
@Kenjuudo
@Kenjuudo Жыл бұрын
Awesome video!
@Pedritox0953
@Pedritox0953 Жыл бұрын
Great video!
@Najvalsa
@Najvalsa Жыл бұрын
This is too interesting. If you're able/willing to, please also cover bicublin (bicubic for luma, bilinear for chroma), and sinc/lanczos sampling.
@firiasu
@firiasu 6 ай бұрын
You're so great!
@yonis9120
@yonis9120 Жыл бұрын
You're my hero ✨
@davidmcgill1000
@davidmcgill1000 Жыл бұрын
Never thought about bicubic sampling being a valid use of matrices until you laid out the math for it.
@quicktastic
@quicktastic Жыл бұрын
This is very interesting and also very frightening as it reveals just how much I don't know. 😂
@GameBacardi
@GameBacardi Жыл бұрын
Great weekend!
@teucay7374
@teucay7374 Жыл бұрын
I like the shorter format! Specially if it makes it easier for you to put the videos out ;)
@johnernest8109
@johnernest8109 Жыл бұрын
If I were to build a rasterizer from scratch for a set of vectors like filled bezier paths such as in a font glyph or a simple vector drawing is a good method to draw it at a higher resolution (I.e. 2x or 4x) and then to scale down with bilinear or bicubic sampling, or is there a better method? Also, is that how "2x" and "4x" anti-aliasing is achieved?
@dombthekid
@dombthekid Жыл бұрын
I forgot to vote last video! I'm a fan of these shorter videos more frequently.
@Looki2000
@Looki2000 Жыл бұрын
How about creating new interpolation that "interpolates" between point sampling if slope is big and bicubic if slope is small to preserve hard edges on the checkerboard or around the tree branches while remaining soft transitions on surfaces with smooth slopes? Maybe it would be possible to dynamically change "sharpness" of cubic interpolation curve?
@Tiaronus
@Tiaronus Жыл бұрын
shorted videos indeed are OK, easier to comprehend the data received )))
@CD4017BE
@CD4017BE Жыл бұрын
These interpolation methods ensure that the interpolated curve goes through the sample points exactly. But usually the low resolution texture to be interpolated is acquired by down-sampling a (theoretical) higher resolution image through mixing pixels together. So under this assumption in order to more effectively "undo" this down-sampling, wouldn't it make more sense for the interpolation to preserve area under the curve for each sample region instead?
@__hannibaal__
@__hannibaal__ Жыл бұрын
These days i m busy with Bjarn Books, and Metaprogramming. I’m working on something abstract like mathematics field named algebraic geometry; so as in C++ there too match Libraries for Graphics; so why we don’t writing a Classes and functions for graphics object that can be valid for every Libs. I ‘ m steel use Olc Console, your technic very valuable. _thanks J_
@stupid-handle
@stupid-handle 5 ай бұрын
Where's the code in here to be found? I've looked in github and in the website. At a last resort I'll try copying from what I read on the video
@skejeton
@skejeton Жыл бұрын
Next video about mipmaps!?
@turolretar
@turolretar Жыл бұрын
P2t sounds like a refreshing beverage
@TimothyChapman
@TimothyChapman Жыл бұрын
I suppose this would be useful if you were making an image editor like GIMP. But this is way too expensive for realtime rendering in 3D, which I assume is where this will eventually be going.
@DFPercush
@DFPercush Жыл бұрын
I recently watched the absolute masterpiece that is Freya Holmer's "The Continuity of Splines." As soon as you mentioned basis functions, I knew where this was going. :P If anyone wants to know more about splines and their properties, I highly recommend that video. It will all make sense. I wonder what would happen if you used a cardinal spline and starting playing with the tension value, would it make edges look sharper? I might have to try that.
@justcallmenoah5743
@justcallmenoah5743 Жыл бұрын
Absolutely the same thing I thought!
@PLATONU
@PLATONU Жыл бұрын
@mynameisfoxxy6110
@mynameisfoxxy6110 Жыл бұрын
Great video Javi, sadly I couldnt watch past 19:34 Missed a square and also use 0-3 for the base formula but 1-4 for the basis functions
@FabulousJejmaze
@FabulousJejmaze Жыл бұрын
It's probably just me but I think point sampling looks better than interpolation 😅
@ianbarton1990
@ianbarton1990 Жыл бұрын
You're not the only one, I think it depends on the type of image but especially computer images such as the checkerboard pattern are better when using point sampling as they preserve the hard edges whereas interpolation smooths over everything and makes it soft and blurry.
@DFPercush
@DFPercush Жыл бұрын
For pixel art and retro games, definitely. On the N64 you would always see tiny textures blown up to huge proportions because the texture unit was so limited it could only hold 32x32 pixels or something ridiculous like that, and everything was blurry. But I think most 3d games these days have an abundance of texture resolution, so you're never really zooming in to this degree unless you face plant into a wall. The main issue with point sampling is what happens when you animate it and move slightly. You get a lot of flickering and rapidly changing colors. But that's more of an issue zooming out than in, so I guess we're not there yet.
@kae4881
@kae4881 Жыл бұрын
firstt!!!! love your stuff javid!!
@su4amp397
@su4amp397 Жыл бұрын
Dude, you are insanely smart
@obinator9065
@obinator9065 Жыл бұрын
G’day
@defini7
@defini7 11 ай бұрын
New PGEX 3d update?
@kirill_bykov
@kirill_bykov Жыл бұрын
19:00 indices are wrong.
@andrewdunbar828
@andrewdunbar828 Жыл бұрын
It's interesting that the performance increases with the filtering! But then what is the price that is paid?
@gsestream
@gsestream 10 ай бұрын
if you do ray traced raster correctly, you dont even hit all pixels, ie, if pixels were objects, ie ray culled raster
@gsestream
@gsestream 8 ай бұрын
if you use instancing on low resolution 4x4 or 64x64 per pixel reflection map buffers, you get the full benefit of the instanced fast rendering, not just multiple same objects on the main draw buffer, but also fast real time scatter lighting system, mirror reflections should be done by single reflection per pixel ray tracing as usual
@omaritookof5606
@omaritookof5606 Жыл бұрын
How can I make a program in c++ that describe the used command in it I asked in a lot of channels on KZbin but no one gave me an answer
@omaritookof5606
@omaritookof5606 Жыл бұрын
If you can make a little lesson about that you well make me a great favor
@javidx9
@javidx9 Жыл бұрын
Your question is unclear. What is the "used" command perhaps? Can you give an example of what you are expecting as a result?
@omaritookof5606
@omaritookof5606 Жыл бұрын
My teacher gave as a homework in university the homework is to make a program that describe it self It is something like when I use a keyword like int it tool me this is an integer Where I use + it tool me this is the sum operator Something like this But he told as about a property coled token When I searched for it they show me the basics of c++ I am sorry because I am weak in English i hop you onderstand me
@javidx9
@javidx9 Жыл бұрын
What you are describing is a "text parser", which "tokenises input" strings to form an "abstract syntax tree". These can be written in any language that can process text input. I hope those search phrases help. I haven't done a video on this (yet) but I plan to before the end of this year.
@omaritookof5606
@omaritookof5606 Жыл бұрын
Thank you so much 🌹
@hicham2668
@hicham2668 Жыл бұрын
Hope to see you in Rockstar studios.
@Jkauppa
@Jkauppa Жыл бұрын
center of the pixel?
@Jkauppa
@Jkauppa Жыл бұрын
try the wolf3d engine but replace the rays with plane-rays (X+Y resolution plane-ray intersections with sphere map/entity-bvh per cell/entity)
@Jkauppa
@Jkauppa Жыл бұрын
yes you get both sphere 360 degree and screen projected renders, easily
@Jkauppa
@Jkauppa Жыл бұрын
try super high resolution font grayscale compressed jpg images, down-sampled to any resolution, just like textures but for fonts, per character images
@Jkauppa
@Jkauppa Жыл бұрын
approximating the SDR font glyphs, compressed does not take up space, high resolution gets each pixel approximately right when filtered
@Jkauppa
@Jkauppa Жыл бұрын
how about trying a pre-rom cpu emulator
@__hannibaal__
@__hannibaal__ Жыл бұрын
I m not wander if one day; if found olc::OS.
@edcarlo
@edcarlo Жыл бұрын
first
@FabulousJejmaze
@FabulousJejmaze Жыл бұрын
no i'm first
@jsflood
@jsflood Жыл бұрын
Texture Sampling #1: Points & Borders
30:32
javidx9
Рет қаралды 33 М.
Bicubic Interpolation - Computerphile
8:36
Computerphile
Рет қаралды 262 М.
Does size matter? BEACH EDITION
00:32
Mini Katana
Рет қаралды 18 МЛН
Жайдарман | Туған күн 2024 | Алматы
2:22:55
Jaidarman OFFICIAL / JCI
Рет қаралды 1,8 МЛН
Now THIS is entertainment! 🤣
00:59
America's Got Talent
Рет қаралды 16 МЛН
Despicable Me Fart Blaster
00:51
_vector_
Рет қаралды 19 МЛН
DIY Programming Language #1: The Shunting Yard Algorithm
37:10
Programming & Using Splines - Part#1
23:56
javidx9
Рет қаралды 91 М.
Quirky Quad Trees Part1: Static Spatial Acceleration
44:01
javidx9
Рет қаралды 68 М.
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 825 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,4 МЛН
Procedural Generation: Programming The Universe
41:57
javidx9
Рет қаралды 203 М.
Adobe is horrible. So I tried the alternative
25:30
Bog
Рет қаралды 589 М.
Interpolation in 5 minutes
5:31
Graphics in 5 Minutes
Рет қаралды 15 М.
Dungeon Warping via Orthographic Projections
42:14
javidx9
Рет қаралды 81 М.
Телефон-електрошокер
0:43
RICARDO 2.0
Рет қаралды 382 М.
Как правильно выключать звук на телефоне?
0:17
Люди.Идеи, общественная организация
Рет қаралды 1,4 МЛН
Easy Art with AR Drawing App - Step by step for Beginners
0:27
Melli Art School
Рет қаралды 14 МЛН