• Unity3D - Discussion
    5,004 replies, posted
[QUOTE=nVidia;40830731]Your geometry is pretty problematic, also have you lowered your max shadow distance as low as possible, and are you using high resolution shadow maps?[/QUOTE] I have. I've been looking into recreating the effect of [IMG]https://lh3.googleusercontent.com/xLsYHzNpBEagFJPm6eWKXldnmQqgHFik9yProxSa23SmpsRh1AV8qqQyxkcq0gqpF71T2su7Te0Oqd_Gy5_vNu1YHIKnIKbg3E468yU9UctDtWSO6fw9WNOYMg[/IMG] If you want to provide some insight on how to best recreate that image, feel free :v:
[QUOTE=Asgard;40830756]I have. I've been looking into recreating the effect of [IMG]https://lh3.googleusercontent.com/xLsYHzNpBEagFJPm6eWKXldnmQqgHFik9yProxSa23SmpsRh1AV8qqQyxkcq0gqpF71T2su7Te0Oqd_Gy5_vNu1YHIKnIKbg3E468yU9UctDtWSO6fw9WNOYMg[/IMG] If you want to provide some insight on how to best recreate that image, feel free :v:[/QUOTE] I probably wouldn't use dynamic shadows at all and instead bake a nice skylight light maps with AO. That would probably look a lot like the picture.
[QUOTE=nVidia;40830790]I probably wouldn't use dynamic shadows at all and instead bake a nice skylight light maps with AO. That would probably look a lot like the picture.[/QUOTE] Excuse my ignorance, but is that possible with randomly generated terrain?
[QUOTE=Asgard;40830904]Excuse my ignorance, but is that possible with randomly generated terrain?[/QUOTE] Yes. You just have to bake it yourself.
I can't find anything on how to rebake the maps after generating terrain.
[QUOTE=Asgard;40831266]I can't find anything on how to rebake the maps after generating terrain.[/QUOTE] I think it has to be done offline.
Oh, I see. So I'd need a way to save the transformed mesh. True random generation doesn't matter for me anyways, seeing as that's not a goal of mine. [editline]29th May 2013[/editline] Or use SSAO [editline]29th May 2013[/editline] Although it's looking pretty bad :v: [url]http://i.imgur.com/lFrQS9S.png[/url]
[QUOTE=Asgard;40831408]Oh, I see. So I'd need a way to save the transformed mesh. True random generation doesn't matter for me anyways, seeing as that's not a goal of mine. [editline]29th May 2013[/editline] Or use SSAO [editline]29th May 2013[/editline] Although it's looking pretty bad :v: [url]http://i.imgur.com/lFrQS9S.png[/url][/QUOTE] Yep, it's ugly and adds tons of drawcalls.
I can't seem to get the lighting right. I recalculate the normals after generating. [IMG]http://i.imgur.com/HEdvxW1.png[/IMG] And this happens [IMG]http://i.imgur.com/N6UlULP.png[/IMG] How about a small shader that averages the color on the polygon and applies it? Almost like cel shading [editline]30th May 2013[/editline] We're getting somewhere [URL]http://i.imgur.com/dIBPFss.jpg[/URL] [editline]30th May 2013[/editline] Now, this is odd. Shadow distance 0: [URL]http://i.imgur.com/VaRqYR3.jpg[/URL] Shadow distance halfway on the screen: [URL]http://i.imgur.com/bGiJW5f.jpg[/URL] Shadow distance same halfway, Receive/Cast shadow on map turned ON: [URL]http://i.imgur.com/HwfR8PC.jpg[/URL]
I think your problem is that you're using shared vertices, that's why they appear smooth because unity uses vertex normals in the lighting calculation, you should instead use unique vertices for each triangle.
[QUOTE=nVidia;40838421]I think your problem is that you're using shared vertices, that's why they appear smooth because unity uses vertex normals in the lighting calculation, you should instead use unique vertices for each triangle.[/QUOTE] That must be it :v: Now to figure out how [editline]30th May 2013[/editline] [img]http://i.imgur.com/mnuWZTM.png[/img] <3
Oooh, how did you do that?
[QUOTE=Eric95;40838571]Oooh, how did you do that?[/QUOTE] Lightmap ( [url]http://i.imgur.com/dURHU1J.png[/url] Note: I just played around with the settings, they're probably awful ), Directional light ( [url]http://i.imgur.com/hYzlIeH.png[/url] Also probably awful ), making all the vertices unique (very important!), a perlin noise heightmap and some random movement on the vertices on all axis. Also playing around with all the settings for two days.
[QUOTE=nVidia;40830487]I made you this little script that is probably 100 times neater than the original and does pretty much the same thing. This should give you an idea how this works. [/QUOTE] Thanks for sharing, I once coded some minecrafty block generation thingy in unity too but nothing as far as actual terrain generation with perlin noise etc, just some blocks, so I was curious, I thought you were generating meshes on the fly, however it seems these are just cubes, do you have some occlusion culling? or do all the cubes have 6 quad faces rendering at all times? I am just asking because from what I tested, I ended up getting too many triangles than really needed to render the terrain by using cubes :S I also had to use dynamic batching to reduce the draw calls. I am mainly wondering what triangles counts and fps you get by spawning cubes like that, or do you have some way to optimize it?
[QUOTE=BANG!;40839304]Thanks for sharing, I once coded some minecrafty block generation thingy in unity too but nothing as far as actual terrain generation with perlin noise etc, just some blocks, so I was curious, I thought you were generating meshes on the fly, however it seems these are just cubes, do you have some occlusion culling? or do all the cubes have 6 quad faces rendering at all times? I am just asking because from what I tested, I ended up getting too many triangles than really needed to render the terrain by using cubes :S I also had to use dynamic batching to reduce the draw calls. I am mainly wondering what triangles counts and fps you get by spawning cubes like that, or do you have some way to optimize it?[/QUOTE] No I don't have anything fancy like that, but the real way of doing minecraft terrain would be to generate the meshes, combine them per material and render only the visible faces. I just don't have the skills to do it properly. :v:
[QUOTE=nVidia;40839418]No I don't have anything fancy like that, but the real way of doing minecraft terrain would be to generate the meshes, combine them per material and render only the visible faces. I just don't have the skills to do it properly. :v:[/QUOTE] Oh, same here, when I coded something like that cube generation I used cubes too but I soon figured out that wouldn't be the right way to go since all the cube faces are being rendered but are useless since hidden under the terrain :pwn: I guess mesh generated by code is the way to go :/ thanks for clearing that up though, I was just hoping for some magic optimization trick that wouldn't involve coding mesh generation since I wanted complex/detailed meshes for the cubes.
So far so good, landscapes are looking organic. But now I'd like to have another pass of perlin noise for a more general shape to create mountains and valleys. A less rough one. Smart suggestions on how to tackle that? I'll probably need to rely less on the built-in Mathf.PerlinNoise as it doesn't allow the tweaking of frequency/amplitude afaik.
[QUOTE=Asgard;40841755]So far so good, landscapes are looking organic. But now I'd like to have another pass of perlin noise for a more general shape to create mountains and valleys. A less rough one. Smart suggestions on how to tackle that? I'll probably need to rely less on the built-in Mathf.PerlinNoise as it doesn't allow the tweaking of frequency/amplitude afaik.[/QUOTE] Getting fractal perlin noise is actually pretty easy from regular perlin noise: [code] float total = 0f; float octAmplitude = amplitude; float freq = frequency; for (int i = 0; i < octaves; i++) { total += Noise(x * freq, y * freq) * octAmplitude; octAmplitude *= persistence; freq *= 2; } return total; [/code] where: octaves = number of iterations amplitude = scales the noise height frequency = how "zoomed in" you are. Typically this value is a really small number persistance = how much each octave contributes to the total height. This value is typically [0, 1]. If you want just frequency/amplitude control, just take the first line of the for loop.
[QUOTE=robmaister12;40842200]Getting fractal perlin noise is actually pretty easy from regular perlin noise: [code] float total = 0f; float octAmplitude = amplitude; float freq = frequency; for (int i = 0; i < octaves; i++) { total += Noise(x * freq, y * freq) * octAmplitude; octAmplitude *= persistence; freq *= 2; } return total; [/code] where: octaves = number of iterations amplitude = scales the noise height frequency = how "zoomed in" you are. Typically this value is a really small number persistance = how much each octave contributes to the total height. This value is typically [0, 1]. If you want just frequency/amplitude control, just take the first line of the for loop.[/QUOTE] [img]http://i.imgur.com/U40psU6.png[/img] [editline]30th May 2013[/editline] I was very close to your solution :v: [editline]30th May 2013[/editline] Combined with my previous single small scale noise pass [img]http://i.imgur.com/uc1XGu1.png[/img] [editline]30th May 2013[/editline] [img]http://i.imgur.com/toJf22p.png[/img] :v:
Well one thing that strikes me in that artwork that you don't have yet is that in the artwork it clearly is several meshes with different colors overlapped, which gives for less rectilinear edges and more of organic shapes when triangles with different colors overlap, like in these spots: [IMG]http://puu.sh/34CDK/13c0f2f2a7.jpg[/IMG]
Combining the same high level pass with multiple different small level passes should get that effect quite nicely.
[img]http://i.imgur.com/KulB2H8.png[/img] Having too much fun with this
A bit of a exaggerated example, but something like this? [t]http://i.imgur.com/ptwKaa6.png[/t] It's a lot of tweaking to get that just right :v: [editline]31st May 2013[/editline] Or the other way around :v: [t]http://i.imgur.com/EziYfYb.jpg[/t] [editline]31st May 2013[/editline] Harsh compression by imgur Or grassy fields because why not (I actually think this looks better) [t]http://i.imgur.com/850i4tu.png[/t]
Some more because I can't stop [t]http://i.imgur.com/1j10MVz.png[/t]
Try the first one or second one with close together colors (green, dark green)
I don't fully grasp tiling fractal noise, but would tiling be possible while changing frequency/amplitude on different nodes?
[QUOTE=Asgard;40855401]I don't fully grasp tiling fractal noise, but would tiling be possible while changing frequency/amplitude on different nodes?[/QUOTE] Nope. The idea is that the noise is "coherent" when you have the same fractal settings. This means that the noise is continuous (-infinity, infinity) on all axes. So when you have, say, 128x128 tiles, you can sample the noise from (127, 128) and know that there won't be a discontinuity anywhere between y=127 and y=128.
[QUOTE=robmaister12;40867212]Nope. The idea is that the noise is "coherent" when you have the same fractal settings. This means that the noise is continuous (-infinity, infinity) on all axes. So when you have, say, 128x128 tiles, you can sample the noise from (127, 128) and know that there won't be a discontinuity anywhere between y=127 and y=128.[/QUOTE] So, what'd be better. Generating giant noise maps or finding some way to interpolate between maps? [editline]1st June 2013[/editline] Or rather, a noise map for the world's elevation, a map for the rougher detail, and noise for the local displacement.
[QUOTE=Asgard;40867291]So, what'd be better. Generating giant noise maps or finding some way to interpolate between maps? [editline]1st June 2013[/editline] Or rather, a noise map for the world's elevation, a map for the rougher detail, and noise for the local displacement.[/QUOTE] Well the idea of fractal Perlin noise is that you multiply together several layers of Perlin noise with different frequencies and amplitudes, so that you get larger features and smaller details together. If you blend together two separate coherent forms of noise, the result is still coherent. I would either change the settings of the fractal Perlin noise generator to start off with a tiny frequency and have a lot of octaves, or find two or more separate types of coherent noise that you blend together. And with coherent noise, you can just place one heightmap next to another and the edges will line up, no need to interpolate or anything. [editline]1st June 2013[/editline] Oh and something I forgot to mention explicitly earlier, Perlin noise is only coherent if you keep the same settings.
So I jumped into perlin and made this voxel thing, few questions. How can I optimise this so I only render faces visible, because generating a 150x150 world of normal blocks makes me reach around 15 fps (which is expected). How can I make Mathf.PerlinNoise random on each run, it seems to use the same seed each time I run the scene. [img]http://i.imgur.com/9R1RZQL.png[/img]
Sorry, you need to Log In to post a reply to this thread.