Before all the complaints start streaming in - I'm aware that this is more of an "approximation" to Perlin noise rather than defacto Perlin noise, however it shares the same periodicity and distribution properties. Instead of using dot products of gradients, The original noise map is used as a height map, through which gradient is implied via linear interpolation between neighbouring heights at different spatial scales.
@whynot-vq2ly4 жыл бұрын
dont worry people are going to complain anyways :D, great tutorial thanks a lot
@graphics_gurunt2 жыл бұрын
هجهححعحععض
@graphics_gurunt2 жыл бұрын
عضغضضضضضضض
@graphics_gurunt2 жыл бұрын
فضفضفضڤ في فض ففي في غ١٦غضغضضضضغضضضضضضضغغضغضغضععععععضضغغغضضغضضضضضضضضغضضغضضضضضغضضغضضغضضعضعغضععه
@graphics_gurunt2 жыл бұрын
رح وز لءظاللذالننح مع ههشهشهههههههعععععععععععع٦ض١١ضضضع
@mime4906 жыл бұрын
I appreciate the void you fill in the youtube space for development tutorials, your explanations are excellent and have helpes me significantly in ways that channels like Brackeys are unable to. I see a lot of comments noting that the speed of your videos is too fast, I believe that there is a large community that will find your speed refreshing.
@javidx96 жыл бұрын
Hi Mime and thanks for the positive feedback, I appreciate that!
@andreaprovasi97864 жыл бұрын
This! A hundred times! javidx speed is DEFINITELY refreshing compared to most tutorials (whatever the topic)
@danielrazulay3 жыл бұрын
Agreed! I'm really enjoying this pace.
@sloppyprogrammer43733 жыл бұрын
The creator Brackeys doesn't have a background in math nor programming. He's just a creative mind that happened to stumble across unity and picked up game development due to it. It's not bad perse, it just gives a whole different style of content because he doesn't know what is actually happening under the hood of the code or the engine. I still learned some stuff from brackeys and they were really good at showing how the engine (unity) works. But Javidx9 knows what actually is happening under the hood and that's why he can make a lot more educational focused content because he actually knows how to make an engine.
@avananana6 жыл бұрын
This is genius. Whilst it isn't "true" perlin noise, it's damn close to it, and I'm sure you could use this to get practically the same results in nearly every project you could think of. Well done :P
@javidx96 жыл бұрын
Thanks Avana - though I will say I've seen this method used in the wild, so I cant lay exclusive rights to it! It's closest relative is an algorithm called "Simplex Noise".
@benjamminholmes7 жыл бұрын
I like that you used musical elements as an example; really helps me out.
@javidx97 жыл бұрын
Thanks Benjamin! I'm pleased you've found it useful!
@remmo1236 жыл бұрын
You are a great teacher. Thank you for making these. I'm learning a lot.
@olavman887 жыл бұрын
I've been searching for this for so long! Everybody else just uses functions already implimented so I don't really learn how the perlin noise works. Thanks :)
@javidx97 жыл бұрын
Hi Olav, no problem!
@MB-rc8ie7 жыл бұрын
You make interesting and quality videos, hope your channel will grow soon
@javidx97 жыл бұрын
Thanks Black Magic!
@matthewe38134 жыл бұрын
@@javidx9 thats not his name?
@javidx94 жыл бұрын
It was 2 years ago 😁
@MB-rc8ie4 жыл бұрын
@@javidx9 haha
@GregoryTheGr8ster5 жыл бұрын
The time passes so quickly when I watch your videos.
@suffysbert2252 жыл бұрын
After looking through papers and tutorials, i just couldnt get my head around it. thanks to this tutorial i implemented it & fully understand it. thanks alot
@judgeomega4 жыл бұрын
that first picture of true random static was trippy. it started waving and flowing on me like one of those magic eye hidden image puzzles.
@yeeteronipizza3 жыл бұрын
I started learning C++ about a month ago, coming in with knowing matlab from engineering and C# from making a lot of little games in Unity. You are a blessing, because you explain the topic so well I could probably write the code myself.
@kevinsmith-dn1px6 жыл бұрын
Omg, much respect to people who can code!
@javidx96 жыл бұрын
Hi and thanks Kevin, I think most people can code, like all things it just takes practice and patience and effort, which are traits that should be respected regardless of discipline.
@kevinsmith-dn1px6 жыл бұрын
@@javidx9 Maths isn't my friend lol! But you're right, you get out what you put in i guess👍 It may sound strange, but when i see code, to me it looks like art. It has a beauty to it - anyway much respect to you!
@obinator90655 жыл бұрын
kevin smith That is what good is haha, you can achieve things differently. It truly is an art, you can do it really verbose and unreadable, or simple but yet effective.
@minsin565 жыл бұрын
free respect
@cheaterman495 жыл бұрын
@@kevinsmith-dn1px A recent quote I found that I really like, "code is art that does something". Other than that, you'd be surprised how little day-to-day programming has to do with maths! The only part they have in common is the general logic aspect (which applies to so many other disciplines that it's not fair to claim it makes programming close to maths) - I'd say the real crucially common part is being able to deconstruct complex operations into simpler ones to solve an issue, like you would when writing up a demonstration to a theorem (or anything else really) in maths for instance. EDIT: I'd say generally some types of programmers are math enthusiasts like OLC and (probably) much of the audience, but not really math nerds (what's a covector again? differential topology? no thanks) : I think high school maths is the most interesting and useful, having a basic understanding of moderately advanced geometry like vector dot product, as well as some calculus, but really most of the problems I think of as "interesting" that would involve me using those tools are essentially problems that are already solved, and I could just copypaste some maths formula in my code if I didn't enjoy solving the puzzle.
@deadlypoe5_7102 жыл бұрын
You probably wont see this, but you spared me a headache. Thanks for all the work you do!
@javidx92 жыл бұрын
Always appreciate feedback, cheers buddy!
@leonardosabomisseni36673 жыл бұрын
I think you just saved my weekend and semester project as my method was getting increasingly repetitive. Thank you very much!!!
@TChapman500Gaming4 жыл бұрын
Thanks for the tutorial. I'm going to be implementing the 2D version of this algorithm into my game, Solar Lander.
@roganjosh62203 жыл бұрын
brilliant video, clear explanation of an abstract concept then an implementation to demonstrate
@CharlesFerreira6 жыл бұрын
When writing/showing code, you could use the Alt+Shift+Enter shortcut to show code in fullscreen. It makes code much easier to visualize and follow up.
@CharlesFerreira6 жыл бұрын
All the toolbars, console, taskbar, solution explorer etc. are too distracting and add no useful information to the video.
@austin5359 Жыл бұрын
Another way of linear interpolation is ((nSample2 - nSample1) * fBlend) + nSample1 I code in Scratch (because I'm too lazy to learn Java, C++, python or literally anything else) and this helped me create some code that can create a map using your "Perlin noise." It may not be true Perlin noise, but it does the same job and works very similarly. Thanks!
@antiprime4665 Жыл бұрын
Bro move to c++ or something you'll like it better I promise
@CarstenMeyer7 жыл бұрын
Great video, as always!
@javidx97 жыл бұрын
Thank you Carsten, was a bit worried about this one!
@philiphanhurst26554 жыл бұрын
This was really useful for a fog effect I'm experimenting with. I put it into a header file as a couple classes. Only problem is I want the clouds to change over time, and for that I'd need noise with a 3 dimensional input. I've tried figuring it out myself, expanding on the 2D noise, but it seems I'm too stupid for it. Edit: nevermind, got it working... to an extent.
@dorjderemnamsraijav51824 жыл бұрын
Hey javidx9! Can you do a tutorial about liquid simulation? I found that there arent any proper tutorial on how to do liquid simulation from scratch.
@GregoryTheGr8ster5 жыл бұрын
I would have given you a *big* thumb's up (as you request at 27:49) , but KZbin allows only an ordinary thumb's up. I hope that that is adequate. I have been in need of noise generation like this for a while. My own algorithms are fast-executing, but don't have the look and simple parameterization of the Perlin noise. Now I know what to do!
@smugtomato59722 жыл бұрын
One thing to note about the seed array, Perlin's original algorithm uses a precomputed array containing 0-255(inclusive) in a randomized order, in my understanding this is done to prevent getting into situations where the majority of the numbers in the array are too similar to eachother(and of course performance, it was created in the 80s after all, memory and CPU cycles weren't cheap). What you can then instead do is randomly shuffle the elements in the array, that way you keep all numbers from 0-255 but in a new order. Although this implementation is completely different than the original Perlin noise, using a float array instead of int array, so I don't know how you would fit that in here. Not really a big deal, but sticking to the "true" perlin noise might give some slightly more predictable results, besides the video still shows very well how perlin noise is used and why it's useful
@Test-iv4pm Жыл бұрын
At 18:17, going from 1 octave to 2 octaves, it makes the line drop in the middle. Shouldn't octaves only be able to add on to what we already have? I am wondering if the seed noise somehow contains negative numbers.
@thyandyr73695 жыл бұрын
I rellay like the idea of explaining this. I literally won't use anything unless I understand how it works. It just feels wrong to me. Any wathincg this was faster than figuring it out myself.
@DarkCloud76 жыл бұрын
I've read about the >> operator but never used it before. So I just wanna make sure I got the concept. The expression (nWidth >> o) is there to divide nWidth by 2^o is that right? Furthermore do you only use it because it's faster to compute? Are there any drawbacks or other potential advantages?
@javidx96 жыл бұрын
Hi Flo, Yes your calculation is correct. In most cases, your compiler will choose the most optimal division strategy, but in the case of integers that are powers of 2, then bit shifting is the most optimal. The >> and
@KristijanPruzinac3 жыл бұрын
Thank you for this!
@erwinmulder13386 жыл бұрын
Just nitpicking here, but fScaleAcc will be the same number for all samples, so you you can compute it only once and re-use the value. You don't even need to calculate it inside one of the loops: fScaleAcc = 2.0 - 1.0/(float)(1
@javidx96 жыл бұрын
Thanks Erwin, I dont see things a nitpicks, I find them often to be valuable contributions, which I hope others get to see. I dont make any claim that my methods are the best, just a way to have fun coding. The challenge I face is I try to write code in such a way that things are obvious, so viewers can follow - but you are right of course.
@erwinmulder13386 жыл бұрын
I found it nitpicking, as the presentation is otherwise perfect. Especially because the second part where you can alter the divisor, the formula involves some quite advanced math and is quite obviously not on the level of the intended audience.
@trentf86077 жыл бұрын
Hello! I have a question. I know that this is similar to Perlin noise, but is an approximation. I was wondering if one is better to use than the other. Is there a big difference? Also I really like how you explained how it worked first with the diagram. 😁
@javidx97 жыл бұрын
Hi Trent, then end results from the algorithms are pretty much the same, Perlin interpolates a little differently, focusing on interpolating the gradients directly, and is why I use the term "approximating", as I calculate the gradients and interpolate the lines instead. The approach shown in this video is quite common, as it is more visual to grasp.
@trentf86076 жыл бұрын
javidx9 Thanks! :)
@Test-iv4pm Жыл бұрын
At 23:40, I see SampleT and SampleB. What do 'T' and 'B' stand for?
@javidx9 Жыл бұрын
Top and bottom
@Test-iv4pm Жыл бұрын
@@javidx9 Thank you
@nikims_3 жыл бұрын
I know this is a pretty old video, but i'd like to ask what this implementation is called exactly? Or did you make it up?
@adrianMT4U2 жыл бұрын
thank you ser! even I don't understands the code and the mathematical thing, but i get the idea of perlin noise hehe
@CJBurkey6 жыл бұрын
I have f.lux, and it took me about half a minute to realize that you were probably using yellow, not white, on the white background.
@javidx96 жыл бұрын
lol, I shall be more late night yet sensible video watcher aware going forward!
@piotrjaga69292 жыл бұрын
thank you
@Test-iv4pm6 ай бұрын
Can you make a video extending to 3D? 🙂 Maybe even 4D? 😀
@DaniiTheFox3 жыл бұрын
wont work on linux, there are math errors that where not solved and also: int nSampleX1 = (x / nPitch) * nPitch; int nSampleY1 = (y / nPitch) * nPitch; why this? it's literally the same as just int nSampleX1 = x; int nSampleY1 = y;
@HerrHoldem6 жыл бұрын
Hello, Nice Video. Can you call which Graphic Library you use? Thank you!
@javidx96 жыл бұрын
Thanks Grub! Most of my videos use a custom library I created that exploits the windows command prompt as a graphical surface. All the source is available in the descriptions below each video.
@HerrHoldem6 жыл бұрын
Thanks. I will research this.
@bytelab32683 жыл бұрын
Int sample1 x = (x/npitch) * npitch ???? What's the difference with just int sample1x = x
@javidx93 жыл бұрын
Yeah it's a fun one this 😄 I'm taking advantages of the property of integer divide to round down X, before scaling it up to be a multiple of nPitch.
@bytelab32683 жыл бұрын
Ahhh now I understand.
@thatlevivw5452 жыл бұрын
@@javidx9 But doesn't that result in that a lot of the time the samples are 0? I have this problem where my samples are 0 a lot of the time which results in terrain with a smooth line from the top Left to the bottom right of my screen en the rest is still just noise?
@DaniloSouzaMoraes3 жыл бұрын
I can't seem to find anything on the interpolation method you used ( linear interpolation between neighbouring heights). Any idea where I could read more about it?
@javidx93 жыл бұрын
It is nothing more complicated than simple linear interpolation. Even has it's own function now std::lerp()
@DaniloSouzaMoraes3 жыл бұрын
@@javidx9 I was having a little problem seeing that x=(1-mu)*x0+mu*x1 was actually a linear interpolation formula. Tried it on Excel and that answered my question. Thanks and nice video!
@SuperToughnut4 жыл бұрын
Is this like the diamond square algorithm in 2d?
@pinurim98616 жыл бұрын
thanks
@Je3f0o5 жыл бұрын
My humble understanding seeds length is 256. Which is 8 octaves. But how do I generate infinite continues noise? Can you make a video improve this algorithm to infinite continues noise generator?
@MarsCorporations5 жыл бұрын
You can still use everything as presented here but you will need to wrap the RNG so it can do stuff like: random(x, y, seed). Then you use this instead of a precalculated random array to create your fSampleT and fSampleB. Now you are no longer bound to any dimensions. Next you could remove any "array-like" stuff from the perlin function and use it to only calculate ONE sample at one specific (x,y). And here you go: A perlin-generator that takes x, y, bias, oct, etc (whatever you want) as input and outputs a single Value between 0 and 1. I havent coded it yet but i think it should work that way.
@FrostGamingHype2 жыл бұрын
i wish javid made this without olc so it could be helpful for an person like me that is trying to implement this in his own console game engine
@rocketeer_TH3 жыл бұрын
how do I make it to 3d mesh?
@GregoryTheGr8ster5 жыл бұрын
Also, why do you say that this is "only an approximation of Perlin noise" in the video description?
@megamech22686 жыл бұрын
when i run the program, it tells me that "olcConsoleGameEngine.h" has no such file or directory.
@javidx96 жыл бұрын
Have you downloaded the "olcConsoleGameEngine.h" file as well?
@abirneji5 жыл бұрын
I kinda wish I could use bicubic interpolation instead of bilinear but I just don't know how to get it working
@dutu0004 жыл бұрын
it would be interesting to hear how perlin noise sounds
@oraz.3 жыл бұрын
Did you make up this approximation?
@andresantana40867 жыл бұрын
Out of context, but, what font do u use at thumbnails?
@javidx97 жыл бұрын
Hey André, it's called Press Start and I stretch it vertically a little.
@deprogrammeur4633 жыл бұрын
can you do 3d perlin noise?
@thefoolishgmodcube26447 жыл бұрын
Bisqwit and javidx9, which one is the best programmer?
@javidx97 жыл бұрын
Bisqwit. The guy's a machine.
@EximiusDux6 жыл бұрын
javidx9 heh. His videos are alien in nature. His c++ nearly impossible to understand for me.
@samholland209 Жыл бұрын
Do you know Minecraft uses this algorithm to generate its terrain?
@1st_ProCactus7 жыл бұрын
Cool, Im in.. Nice font size
@javidx97 жыл бұрын
Hi ProCactus!
@CreativeOven4 жыл бұрын
that's cool for Worlds terrains.
@GTS000007 жыл бұрын
Hey Javidx9! Beautiful work! Excellent theoretical intro. vey pedagogical. Questions: i) How compatible is olcConsole...h with linux? ii) Why windows man, why?
@javidx97 жыл бұрын
Hey Thanks GTS! I appreciate that. 1) Not very. Members of this community have tried with different levels of success. Fundamentally, the consoles between the two OSs are very different in their use and implementation. 2) See 1 :D Only displaying the screen is incompatible. The algorithms in my videos are very much cross compatible. Maybe it's time I took a look at a linux implementation. I don't think I'd be able to do much better than the others that have tried, it seems to be quite performance restricted due to how the linux terminal works. There was an SDL2 port made of the game engine via github, which could also help.
@Prolute6 жыл бұрын
Your 2d function only works when the width and height are the same size.
@javidx96 жыл бұрын
Hi Joe, correct it also prefers power of 2 dimensions also.
@olasoderlind56855 жыл бұрын
cold you do one lloop whit (mod)% of 1,2,4,8,16
@NicoFye6 жыл бұрын
Maube someone can tell me how to make more plains?
@clementtarin99363 жыл бұрын
wow
@tedeusz835 жыл бұрын
Worms terrain generator :)
@tangerian3196 жыл бұрын
this video's sadly WAY too fast and lacks a lot of the explanation needed to understand exactly how it works. I've needed to do LOADS of de-bugging in order to use this generation algorithm. I had troubles because I couldn't tell where my code went wrong, because I had to do a lot of blind faith in the code you had written. I'd recomend re-doing this tutorial and splitting it up into two parts, and explain every single bit in extream detail, and when going into 2D, explain the changes. Either way, this is prety much the only tutorial on generating your own perlin noise on youtube, so credit where credit is due.
@javidx96 жыл бұрын
Hi bysTaXx, I'm sorry you've not found this video very clear. It is quite a complicated subject matter. I probably won't redo the video, but I'll take on board your concerns. I often get criticized that my videos are too slow! I'm still new at this, so still working on finding a balance that suits everybody.
@tangerian3196 жыл бұрын
javidx9 well then, i find that in many casses it is better to have more videos with narrow subjects explained in depth rather than one video with multiple topics to be helpfull, for instance, having an "intro to perlin noise" then a "1D perlin noise" then a "2D perlin noise" video would be better, as an example. And you are correct, perlin noise is a complicated topic, like PRNG algorithms are complicated. I would recommend typing out the code as much as possible, rather than copying and pasting predefined code to be most effective. Another suggestion is that after finishing a block of code, pause for a few seconds to let the viewers pause the video to review the new code. Either way, you have excellent delivery, you are engaged with your viewers, and i'm happy you dive into topics that most people just use a pre-defined library for. So all in all, i'd say you are doing quite well, just could use a little improvement.
@ScibbieGames5 жыл бұрын
"Because I had to do a lot of blind faith in the code you had written" Are you very familiar with c++ or is it already going wrong there?
@toastyPredicament2 жыл бұрын
Screw everything I want to do Pc stuff
@peoplearecool12344 жыл бұрын
12550821, only true gamers know what this number means.
@365tito3 Жыл бұрын
I'm trying to convert your algorithm to generate a bitmap but somehow the bw_pixel value is always 4? Why is that?