Day2:接着思考和可能的策划
今天早上闹钟还没响呢,老婆就把我叫醒了~说有规律宫缩了!
7点到8点记录了一个小时,宫缩差不多5~6分钟一次!
赶紧收拾东西上医院!正好今天是40周的产检,今天还是预产期!
这孩子终于肯出来了!
结果到了医院,做完检查,
大夫说:
大人孩子都没什么问题,不过虽然有宫缩了,但是还不够强烈~
宫颈也还不成熟,今天还生不了,打催产都未必能引下来,还白白受罪~
还是回家再等等吧~
结果老婆就哭着又回来了~
倒不是因为今天生不了哭~
她也真是太痛苦了~肚子疼,腿疼,胯骨疼,耻骨疼~
各处都疼~睡觉也睡不踏实,吃饭也吃不下去~
桃子(孩子小名)也真是太拧了~
按我妈的话说:这孩子跟妈太亲了,不想出来~
这个也真是没什么办法了~现在只能等了...
最好孩子再过个两三天就出来,别真的等到41周去催产~
到时候大人孩子都痛苦~
-----------------------------------------朴实的分割线----------------------------------------------
之前两天,一直在玩《地下城堡》,一个放置类游戏,还真是挺上瘾的。
当时还特意去网上搜集了一下关于《地下城堡》的数据,感觉做这个游戏的人还真是够牛逼~
全是玩的小数值,不像现在很多游戏,动不动砍一刀就500、600血就出去了~
其实这种游戏还是挺有可玩性的,我连当时出的那个愚翁移山都玩了N长时间,
把所有东西都买满了~
像《Minecraft》里面的种植系统我觉得也应该可以算是放置元素~
今天打算开始弄策划~用我以前写的策划修改,基本是基于《Minecraft》的游戏风格,
但是要把像素风格改掉,倒不是因为我讨厌像素风格,
我只是觉得要是还是延续像素风格,可能会有很多东西或者细节就没法表现了!
现在先去陪老婆吃饭去~晚上有时间就整理一下策划文案,再发上来!
--------------------------------老实本分的分割线--------------------------------
我的策划~失踪了~找不到了~可能换过的电脑太多了~
连我自己也不知道到底存到哪里去了...
N多个U盘,N多个移动硬盘~
倒是找到一个当年公司的一个大神做的工具插件~
不过已经太早了,都好几年前的了~
晚上看看,稍微整理一下~
当年用的时候可是觉得很爽的!
-------------------------------迟到的分割线-----------------------------------
找到了以前写的模拟《Minecraft》的地形生成~使用的柏林噪音~
乍一看是那个意思,不过这个只是生成了地表~而且基本上就是平原~
地下要咋整?高山要咋整~溶洞要咋整~矿洞要咋整~
要考虑的东西还有很多~
上一小段代码(关于生成地形的):
using UnityEngine;
using System.Collections; public class createTerrain : MonoBehaviour { public GameObject _Block; void Start() {
GameObject _Terrain = new GameObject("Terrain");
_Terrain.transform.position = Vector3.zero;
for (int i = ; i < ; i++)
{
for (int j = ; j < ; j++)
{
int l = (int)(Mathf.PerlinNoise(i* 0.1369f,j*0.15643f) * );
GameObject block = Instantiate(_Block, new Vector3(i, l, j), Quaternion.identity) as GameObject;
block.transform.GetChild().gameObject.tag = "Block";
block.transform.parent = _Terrain.transform;
}
}
}
}
-----------------------------又一个分割线-----------------------------
我竟然找到了我之前翻译一半的柏林噪音的介绍~
我觉得我应该接着往下翻译下去~不知道有没有大神翻译过~
先把现在翻译的放上来~英语能力有限~有的话有点语无伦次~
等都翻译出来,再单独弄一个随笔吧~
(学习英语很重要啊!好多资料都是英文的,还都是专业名词!看起来很困难!I hate English!)
原地址:http://freespace.virgin.net/hugo.elias/models/m_perlin.htm
以下是翻译:
Perlin Noise柏林噪音
Many people have used random number generators in their programs to create unpredictability, make the motion and behavior of objects appear more natural, or generate textures. Random number generators certainly have their uses, but at times their output can be too harsh to appear natural. This article will present a function which has a very wide range of uses, more than I can think of, but basically anywhere where you need something to look natural in origin. What's more it's output can easily be tailored to suit your needs.
许多人在程序中使用随机数发生器的不可预知性来创建更自然的行为动作或者生成纹理。随机数发生器当然有其用途,不过有时他的输出结果过于苛刻,以至于显得不太自然。本文将展示一个函数,该函数有超乎我们想象的广泛用途,基本上可以应用到你需要的所有部分,更重要的是它可以方便地根据自己的需要定制输出。
If you look at many things in nature, you will notice that they are fractal. They have various levels of detail. A common example is the outline of a mountain range. It contains large variations in height (the mountains), medium variations (hills), small variations (boulders), tiny variations (stones) . . . you could go on. Look at almost anything: the distribution of patchy grass on a field, waves in the sea, the movements of an ant, the movement of branches of a tree, patterns in marble, winds. All these phenomena exhibit the same pattern of large and small variations. The Perlin Noise function recreates this by simply adding up noisy functions at a range of different scales.
如同你看到的很多自然界的东西,你会发现他们都有各自的形态且有很详细的层级划分。在此我们以山脉为例,高度差异较大(山岭),高度差异中等(丘陵),高度差异小(巨石),高度差异极小(石头)等等……。其实几乎所有的东西都存在这个现象:地上零星的小草,海浪,一个蚂蚁的移动,树杈的长势,大理石的花纹样式,风。所有这些大大小小的差异现象都展示了相同的模式。柏林噪音函数可以重现这些现象,而你要做的就是在不同尺寸的范围内计算噪音函数。
To create a Perlin noise function, you will need two things, a Noise Function, and an Interpolation Function.
创建一个柏林噪音函数你需要两样东西:噪音函数和差值函数。
Introduction To Noise Functions 噪音函数介绍
A noise function is essentially a seeded random number generator. It takes an integer as a parameter, and returns a random number based on that parameter. If you pass it the same parameter twice, it produces the same number twice. It is very important that it behaves in this way, otherwise the Perlin function will simply produce nonsense.
噪音函数本质上是一个种子随机数发生器。他使用一个整数作为参数,并返回一个基于这个参数的随机数字。如果你传递相同的参数两次,则他也会生成相同的参数两次。这点非常重要,否则柏林函数只能是无稽之谈。
Definitions 定义
Before I go any further, let me define what I mean by amplitude and frequency. If you have studied physics, you may well have come across the concept of amplitude and frequency applied to a sin wave.
在此之前,我们先来定义一下振幅和频率。如果你学过物理,那么你应该见过正玄波的振幅和频率。
Creating the Perlin Noise Function创建柏林噪音函数
Now, if you take lots of such smooth functions, with various frequencies and amplitudes, you can add them all together to create a nice noisy function. This is the Perlin Noise Function.
现在,如果你有很多不同振幅、不同频率的平滑函数,那么你可以把他们加到一起,做出一个不错的噪音函数。 这就是柏林噪音函数。
You can, of course, do the same in 2 dimensions.
当然在2D中也可以这样。
Persistence 持久性
When you're adding together these noise functions, you may wonder exactly what amplitude and frequency to use for each one. The one dimensional example above used twice the frequency and half the amplitude for each successive noise function added. This is quite common. So common in fact, that many people don't even consider using anything else. However, you can create Perlin Noise functions with different characteristics by using other frequencies and amplitudes at each step. For example, to create smooth rolling hills, you could use Perlin noise function with large amplitudes for the low frequencies , and very small amplitudes for the higher frequencies. Or you could make a flat, but very rocky plane choosing low amplitudes for low frequencies.
当你把这些噪音函数加在一起,你可能想知道每一个使用的到底是什么振幅和频率。其中一个例子是每个都使用两倍频率和一半振幅的连续噪声函数叠加。这个例子很常见,而实际上很多人甚至都不考虑别的。但是,你也可以使用不同频率和振幅的函数,创建具有不同特征的柏林噪声函数。例如:创建一个平滑起伏的山丘,你可以使用低频率高振幅的柏林噪音函数和极小振幅高频率的柏林噪音函数。或者你想创建一个坚硬平坦的地面,那么你可以选择低振幅低频率。
To make it simpler, and to avoid repeating the words Amplitude and Frequency all the time, a single number is used to specify the amplitude of each frequency. This value is known as Persistence. There is some ambiguity as to it's exact meaning. The term was originally coined by Mandelbrot, one of the people behind the discovery of fractals. He defined noise with a lot of high frequency as having a low persistence. My friend Matt also came up with the concept of persistence, but defined it the other way round. To be honest, I prefer Matt's definition. Sorry Mandelbrot. So our definition of persistence is this:
为了使其更加简单,并且避免重复使用振幅和频率等词语,我们使用一个数字表示每个频率的振幅,这个值我们称为持久性。他的含义有一些模糊,这个词在分型被发现后,由曼德尔布罗创造。他定义高频噪音的持久性低。我的朋友马特也想出了持久性的概念,但是他定义的刚好相反。老实讲,我更喜欢马特的定义,很抱歉,曼德尔布罗。所以我们对于持久性的定义是这样的:
frequency = 2i
amplitude = persistencei
Where i is the ith noise function being added. To illustrate the effect of persistence on the output of the Perlin Noise, take a look at the diagrams below. They show the component noise functions that are added, the effect of the persistence value, and the resultant Perlin noise function.
其中,i为第i个被添加的噪声函数。为了说明的持久性对柏林噪声输出的影响,请看下图。他们显示了被添加的合成噪声函数,持久性效果的值,以及由此得到的柏林噪音函数。
Octaves 倍频程
Each successive noise function you add is known as an octave. The reason for this is that each noise function is twice the frequency of the previous one. In music, octaves also have this property.
每个你添加的连续噪音函数被称为倍频程。 这样做的原因是每个噪声函数是前一个频率的两倍。 在音乐方面,八度也有此属性。
Exactly how many octaves you add together is entirely up to you. You may add as many or as few as you want. However, let me give you some suggestions. If you are using the perlin noise function to render an image to the screen, there will come a point when an octave has too high a frequency to be displayable. There simply may not be enough pixels on the screen to reproduce all the little details of a very high frequency noise function. Some implementations of Perlin Noise automatically add up as many noise functions they can until the limits of the screen (or other medium) are reached.
究竟有多少个倍频程加在一起完全由你决定。只要你想,你可以添加任意多或尽可能少的倍频程。不过,我还是给你一些建议:如果你使用柏林噪声函数来渲染图像在屏幕上,当一个倍频程的频率太高的时候,显示的可能只是一个点。屏幕上的像素可能根本不足以重现的频率非常高的噪声函数的所有的小细节。某些实现了自动添加噪音函数的柏林噪声函数,他们可以达到屏幕或其他介质的限制极限。
It is also wise to stop adding noise functions when their amplitude becomes too small to reproduce. Exactly when that happens depends on the level of persistence, the overall amplitude of the Perlin function and the bit resolution of your screen (or whatever).
当他们的振幅变得太小,以至于无法重现时,则应该停止添加噪音函数。发生这种情况取决于持久性的等级,柏林函数的整体振幅,和你屏幕的分辨率(或其他)。
Making your noise functions 制作你自己的噪声函数
What do we look for in a noise function? Well, it's essentially a random number generator. However, unlike other random number generators you may have come across in your programs which give you a different random number every time you call them, these noise functions supply a random number calculated from one or more parameters. I.e. every time you pass the same number to the noise function, it will respond with the same number. But pass it a different number, and it will return a different number.
我们怎么来做一个噪声函数呢?其实本质上它就是一个随机数生成器。然而,与其他随机数生成器不同的是,在你的程序中,给你一个不同的随机数,每次你调用他们,这些噪声函数通过一个或多个参数算出一个随机数字。即每一次你往噪声函数中传入相同的值,它会响应反馈相同的值。但是传入不同的数字,它会返回一个不同的数字。
Well, I don't know a lot about random number generators, so I went looking for some, and here's one I found. It seems to be pretty good. It returns floating point numbers between -1.0 and 1.0.
好了,我并不知道很多关于随机数的生成器,所以我去找了一些,似乎还不错。它们的返回值都是在-1.0到1.0之间的浮点数。
Now, you'll want several different random number generators, so I suggest making several copies of the above code, but use slightly different numbers. Those big scarey looking numbers are all prime numbers, so you could just use some other prime numbers of a similar size. So, to make it easy for you to find random numbers, I have written a little program to list prime numbers for you. You can give it a start number and an end number, and it will find all the primes between the two. Source code is also included, so you can easily include it into your own programs to produce a random prime number. Primes.zip
现在,你要几个不同的随机数生成器,所以我建议把上面的代码多做几个副本,但使用略有不同的数字。那些大的吓人的数字都是素数,所以你可以使用其他尺寸相若的一些素数。因此,为了使你很容易找到随机数,我写了一个小程序来为你列出素数。你可以给它一个开始和一个结束,它会发现两者之间的所有素数。还包括源代码,所以你可以很容易地并入到自己的程序中产生随机的质数。
Interpolation差值
Having created your noise function, you will need to smooth out the values it returns. Again, you can choose any method you like, but some look better than others. A standard interpolation function takes three inputs, a and b, the values to be interpolated between, and x which takes a value between 0 and 1. The Interpolation function returns a value between a and b based on the value x. When x equals 0, it returns a, and when x is 1, it returns b. When x is between 0 and 1, it returns some value between a and b.
创造好了你的噪声函数,你将需要平滑处理他的返回值。同样,你可以选择任何你喜欢的方式,但有些看起来比别人的更好。一个标准的插值函数需要三个输入值:a和b还有之间的一个差值,并且x的取值范围为0和1之间的一个值。插值函数返回一个基于x并在a和b之间的一个值。当x等于0时,它返回a,当x是1时,它返回b。当x是0和1之间,它返回a和b之间的某值。
Smoothed Noise平滑噪声
Aside from Interpolations, you can also smooth the output of the noise function to make it less random looking, and also less square in the 2D and 3D versions. Smoothing is done much as you would expect, and anyone who has written an image smoothing filter, or fire algorithm should already be familiar with the process.
除了插值,你也可以平滑输出噪声函数,使之看起来不那么随机,并且在2D和3D版本中少乘平方。你期望的平滑完成后,写出图像平滑滤波器,或触发算法熟悉作用。
1-dimensional Smooth Noise
2-dimensional Smooth Noise
Putting it all together
Now that you know all that, it's time to put together all you've learned and create a Perlin Noise function. Remember that it's just several Interpolated Noise functions added together. So Perlin Noise it just a function. You pass it one or more parameters, and it responds with a number. So, here's a simple 1 dimensional Perlin function.
The main part of the Perlin function is the loop. Each iteration of the loop adds another octave of twice the frequency. Each iteration calls a different noise function, denoted by Noisei. Now, you needn't actually write lots of noise functions, one for each octave, as the pseudo code seems to suggest. Since all the noise functions are essentially the same, except for the values of those three big prime numbers, you can keep the same code, but simply use a different set of prime numbers for each.
1-dimensional Perlin Noise Pseudo code
Now it's easy to apply the same code to create a 2 or more dimensional Perlin Noise function:
2-dimensional Perlin Noise Pseudocode
Applications of Perlin Noise
Now that you have this fantastic function, what can you do with it? Well, as the cliche goes, you're limited only by your imagination. Perlin Noise has so many applications that I can't think of them all, but I'll have a go.
1 dimensional
2 dimensional
3 dimensional
4 dimensional
Generating Textures with Perlin Noise
Perlin is fantastic for generating textures. You can produce textures that are (for all practical purposes) infinitely large, but take up almost no memory. You can create marble, wood, swirly patterns, probably anything if you try hard. You can also define a 3D texture. You can think of this as a solid block of material, from which you can 'carve' an object. This allows you to produce textures which can be applied to any shaped object without distortion. It can take a lot of imagination, thought and experimentation to get a texture to look really good, but the results can be very impressive indeed.
Play around as much as you like. Use several Perlin functions to create a texture, try different persistences and different frequencies in different dimensions. You can use one Perlin function to affect the properties of another. Apply functions to their output. Do whatever you want, there's almost certainally a way to produce almost any texture you can dream up.
The following textures were made with 3D Perlin Noise
Day2:接着思考和可能的策划的更多相关文章
- Spark菜鸟学习营Day2 分布式系统需求分析
Spark菜鸟学习营Day2 分布式系统需求分析 本分析主要针对从原有代码向Spark的迁移.要注意的是Spark和传统开发有着截然不同的思考思路,所以我们需要首先对原有代码进行需求分析,形成改造思路 ...
- Spark Tungsten揭秘 Day2 Tungsten-sort Based Shuffle
Spark Tungsten揭秘 Day2 Tungsten-sort Based Shuffle 今天在对钨丝计划思考的基础上,讲解下基于Tungsten的shuffle. 首先解释下概念,Tung ...
- CH Round #58 - OrzCC杯noip模拟赛day2
A:颜色问题 题目:http://ch.ezoj.tk/contest/CH%20Round%20%2358%20-%20OrzCC杯noip模拟赛day2/颜色问题 题解:算一下每个仆人到它的目的地 ...
- Day2 - Python基础2 列表、字典、集合
Python之路,Day2 - Python基础2 本节内容 列表.元组操作 字符串操作 字典操作 集合操作 文件操作 字符编码与转码 1. 列表.元组操作 列表是我们最以后最常用的数据类型之一, ...
- NOI2012 Day2
NOI2012 Day2 迷失游乐园 题目描述:给出一个\(n\)个点的图,边数为\(n-1\)或\(n\).从某个点出发,每次等概率地随机选一个相连的并且没有经过过的点,直到不能走为止,问期望路径长 ...
- 手游client思考框架
手游新公司新项目client我不太同意框架.虽然我也终于让步,当他居然问老板,使这个幼稚的行为而悔恨. 然而,就在最近我写了一些代码视图,我更坚定了自己的想法和思想.和思路不一定适合其它人,所以我并不 ...
- 关于图计算和graphx的一些思考[转]
原文链接:http://www.tuicool.com/articles/3MjURj “全世界的网络连接起来,英特纳雄耐尔就一定要实现.”受益于这个时代,互联网从小众的角落走到了历史的中心舞台.如果 ...
- Unity 游戏框架搭建 (六) 关于框架的一些好文和一些思考
在进行项目架构阶段,游戏框架可以解决一部分问题.剩下的架构问题还需要根据不同的项目解决.总之游戏框架是游戏架构的一部分. 关于锤子和钉子: 最近又拿起了<代码大全>和<暗时间 ...
- Day2:html和css
Day2:html和css 表格是一种常用的标签,表格结构,做到能够合并单元格. 表格的属性: 属性名 说明 border 设置表格的边框 cellspacing 设置单元格与单元格边框之间的空白间距 ...
随机推荐
- 关于archive(feature)
配置如下archive命令,可以记录登录到设备,具体配置了哪些命令: R3(config)#archiveR3(config-archive)#log configR3(config-archive- ...
- pytoch 安装
注意替换清华源,否则直接安装速度会很慢. conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud ...
- mybatis源码探索笔记-3(使用代理mapper执行方法)
前言 前面两章我们构建了SqlSessionFactory,并通过SqlSessionFactory创建了我们需要的SqlSession,并通过这个SqlSession获取了我们需要的代理mapper ...
- 关于Android发送邮件
Google 在发表 Android 手机平台时,强调的是超强大的网络支持能力,因此,无论通过 GPRS.3G的电信网络或者是Wifi的无线WLAN网络,都能够发EMAIL. 发送邮件中使用的Inte ...
- iOS 开发之 FMDB 源码分析
概念: FMDB 是用于数据存储的框架,它是 iOS 平台下对 SQLite 数据库的封装.FMDB 是面向对象的,它以 OC 的方式封装了 SQLite 的 C 语言 API,使用起来更加方便. C ...
- redhat 7.6 安装 git
1.下载git包 下载网址:https://mirrors.edge.kernel.org/pub/software/scm/git/ //自己下载想要的版本 或者直接在Linux 直接使用wge ...
- sarima模型
以下内容引自:https://blog.csdn.net/qifeidemumu/article/details/88782550 使用“网格搜索”来迭代地探索参数的不同组合. 对于参数的每个组合,我 ...
- SpringBoot与Mybatis-plus整合,代码生成mvc层
一.添加pom依赖 <!-- mysql驱动 --> <dependency> <groupId>mysql</groupId> <artifac ...
- robot framework 接口post请求需要加headers
说明:当你用RF进行post接口测试时候,那么需要加个headers=Content-Type=application/x-www-form-urlencoded,要不然会请求不成功的.
- 小白笔记:Git入门之常见命令
安装 这里就不介绍安装了,度娘一大堆,找不到可以去找谷爹(前提是你能找到).安装好就跟着笔记进行下一步 准备工作 首先我们需要一个可以 git 的东西,所以我们需要一个文件夹和一个文件 创建文件夹 t ...