12 第1页 | 共2 页下一页
返回列表 发新帖
查看: 2826|回复: 14
打印 上一主题 下一主题

脚本生成矩阵效果

[复制链接]

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

跳转到指定楼层
楼主
发表于 2011-8-12 10:57:19 |只看该作者 |倒序浏览
非常有用的一个效果,用代码来实现动态矩阵效果,用来做一些视觉特效还是非常好的,下面是原贴!

Small update; Faster, removed the yields in the script as well, although it stops unity while the script is thinking. For a terrain using default settings (calculating 131,072 points), it should be created in under 2 minutes; still very slow, between 1000 & 1200 points per second.

I found some extra time these past couple of days, and decided I'd play with Unity for a bit. I figured that I'd come up with a procedural terrain system allowing overhangs, tunnels, etc.

I started last night, and got some of it working this morning. I began by looking up perlin noise, and making my own implementation of 3d perlin noise (or something similar) using the now-accessible multi-dimensional builtin arrays.

I have it working, but it is incredibly slow, as it always seems to be with codes in the first little while after writing them. Also, I'm making the terrain out of cubes, which means that it resembles minecraft a lot (hopefully I can change this by using something similar to marching cubes, and then smoothing).

It does work very similarly to minecraft, in that they both use 3d perlin noise. I also decided to generate terrain in blocks, because it seems to be the only feasible method to generate terrain in real time and save it (I'm still not there yet).

Well, I'm posting it in this early stage because I figure it could be a useful start for others who might know a lot more about this type of thing than me. I'm also not sure how much time I'll have in the next little while to improve it.

More notes can be found in the script itself.



Some blocky terrain generated by the script (cubes are prefabs)



Overdraw view of perlin noise (not terrain, see notes in script)

Settings:

Terrain Blocks : The amount of blocks in the x & y directions the script creates. (4 would be a 4x4 grid of terrain blocks)

Cube : A cube prefab goes here.

Detail Size : The distance between integral areas, or at least that's how I like to describe it. Basically, the size of the noise. (since it's not limited to a terrain size)

Persistence : How noisy the terrain will be. (persistence in Perlin noise)

Octaves :Amount of iterations it goes through, in which size and persistence change each iteration. (octaves in Perlin noise)

Terrain Size : The length and width of a terrain block; the total size of the terrain is (Terrain Size)^2*(Terrain Blocks)^2.

Terrain Height : The maximum height of the terrain (average height is half of this)

Seeded : The random terrain seed. The same seed will always generate the same terrain
分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

5472

主题

6

听众

1万

积分

版主

Rank: 7Rank: 7Rank: 7

纳金币
76544
精华
23

活跃会员 荣誉管理 突出贡献 优秀版主 论坛元老

沙发
发表于 2011-8-12 15:47:50 |只看该作者
WHERE ARE THE PICTURES?
回复

使用道具 举报

5

主题

1

听众

202

积分

设计实习生

Rank: 2

纳金币
178
精华
0

最佳新人

板凳
发表于 2011-8-12 17:40:22 |只看该作者
图片呢?真懒,传一下会咋的?
回复

使用道具 举报

Asen    

867

主题

0

听众

1万

积分

外协人员

Rank: 7Rank: 7Rank: 7

纳金币
17488
精华
1
地板
发表于 2011-8-15 14:01:52 |只看该作者
图 挂了~
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

5#
发表于 2011-12-30 18:24:14 |只看该作者
沙发不解释
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

6#
发表于 2012-2-6 23:22:48 |只看该作者
我是老实人,我来也!
回复

使用道具 举报

tc    

5089

主题

1

听众

33万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

7#
发表于 2012-2-18 23:26:21 |只看该作者
“再次路过……”我造一个-----特别路过
回复

使用道具 举报

5969

主题

1

听众

39万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

8#
发表于 2012-4-25 23:27:22 |只看该作者
赞一个,哈哈
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

9#
发表于 2012-5-19 23:19:28 |只看该作者
你们都躲开,我来顶
回复

使用道具 举报

462

主题

1

听众

31万

积分

首席设计师

Rank: 8Rank: 8

纳金币
2
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

10#
发表于 2012-6-2 23:22:25 |只看该作者
发了那么多,我都不知道该用哪个给你回帖了,呵呵
回复

使用道具 举报

12 第1页 | 共2 页下一页
返回列表 发新帖
您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2024-11-10 18:30 , Processed in 0.097156 second(s), 29 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部