Procedural Landmass Generation (E03: Octaves)

Welcome to this series on procedural landmass generation. In this episode we create introduce various parameters for greater control over our noise.
The source code for this episode can be found here:
github.com/SebLague/Procedura...
If you'd like to support these videos, I have a Patreon page over here: / sebastianlague

Пікірлер: 365

  • @8lusk
    @8lusk4 жыл бұрын

    4 years after and i still cant find something better. you did an amazing job.

  • @pie3i940

    @pie3i940

    4 жыл бұрын

    Hey just wondering do you know if this tutorial works with unity 2019.3 on URP?

  • @wudolph4255

    @wudolph4255

    4 жыл бұрын

    PIE3I9 i use unity 2020.1

  • @oliverlabudik3355

    @oliverlabudik3355

    3 жыл бұрын

    kinda tru

  • @supremedeity9003

    @supremedeity9003

    3 жыл бұрын

    @@pie3i940 For anyone wondering, the underlying mechanics relating to the things discussed thus far have not been changed and work on the current latest version (Unity 2020.3)

  • @plantgum

    @plantgum

    3 жыл бұрын

    ​@@supremedeity9003 5 years later and it still works beautifully

  • @PolyRocketMatt
    @PolyRocketMatt6 жыл бұрын

    Even after 2 years after uploading it... This is the best tutorial I can find on how to generate a nice, smooth perlin noise value. Clear explanation if you have basic knowledge over C#, and easy to carry over to other languages such as Java because of the way you indicate what every variable does! Really helpful!

  • @MrNerd-ll9my

    @MrNerd-ll9my

    4 жыл бұрын

    Gotta say, still an incredible tutorial now. Stay healthy mate

  • @nicolasseydoux5985

    @nicolasseydoux5985

    2 жыл бұрын

    5 years after uploading it and still the best =) I learned more on the editor GUI than the perlin noise btw

  • @absolutewisp

    @absolutewisp

    2 жыл бұрын

    @@nicolasseydoux5985 me too, editor scripts were just pure magic to me before this.

  • @tonychristney2728
    @tonychristney27284 жыл бұрын

    Minor bug: when checking the min/max, you should not have an else there (at least for the first value). The first pixel in map should always be both greater than the maximum and less than the minimum. So you could miss the global minimum there.

  • @AliveNotDeadmund
    @AliveNotDeadmund Жыл бұрын

    Absolutely phenomenal tutorial. Truly one of those lessons that makes the work of thousands better.

  • @THEspindoctor84
    @THEspindoctor843 жыл бұрын

    this might be one of the best tutorials I've ever watched. It's got real MEAT to it, and the concepts are challenging (at least to me), but the explanation is great and the code is clear.

  • @jastorgallywix4424
    @jastorgallywix44245 ай бұрын

    Minor tip: If you're still bothered by the resolution despite all the operations and think it's blurry, the reason is that you're entering pixel values for localScale in your MapDisplay script. The transform values of components in Unity specify their coordinates in the world, not their resolutions in pixels. Therefore, you need to keep the localScale variable lower so that pixels are compressed instead of spread out, resulting in increased resolution. You can achieve this by dividing the height and width variables in the MapDisplay script or passing other variables to the Renderer.

  • @mollymilesweb
    @mollymilesweb7 жыл бұрын

    Thank you for making these, you are an amazing presenter of just the thing I need to learn.

  • @alexpitt7900
    @alexpitt79003 жыл бұрын

    Definite the best Tutorial on this subject I have found. Fantastic Work Sebastian !

  • @Weckacore
    @Weckacore5 жыл бұрын

    This is honestly an amazing and educational tutorial.

  • @LordAikido
    @LordAikido7 жыл бұрын

    Your tutorials are always amazing. You're a boon to experience!

  • @theeleb
    @theeleb4 жыл бұрын

    This videos are amazing, im don't have any experience in unity, im a programmer. But following your videos now im have knowledge about many things (perlin noise, octaves, frequency, etc etc etc) included Unity. Thanks for sharing, im a new FAN. Where i am in 2016 DAMN!

  • @josepadilla9735
    @josepadilla97356 жыл бұрын

    for the moment, the most difficult code i have seen in unity program tutorials. Thanks!

  • @Gwynbleidd27_
    @Gwynbleidd27_3 жыл бұрын

    I don't really know how you came up with this but you are an absolute genius! thank you so much

  • @Jamesthe1
    @Jamesthe18 жыл бұрын

    Thank you! I now have a basic understanding of what "noise" is, and I hope to use this for a lot of games.

  • @analol123
    @analol1238 жыл бұрын

    Thx,thx!!! Sebastian. I really appreciate your efforts for this goods tutorials. Nice job!!!

  • @triangle4studios
    @triangle4studios3 жыл бұрын

    If anyone plays around with the noise settings and notices there is a secondary layer of noise, and wants to know how to control that... Just do something like this: Declare a variable for secondary noise scale however you choose, I did this: [Range(0,10)] public float secondaryScale; and then pass it in to the samples under the loop. This allows for some extra flexibility in creating interesting shapes later on. float sampleX = (secondaryScale * x) / scale * frequency; float sampleY = (secondaryScale * y) / scale * frequency; As always, thank you sebastian!

  • @Sandflakes
    @Sandflakes Жыл бұрын

    7 years later and these are still the best tutorials out there! Great work Sebastian! For anyone watching this now, here is a fix for the parallax seen at 9:04 when changing the offset: float sampleX = ((x - halfWidth) / scale - octaveOffsets[i].x) * frequency; float sampleY = ((y - halfHeight) / scale - octaveOffsets[i].y) * frequency; Note: This also flips the scroll direction in x and y which makes more sense when you are dragging the values in the editor but might break eventual minimap code etc. If you do not desire this just flip the sign again.

  • @colbywinfield

    @colbywinfield

    3 ай бұрын

    Thanks for that! I do prefer the parallax effect though, but man is this comment section a treasure trove!

  • @kotcstudios
    @kotcstudios3 жыл бұрын

    I have just spent the last week going over every terrain generator out there and none of them seem to give me what I want. This series is one of the best I've seen for anyone looking at getting into creating their own generator. Absolutely awesome! Definitely worth a patreon sub! Side note, at 5:50, my texture doesn't have the blacker black areas that the video shows with the same values in the generator. There were only a few values in the noisemap that had a value of I really appreciate the time and effort you put into this, it is definitely the best resource I found for procedural map generation. Thank you!

  • @kotcstudios

    @kotcstudios

    3 жыл бұрын

    Lol, somehow when I reorganized the project, the plane lost my MapMaterial material so it was using the default material. Switching it back to the MapMaterial fixed it so it now shows the correct black values. That was actually pretty funny. I thought it was due to the editor default lighting, directx vs opengl, I was changing all kinds of things trying to fix it! Its ok now though so don't anyone fret! :)

  • @JamieBainbridge
    @JamieBainbridge11 ай бұрын

    This is such a great tutorial. I managed to implement a terrain generator in C and curses with this. It looks so good. Thank you!

  • @whiteline4157
    @whiteline41573 жыл бұрын

    subscribing to your channel is one of the best decisions I've ever made

  • @jay22alco
    @jay22alco7 жыл бұрын

    thanks. been banging my head on the keyboard until I check your vids again. now I got an idea on how to implement this by multiple chunks. hope it will work though.

  • @ChosusQT
    @ChosusQT Жыл бұрын

    I tried this on my C project and IT'S WORK! You are my legend

  • @bubucast
    @bubucast3 жыл бұрын

    That's a very increadible job. Thank you very much!

  • @SustainedDissonance
    @SustainedDissonance8 жыл бұрын

    Your tutorials are the best.

  • @sagitswag1785
    @sagitswag17853 жыл бұрын

    I was working on a procedurally generated 2d top-down game and was using the default Mathf.PerlinNoise texture with no added processing to generate my terrain. Needless to say, it did not look very good. I tried all kinds of solutions, even switching to cellular automaton generation for terrain, and while it looked better, it did not generate infinitely. Using your tutorial my terrain looks even better and is now generated infinitely. Thank you so much for this!

  • @SethDecker89
    @SethDecker898 жыл бұрын

    This is pretty awesome. I was playing around with generating blocks with the map so more granularity in making the noise map is great. Hopefully you go over chunking in the future as that's where I'm stuck when trying to combined the meshes and hit the max vert limit.

  • @SebastianLague

    @SebastianLague

    8 жыл бұрын

    +Seth Decker Chunking will be implemented :)

  • @minecraftyo-gh-oh6405
    @minecraftyo-gh-oh6405 Жыл бұрын

    6 Years Still the Best one ever

  • @danh9676
    @danh96765 жыл бұрын

    I grabbed a bunch of code from github for open simplex noise. I had to remove a bunch of code for 3D and 4D noise, then modified it to make it work. The noise in my implementation is extremely slow. It gives different values than the Unity perlin. When you average the two noises then multiply it by amplitude the results are amazing

  • @collinbarker
    @collinbarker4 жыл бұрын

    Thank you for the great tutorial. Only one that I have been able to find on layering noise to create heightmaps. Currently using it through Java to try to create good Cities Skylines maps. Most on workshop are "my first map" or the really good ones based on a specific location.

  • @PauloHenrique-jr7ir
    @PauloHenrique-jr7ir4 жыл бұрын

    Great content! Thank you very much!

  • @KeenanWoodall
    @KeenanWoodall8 жыл бұрын

    Great tutorial as always! One thing I figured out is that you can ditch the custom editor and call GenerateMap from the OnValidate method. Then it also updates when you undo variables changes.

  • @donutbedum9837

    @donutbedum9837

    3 жыл бұрын

    hey its you who asked the question on cubes terrain generation on unity

  • @antoniokezele909
    @antoniokezele9093 ай бұрын

    Just a note if anyone is trying to implement this in a real game that needs to be chunked or tiled in any way, this works only if your noise texture is generated once and then sampled. Offsetting and changing scale will dramatically change the features in the next tile since the average is being calculated locally and offsets are being offset too much. You can see the artefacts as he scrolls through terrain in the video, it is not continuous terrain. Solution is to first change the offsets so they match the scale : float sampleX = ((x - halfWidth) / scale * frequency) + (octaveOffsets[i].x / scale * frequency); float sampleY = ((y - halfHeight) / scale * frequency) + (octaveOffsets[i].y / scale * frequency); and after that you can either remove the scale (not recommended) or you can calculate the max value globally. Since your noise map outputs 0-1 , you can either use geometric series to pre compute the maxValue, or you can just send a dummy value of 1 through the loop, applying the function, and saving the result as maxValue. Another thing is you want to not scale the terrain -0.5,0.5 if you are not working with Z component, if you are, you need to compute the minValue using the above technique.

  • @dipaknitnawre7581
    @dipaknitnawre75813 жыл бұрын

    Thankyou sebastian league very cool 👍👍👍👍👍👍

  • @johngrey5806
    @johngrey58067 жыл бұрын

    Three thumbs up! Just awesome!

  • @RobinPortnoff
    @RobinPortnoff8 жыл бұрын

    Great tips!

  • @ConnorMoody
    @ConnorMoody8 жыл бұрын

    Once you finish this, you should show us how to add random objects (tree's, etc) in the map as well as a way to use water asset's with this system and if you've ever played rust things like Rad Town's etc.

  • @CurtisJensenGames
    @CurtisJensenGames Жыл бұрын

    11:17 you may know this at this point but putting [Min(1)] next to the public variable will also clamp it there.

  • @mrslake7096
    @mrslake70963 жыл бұрын

    Great work

  • @apemant
    @apemant5 жыл бұрын

    I think maybe the offset should also take scale and frequency into account, like so: float sampleX = ((x - halfWidth) / scale * frequency) + (octaveOffsets[i].x / scale * frequency); float sampleY = ((y - halfHeight) / scale * frequency) + (octaveOffsets[i].y / scale * frequency); This way the offset value will scroll/translate through the perlin noise at each octave's own level of detail.

  • @antoniokezele909

    @antoniokezele909

    3 ай бұрын

    you are a king

  • @patientzerogms
    @patientzerogms8 жыл бұрын

    i have noticed that the offsets are not working well. when you're changing them the noise map is not moving but it looks like a layer of clouds moving at differend speeds - this is because the various octaves are not moving as they they should. fixed it with: float sampleX = x / scale * frequency + octaveOffsets[i].x * frequency; float sampleY = y / scale * frequency + octaveOffsets[i].y * frequency;

  • @patientzerogms

    @patientzerogms

    8 жыл бұрын

    another issue with this is that it will dynamically change the shading due to different minimums and maximums (as they can change as you move around the noise) so I think that inverseLerp should work in a different way.

  • @daluur

    @daluur

    8 жыл бұрын

    Thanks a lot! I couldn't figure out why changing the offset actually changed the scenery, and did not just move it :) this worked perfectly (though I did add sat (x - halfSize) instead of just x (same with y), but it does not really matter)

  • @patientzerogms

    @patientzerogms

    8 жыл бұрын

    +daluur yes, I wrote that comment before the end of the video - before the zooming to center option was added, i also cahnged the whole thing later so it looked like float sampleX = (x - halfSize / scale + octaveOffsets[i].x) * frequency;

  • @daluur

    @daluur

    8 жыл бұрын

    +vooood I think you forgot to put x - halfSize in parenthesis should be ((x - halfSize) / scale + octaveOffsets[i].x) * frequency; But again, thanks, really needed a way to make the map 'the same' regardless of the offset :)

  • @patientzerogms

    @patientzerogms

    8 жыл бұрын

    daluur indeed, i was not copy/pasting from my project and looks like i have missed that. :)

  • @MrZaneMan
    @MrZaneMan4 жыл бұрын

    I don't know how to code, probably never will, probably won't ever get into making games or any kind of simulations, but these videos are super interesting to me for some reason.

  • @Trunks7j
    @Trunks7j8 жыл бұрын

    Thanks for these great tutorials! For clamping the height, you can actually just do: noiseHeight = Mathf.clamp(noiseHeight, minNoiseHeight, maxNoiseHeight)

  • @SebastianLague

    @SebastianLague

    8 жыл бұрын

    +Trunks7j My pleasure. Clamping won't achieve quite the same thing. Think of it as though we want to squash all the data so that it fits within 0;1.

  • @Trunks7j

    @Trunks7j

    8 жыл бұрын

    +Sebastian Lague Oh, i actually meant for line 46 not the normalization function, but i misread your code as (if noiseHeight > max) { noiseHeight = max } -- Sorry about that!

  • @SebastianLague

    @SebastianLague

    8 жыл бұрын

    +Trunks7j Ah, not to worry. Glad you're enjoying the series! :)

  • @fukukyun78
    @fukukyun783 жыл бұрын

    Here's a fun little thing I did, Add this to the editor script, if (GUILayout.Button("Generate Random")) { mapGen.GenerateRandomMap(); } Then add a Generate Random Map method into the Generate Map script, just copy the GenerateMapMethod(I suck so this is what I did lol, probably a cleaner way), and put seed = Random.Range(-10000,10000) at the start. It gives you a second button to generate a randomly seeded map instead of just whatever seed you input :)

  • @NStripleseven

    @NStripleseven

    3 жыл бұрын

    Well that’s cool. Allows you to see different maps easily.

  • @derf6060
    @derf60607 жыл бұрын

    Nice tutorial sir. :)

  • @pAULEE_wORLi
    @pAULEE_wORLi8 жыл бұрын

    thank you.

  • @fyndor
    @fyndor4 жыл бұрын

    I believe there is a flaw in the min/max noise height part of the procedure. Because you used an "else if" for the minimum height part, if the first sample happens to be the minimum value for the entire map, the minNoiseHeight value will never be assigned to that minimum because the first sample will always be greater than the initial maxNoiseHeight value and it will not go in to the minNoiseHeight part of the conditional statement. If you make both parts if statements instead of if/else if then it should correct this flaw.

  • @lukemacri6557
    @lukemacri65574 жыл бұрын

    You can now clean up those messy if checks for if a value is [Min(1)]public int mapWidth;

  • @AgsmaJustAgsma
    @AgsmaJustAgsma3 жыл бұрын

    As great this tutorial is, I have a question: is there a way to update the offset in runtime without relying on the GenerateMap function on every frame?

  • @elzahaby4487
    @elzahaby44874 жыл бұрын

    you're just amazing man i wanna know how do you do those things since a year i wasn't able to understand what do you even saying after a year of hard work and shit now i only can understand and be amazed acctually! xD

  • @carny666
    @carny6663 жыл бұрын

    fantastic.

  • @Skreperiukas
    @Skreperiukas5 жыл бұрын

    When i generate my plate turns black... Any idea?

  • @knightoftheblood1841

    @knightoftheblood1841

    4 жыл бұрын

    I have the same problem. And I have fixed it. It's because there is something wrong in your code, probably in the Noise class.

  • @pie3i940

    @pie3i940

    4 жыл бұрын

    Hey did you ever fix this? I have the same problem

  • @fuhll

    @fuhll

    4 жыл бұрын

    You should set your material texture to none. that worked for me.

  • @Coroebus107

    @Coroebus107

    3 жыл бұрын

    I was running into this as well. In my case, if the Noise Scale variable is close to 0 or negative, the entire plane will be black. Probably something to do with the normalization code.

  • @systemx17
    @systemx176 жыл бұрын

    If am using the latest Beta of Unity and when I add in the OnValidate() stuff - resizing less than 1 in the Editor results in a bunch of errors instead of limiting the value to 1 :(

  • @nationdemon
    @nationdemon6 жыл бұрын

    Last comment an year ago, nevertheless a great tutorial. Thank you very much!

  • @jamauro18
    @jamauro188 жыл бұрын

    Really awesome! can't wait for more, are these coming out twice a week or is it just whenever you can get them done?

  • @SebastianLague

    @SebastianLague

    8 жыл бұрын

    +Joe Mauro Thanks. Twice weekly is the plan, but things are a bit unpredictable at the moment so that may change.

  • @crazyfox55
    @crazyfox558 жыл бұрын

    I find this extremely fascinating. Have you considered changing how the scale should be different for each frequency? Done the way I'm imagining it should look more like your zooming in and out rather than stretching and shrinking. You'll notice when you reduce the noise scale it starts looking like flat noise and when you increase the noise scale it starts looking like one color. Let me know what you think. Thanks for the video.

  • @FacePalmProduxtnsFPP
    @FacePalmProduxtnsFPP6 жыл бұрын

    7:50 It's because 100,000 units is the max width and length of the terrain object.

  • @TeaJayOne
    @TeaJayOne4 жыл бұрын

    Should'nt you multiply the octaveOffsets[i].x and octaveOffsets[i].y with the frequency?

  • @JonathanKanelis
    @JonathanKanelis8 жыл бұрын

    I was wondering if eventually you'd show a way to use this for 2D terrains, and would add editors for the final version of your terrain (provided you may like to move the vertices by hand after the generation).

  • @Ony_mods

    @Ony_mods

    8 жыл бұрын

    +Jonath Kane would love to see this too, hoping! :)

  • @SebastianLague

    @SebastianLague

    8 жыл бұрын

    +Jonath Kane Great suggestion. I'll probably do a spin-off series on 2D terrains (with an editor as you described) after this series is finished.

  • @JonathanKanelis

    @JonathanKanelis

    8 жыл бұрын

    Sebastian Lague Wow haha many thanks !

  • @StephenWebb1980

    @StephenWebb1980

    6 жыл бұрын

    I'm currently working on an implementation using EditorWindows, that also makes use of Temperature maps, Moisture maps, Humidity maps, and Air Pressure maps to generate biomes based on earth climate principles. It will be ready probably in 5 months from the time of this post. The idea is to create a 2D campaign / cartographic map with point of interest features that can be explored in a 3D setting. I'm hoping to use it in a demo game called medieval as a proof of concept.

  • @MrMelonMonkey

    @MrMelonMonkey

    5 жыл бұрын

    @@StephenWebb1980 did you finish it?

  • @projectb6573
    @projectb65732 жыл бұрын

    i have a problem thats not a error in the script but unity says for the MapGenerator script "No overload for method 'GenerateNoiseMap' takes 6 arguments" this makes it so that the Octave, persistance and lacunarity does not show up in Unity and i cant change them.

  • @user-nt8gt8sz2f
    @user-nt8gt8sz2f5 жыл бұрын

    I had an issue where applying the octave offsets caused the code to produce a height map with bumpy square artifacts. If anyone else happens to be struggling with this, I fixed it by modifying the code like so; float sampleX = (octaveOffsets[i].x + x - halfWidth) / scale * frequency; float sampleY = (octaveOffsets[i].y + y - halfHeight) / scale * frequency;

  • @WannabeCanadianDev

    @WannabeCanadianDev

    4 жыл бұрын

    I think this breaks the ability to have scale be centered.

  • @fromptech2210

    @fromptech2210

    3 жыл бұрын

    It does, and it's broken in the official source code as well. To be able to scale the noise for a minimap, I Added a new float variable "zoom" to the function and update the code to be: float halfWidth = (mapWidth*zoom) / 2; float halfHeight = (mapHeight*zoom) / 2; float sampleX = ((x*zoom) - halfWidth + octaveOffsets[i].x) / scale * frequency; float sampleY = ((y*zoom) - halfHeight + octaveOffsets[i].y) / scale * frequency; Not sure if that's correct for other applications, but it works for a minimap.

  • @Hamstray

    @Hamstray

    2 жыл бұрын

    up to 100000 is too high an offset and will give floating point precision problems

  • @oaklai303

    @oaklai303

    2 жыл бұрын

    @@fromptech2210 What is zoom equal to?

  • @Sandflakes

    @Sandflakes

    Жыл бұрын

    A better fix for both the issue with parallax and the scaling is to not apply the scale the the octaveOffset but only the frequency. Also a tiny nice to have is to flip the y offset so that when you drag the value in the editor up and down will be correct. float sampleX = ((x - halfWidth) / scale + octaveOffsets[i].x) * frequency; float sampleY = ((y - halfHeight) / scale - octaveOffsets[i].y) * frequency;

  • @WannabeCanadianDev
    @WannabeCanadianDev7 жыл бұрын

    When I save the scene it blanks the texture with just the default colour of the material (e.g white); is there a way to avoid this?

  • @BarendNieuwoudtZA

    @BarendNieuwoudtZA

    4 жыл бұрын

    This was 3 years ago I know, but people may still be watching this today. I had this problem, and I realized I got the maxNoiseHeight and minNoiseHeight value wrong where they're initialized. should be: float maxNoiseHeight = float.MinValue; float minNoiseHeight = float.MaxValue; anyway, hope this helps somebody scrolling through the comments looking for this

  • @qm3ster
    @qm3ster3 жыл бұрын

    Should the scrolling cause this parallax effect between octaves, or will you fix that later?

  • @Pysassin
    @Pysassin8 жыл бұрын

    Is there a way to connect two noise maps using the same seed next to eachother? I thought that changing the offset appropriate to it's location would work but it doesn't. Any suggestions?

  • @BrianSantosF

    @BrianSantosF

    5 жыл бұрын

    I'm two years late, but if anyone wants this, just change "float sampleX = x / scale * frequency + octaveOffsets[i].x" to "float sampleX = x / scale * frequency + octaveOffsets[i].x * frequency;" and it should connect properly, I believe. It's just that further octaves don't get offset properly if you don't multiply their offset by frequency too.

  • @bombmk2590
    @bombmk259022 күн бұрын

    Excellent tutorial. Clear and concise. One question: The *2-1 operation on the noise is somewhat superfluous, no? It normalises to the same terrain topography in the end - just offset 0.5 down? As in, that can be shifted afterwards if needed? Or if not normalised just sneaks in extra amplitude?

  • @iamseamonkey6688
    @iamseamonkey66884 жыл бұрын

    for some reason my persistance variable isnt working and my noise still looks like blurry static. help.

  • @CurtisJensenGames

    @CurtisJensenGames

    3 жыл бұрын

    Wanna post your code? You did put in that texture line of code thingey, right (I know; I sound like a dummy but I don't want to look it up)

  • @fiore4528
    @fiore45286 жыл бұрын

    first of all excuse my English, but I hope you understand what I mean. Could we store the data map the first time this data is loaded, in order to reload this data exactly with the same values every time? For example in terrain world generation, where the first time the player goes through a certain area of the map, it generates it and then store this information in an array, but once this area information is already stored, it always loads this information. well, I hope you understand "my English" and thanks in advance.

  • @enkimarduk7028
    @enkimarduk70284 жыл бұрын

    Great tutorial up to the point where persistance gets turned into a slider. It didn't work for my version of Unity initially (2019.1.8) but a quick google search revealed a Unity tutorial about sliders in inspector and just modifying [Range(0,1)] to [Range(0f,1.0,)] seems to have made the trick. Moving on to episode 4...

  • @enkimarduk7028

    @enkimarduk7028

    4 жыл бұрын

    @Violet Radd Sorry I missed your question. I hope you found a way around. You just need something like this: [Range(0f,1.0f)] public float persistance;

  • @777redhood
    @777redhood4 жыл бұрын

    Auto update on.. changing value of lacunarity and persistence has no effect on map..if octave is 0 i have no image..if its 1 i have the generated map.. increasing octaves, lacunarity, persistence does not change map at all and it looks the same pls help

  • @bjarnes.4423
    @bjarnes.44236 жыл бұрын

    My Perlin Noise looks pretty repetitive... I don't know if you'll fix this in future episodes.. I this I kind of see a repetitive pattern in your Video too. Its when you zoom out at 10.02, you can see straight lines and repeating bumps. But my pattern looks very tiled. Also I get the weirdest pattern ever on scale 0.000001! Its like a plus! Edit: After copying your code it seems to be fine. I also made a few adjustments to the MapGenerator: private void OnValidate() { if (mapWidth { mapWidth = 1; } if (mapHeight { mapHeight = 1; } if (noiseScale

  • @danieldefrenne920
    @danieldefrenne9208 жыл бұрын

    It's a really nice tutorial ! Everything works fine with the generator but I get a little problem with the texture. I get the right map but with a yellowish color added. Right now I get a yellow-black image and not a black-white map. Can someone help me fix this ? :)

  • @TD-uk9by
    @TD-uk9by6 ай бұрын

    the octave offset also make the perlinValues not symmetric around the center because perlin noise return the same value for coordinates with the same absoluate values, at least that my case

  • @greaterFool3765
    @greaterFool37658 жыл бұрын

    Can you explain to me, where is the point of first modify perlinNoise to get values from -1 to 1 and then bring it back to 0 to 1? Do youd do anything with the height Value where you need it to be negative?

  • @matchuhuki

    @matchuhuki

    8 жыл бұрын

    Yeah I'm wondering the same thing

  • @matchuhuki

    @matchuhuki

    8 жыл бұрын

    Nevermind it's to potentially reduce the noiseHeight and afterwards the noiseHeight gets clamped. I don't know why I didn't realise that.

  • @matchuhuki

    @matchuhuki

    7 жыл бұрын

    Well if it's a negative. It reduces the overall height. And afterwards it gets clamped. If it's always positive it can only go up with each octave.

  • @wylie2835

    @wylie2835

    7 жыл бұрын

    Im 11 months late. But this allows the ground to look like it "dips". If you didnt modift perlinNoise the first time and continued with the rest of the video it would look like mountains rise from a very clear bottom level.

  • @changedev.198
    @changedev.1983 жыл бұрын

    Chills!

  • @sargeant6274
    @sargeant62742 жыл бұрын

    You are realy amazing

  • @dianabanana3596
    @dianabanana35967 жыл бұрын

    Getting this error. Does anyone know why? IndexOutOfRangeException: Array index is out of range. Noise.GenerateNoiseMap (Int32 mapWidth, Int32 mapHeight, Int32 seed, Single scale, Int32 octaves, Single persistance, Single lacunarity, Vector2 offset) (at Assets/Scripts/Noise.cs:46) MapGenerator.GenerateMap () (at Assets/Scripts/MapGenerator.cs:23) MapGeneratorEditor.OnInspectorGUI () (at Assets/Editor/MapGeneratorEditor.cs:19) and it points to this line : float sampleX = (x - halfWidth) / scale * frequency + octaveOffsets[i].x;

  • @nicolaihoegsbjerg
    @nicolaihoegsbjerg Жыл бұрын

    The persistance value for me, does not change anything on the map. What am i doing wrong?

  • @nightyonetwothree
    @nightyonetwothree2 жыл бұрын

    didnt get the point of multiplying perlinValue by *2 and subtrackting -1 as we'll clamp it to 0:1 range in lerp function. Am i missing something?

  • @joelwakefield3655
    @joelwakefield36556 жыл бұрын

    My mapwidth and mapheight dont change correctly- when I adjust them. Its hard to describe, butv they just kind of slide around. Help?

  • @N1ghtR1der666

    @N1ghtR1der666

    4 жыл бұрын

    bit late but this will fix that : float sampleX = ((x - halfWidth) / scale + octaveOffsets[i].x) * frequency; float sampleY = ((y - halfHeight) / scale + octaveOffsets[i].y) * frequency;

  • @andrewearl8926
    @andrewearl89262 жыл бұрын

    Ok does anyone know how his material gets more detailed with lacunarity? My code just seems to squish itself horizontally... And make a lot of vertical lines...

  • @WindBendsSteel
    @WindBendsSteel5 жыл бұрын

    why set the min and max height values inside the loop? if they are consistent couldn't they be assumed as -1 and 1 for the inverse lerp method and thus use the inverse lerp in the return line directly?

  • @anysdev

    @anysdev

    5 жыл бұрын

    Because the min and max can go below 0 and above 1 when you are layering the octaves. For example with a high frequency you could find you get 0.8 for octave 1, 2 and 3 which when added together would give you 2.4. The same can happen in negative. Also imagine if you had an amplitude of 1000 instead of 1, then you would have 2400. It doesn't matter how big or small the numbers go when you are sampling the points, as long as you bring everything back between 0 and 1 at the end while maintaining the proportions.

  • @liangmeng5952
    @liangmeng5952 Жыл бұрын

    For the map mat, I was skipping around and must've skipped the part where he applied a material to the map mat. I couldn't find where he applied it in the video so could can someone please tell me how to or where?

  • @thepragmatist5741
    @thepragmatist57414 жыл бұрын

    Soon as I add in the halfwidth and half height, my map becomes tiled, its each slightly different but broken into a quadrant, perfect for a 4 player RTS game, but not what I wanted to get. Please help if anyone knows what i am not seeing.

  • @marcus25812
    @marcus258122 жыл бұрын

    Im doing these tutorials and for some reason my plane is just black no matter what i change in the inspector. I also get an error (index was outside the bounds of the array) although i copied the code exactly the same way. Can anyone help me?

  • @blaster47974

    @blaster47974

    Жыл бұрын

    i have same issue did you figure it out?

  • @marcus25812

    @marcus25812

    Жыл бұрын

    @@blaster47974 sorry no lol i stuck to 2d for the time

  • @dasdadwaswad7358
    @dasdadwaswad73584 жыл бұрын

    You somehow make one of the most boring subjects in the world interesting, keep up the good work!

  • @dayhawkify
    @dayhawkify2 жыл бұрын

    mine worked from the last video, but after following this one to see if it worked i got a pitch black plane. turns out i was watching on lower quality so i was getting * and = mixxed up in some places, so it turnes out that when you code noiseHeight += perlinValue = amplitude; you get a black texture instead of noiseHeight += perlineValue * amplitude; which is what you did and said you did

  • @voidling2632
    @voidling26323 жыл бұрын

    10:50 its easier to add a [Min (1)] attribute to your variable.

  • @Mouton_redstone
    @Mouton_redstone3 жыл бұрын

    when i change the width or height, i have an error message till they are egals

  • @MrXander032
    @MrXander0327 жыл бұрын

    I was having trouble with the "Plane" object showing default material rather than the noise "Map Material", after going thought the noise script letter by letter, I found that on the 2nd last line which reads "noiseMap [x, y] = Mathf.InverseLerp (minNoiseHeight, maxNoiseHeight, noiseMap [x, y]);" i had written "(minNoiseHeight, minNoiseHeight, noiseMap [x, y])" while using the auto complete. Defiantly makes you think but its all very logical :D

  • @andreadst
    @andreadst7 жыл бұрын

    Hi! Thanks for the videos! somehow the line the InverseLerp returns 0.5f for all values (I'm at the middle of the video, can't reproduce what you have at 5:40 because of this). Any clue on why that would happen (all the other input values appear to be correct)? noiseMap[x, y] = Mathf.InverseLerp(minNoiseHeight, maxNoiseHeight, noiseMap[x, y]);

  • @Daednumai

    @Daednumai

    7 жыл бұрын

    Same problem here

  • @andreadst

    @andreadst

    7 жыл бұрын

    Found it (for me). In my case the following code was the problem (this is the correct one): float maxNoiseHeight = float.MinValue; float minNoiseHeight = float.MaxValue; I inverted float.MinValue and float.MaxValue. I still don't understand exactly why this is setup as it is (*maybe Sebastian can pitch in and explain?*)

  • @pololabete

    @pololabete

    7 жыл бұрын

    Finding the max value (or the min) of an array starts with initializing the variable with the smallest value possible float maxNoiseHeight = float.MinValue; This is the only way to make sure you program will find a value in your array that is larger than the smallest one.

  • @jinxshaddix

    @jinxshaddix

    7 жыл бұрын

    Thanks, had exactly the same problem. Cheers

  • @andreadst

    @andreadst

    7 жыл бұрын

    Thanks for the explanation pololabete!

  • @AllyG1967
    @AllyG19677 жыл бұрын

    I'm loving this series as well but have come stuck at 8:55 - the seed section. I don't have the seed slider in the inspector. Obviously I've done something but I can't track it. The error in unity says " scripts/mapGenerator.cs(20, 29): error CS1501: no overload for method 'GenerateNoiseMap' takes '8' arguments" but I have all 8 in the brackets. I don't get the offset adjusters either. Can somebody read minds and suggest some magic for me please

  • @SebastianLague

    @SebastianLague

    7 жыл бұрын

    +Alister Gray That error message means that there should NOT be 8 parameters. Go check the method definition and make sure the parameters you're passing in match up correctly with the method's arguments.

  • @JDoucette
    @JDoucette3 жыл бұрын

    Offset -100,000 to 100,000 works, but no larger, since float only has 6-7 decimal digits of accuracy. You're dealing with fractions of numbers after this. 100,000 is already using up 5 decimal digits, but you're requesting 6, 7, or more. (E.g. 10 million + 1 in float will still be exactly 10 million.)

  • @AndersAstrand
    @AndersAstrand Жыл бұрын

    The else at approx 3:51 will make it so that if the first value generated is the lowest, the normalization will fail. (as the first value will be both the highest and the lowest value seen so far regardless of value, it needs to update both). It should just be a separate if statement.

  • @TheProGamingWolf
    @TheProGamingWolf6 жыл бұрын

    noiseMap[x, y] = Mathf.InverseLerp(minNoiseHeight, maxNoiseHeight, noiseMap[x, y]); This is making my plane come out just pure white in texture.

  • @matthewwilson5249

    @matthewwilson5249

    5 жыл бұрын

    Make sure you're initializing the minNoise as float.Max and maxNoise as float.Min.

  • @Kombi-1
    @Kombi-17 жыл бұрын

    Soo interesting

  • @raik1766
    @raik17662 жыл бұрын

    Its probably just me being dumb but changing the octaves seems to just mess up my noise instead of changing it

  • @casssaph2287
    @casssaph22874 жыл бұрын

    man i honestly dont understand any of the maths behind this but im copying it in lua and its working for me so like, hey, whatever works, right? thanks for the tutorials, appreciate it.

  • @karthikle-4087
    @karthikle-40873 жыл бұрын

    I getting an errror, indexOutOfRangeException: How can i slove this?

  • @StigDesign
    @StigDesign8 жыл бұрын

    awsome :D

  • @1993edddie
    @1993edddie8 жыл бұрын

    im having a little bug it seems like my texture wont "zoom" in like it should it just stays so fuzzy like old tvs without the cable connected

  • @1993edddie

    @1993edddie

    8 жыл бұрын

    like i reviewed the video like 5 times but no luck im having no errors nor have any of my scripts missing anything or mistyps

  • @lukemcmahon273
    @lukemcmahon2738 жыл бұрын

    Would you consider teaching networking code? Just curious as I think that could be helpful for a lot of people. :)