c# - How to use noise to generate varied terrain biome style -


i'm using value noise believe called in combination fractal brownian motion generate terrain in 3d environment. generate 2d height-map noise, values ranging between -1 , +1. typically multiply return value 10 or set height , generates rolling hills.

what i'd somehow combine calls algorithm have areas hilly, others quite flat, while mountainous. how go without having edges between areas extremely obvious (like jutting cliffs segregating them)?

edit: needed procedural in near infinite environment.

based on ananthonline's answer, i'm taking low frequency call noise generator mask. 2 biome types, take 'impact' of biome, subtract absolute value of mask value minus 'location' on mask, , divide whole value 'impact' value again.

(impact- abs(mask - location)) / impact

that gives me value when positive, can multiply towards return value of specific noise call specific frequencies, amplitudes, etc (such rolling hills or mountains or ocean).

the primary issue here if mask returned values of 0 through 1 example, i'd need (in 2 biome scenario) set 1 biome's location .25 , other .75 strength of .5 each them blend properly. @ least, if wanted distribution of each biome type , blend them properly. i'd struggle quite bit if wanted, say, mountains show twice rolling hills.

i hope makes sense. math works out fantastically, don't think i'm explaining limited mathematics background , knowledge. maybe code (if cruddy uncommented code means someone), note getnoise2d returns values between 0 , 1:

    float getheight(float x, float z)     {         float frollinghills_location = .25f, frollinghills_impact = .5f, frollinghills = 0;         float fmountains_location = .75f, fmountains_impact = .5f, fmountains = 0;          float fmask = getnoise2d(0, x, z, 2, .01f, .5f, false, false);         float frollinghills_strength = (frollinghills_impact - math.abs(fmask - frollinghills_location)) / frollinghills_impact;         float fmountains_strength = (fmountains_impact - math.abs(fmask - fmountains_location)) / fmountains_impact;          if (frollinghills_strength > 0)             frollinghills = frollinghills_strength * (getnoise2d(0, x, z, 2, .05f, .5f, false, false) * 10f + 25f);          if (fmountains_strength > 0)             fmountains = fmountains_strength * (getnoise2d(0, x, z, 2, .1f, .5f, false, false) * 25f + 10f);          return frollinghills + fmountains;     } 

if problem above code needs specified, let 10 different biomes require extreme thought put exact 'location' , 'impact' values ensure blending flawless. i'd rather code in such way ensure that's taken care of.

how generating low frequency noise (white-black) in texture 1/8th or smaller terrain texture, blurring , using mask blend 2 heightmaps (perhaps part of rendering algorithm itself)?

note can paint "blending" texture hand, allowing fine control of cliffs vs smooth transition areas (sharper edges vs blurry edges).


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -