unity3d 自学杂项 2.0版(实时更新)

1.unity3d point light 个数限制更改

unity默认的pointlight个数为2个,多加的话先加的就没有效果,
具体更改方式如下:
Edit -> Project Settings -> Quality-> Rendering面板下的Pixel Light Count

值可以随意更改

2.多缓冲模式

包括双缓冲Double Buffer,三缓冲,四缓冲。。。。。。

好处有防画面撕裂、闪烁,防止在访问时被更改,瞬时全部更新而不是一点一点更新(比如说每帧的画面)

双缓冲常用来刷新显示屏,MSDN上有很详细的说明https://msdn.microsoft.com/en-us/library/b367a457(v=vs.110).aspx

Flicker is a common problem when programming graphics. Graphics operations that require multiple complex painting operations can cause the rendered images to appear to flicker or have an otherwise unacceptable appearance. To address these problems, the .NET Framework provides access to double buffering.

Double buffering uses a memory buffer to address the flicker problems associated with multiple paint operations. When double buffering is enabled, all paint operations are first rendered to a memory buffer instead of the drawing surface on the screen. After all paint operations are completed, the memory buffer is copied directly to the drawing surface associated with it. Because only one graphics operation is performed on the screen, the image flickering associated with complex painting operations is eliminated

一个wiki的例子博主感觉举得非常恰当

The easiest way to explain how multiple buffering works is to take a real world example. It is a nice sunny day and you have decided to get the paddling pool out, only you can not find your garden hose. You’ll have to fill the pool with buckets. So you fill one bucket (or buffer) from the tap, turn the tap off, walk over to the pool, pour the water in, walk back to the tap to repeat the exercise. This is analogous to single buffering. The tap has to be turned off while you “process” the bucket of water.

Now consider how you would do it if you had two buckets. You would fill the first bucket and then swap the second in under the running tap. You then have the length of time it takes for the second bucket to fill in order to empty the first into the paddling pool. When you return you can simply swap the buckets so that the first is now filling again, during which time you can empty the second into the pool. This can be repeated until the pool is full. It is clear to see that this technique will fill the pool far faster as there is much less time spent waiting, doing nothing, while buckets fill. This is analogous to double buffering. The tap can be on all the time and does not have to wait while the processing is done.

If you employed another person to carry a bucket to the pool while one is being filled and another emptied, then this would be analogous to triple buffering. If this step took long enough you could employ even more buckets, so that the tap is continuously running filling buckets.

In computer science the situation of having a running tap that cannot be, or should not be, turned off is common (such as a stream of audio). Also, computers typically prefer to deal with chunks of data rather than streams. In such situations double buffering is often employed.

双缓冲模式的实现

实现需要两个buffer

实现方法需要几个函数:swap交换,reset重置用过的buffer,更新nextBuffer,显示currentBuffer。。。。

因为写的东西太少了,博主就不单发博客来说明了。。。by wolf96

三缓冲的介绍

Triple buffering[edit]

In computer graphics, triple buffering is similar to double buffering but provides a speed improvement. In double buffering the program must wait until the finished drawing is copied or swapped before starting the next drawing. This waiting period could be several milliseconds during which neither buffer can be touched.

In triple buffering the program has two back buffers and can immediately start drawing in the one that is not involved in such copying. The third buffer, the front buffer, is read by the graphics card to display the image on the monitor. Once the monitor has been drawn, the front buffer is flipped with (or copied from) the back buffer holding the last complete screen. Since one of the back buffers is always complete, the graphics card never has to wait for the software to complete. Consequently, the software and the graphics card are completely independent, and can run at their own pace. Finally, the displayed image was started without waiting for synchronization and thus with minimum lag.[1]

Due to the software algorithm not having to poll the graphics hardware for monitor refresh events, the algorithm is free to run as fast as possible. This can mean that several drawings that are never displayed are written to the back buffers. This is not the only method of triple buffering available, but is the most prevalent on the PC architecture where the speed of the target machine is highly variable.

四缓冲的介绍

Quad buffering[edit]

The term “Quad buffering” is used in stereoscopic implementations, and means the use of double buffering for each of the left and right eye images, thus four buffers total. The command to swap or copy the buffer typically applies to both pairs at once. If triple buffering was used then there would be six buffers.

Quad buffering is a technology for implementing stereoscopic frame rendering in computer graphics. For stereoscopic rendering, each eye must receive a separate image. Quad buffering uses double buffering with a front buffer and back buffer for each eye, totaling four buffers.

Similarly to the v-sync in 2D mode, quad buffering allows to swap the front and back buffers for both eyes in sync, allowing the display to seamlessly work with different rendering frame rates.

Quad buffering requires special support in the graphics card drivers which is disabled for most consumer cards. AMD’s Radeon HD 6000 Series and newer support it[1].

3D standards like OpenGL[2] and Direct3D support quad buffering.

3.NVIDIA的G-SYNC原理

简而言之,G-SYNC模块的技术原理就是结合PC上安装的GeForce 显卡共同来调节显示器的可变刷新率。传统显示器的刷新率是固定的,60Hz就是60Hz,不能升高也无法降低。有了G-SYNC之后,显示器只有从显卡端获得了最新的完整画面帧后才会刷新,可实现30Hz~144Hz之间的自主调节。

如果你想指望用这199美元的设备来提高游戏帧速,那结果可能会令你失望,因为G-SYNC既不能往上提高帧率,也不会往下压制帧率,它的本质是让显卡不再受显示器刷新率的制约,将游戏体验完全交给了显卡自身的性能表现。

当一款中端显卡在玩某游戏时不够60fps,此时开启垂直同步后游戏帧速可能会被直接锁定在30fps。使用G-SYNC技术之后,在玩同样的游戏时既可获得开启垂直同步后的画面效果,游戏依旧可以保持在原先的速度上!

可能有些玩家会有异议了,如果购买了一款120Hz甚至更高刷新率的显示器,G-SYNC还有什么意义案很简单,刷新率再高的显示器也不能根据显卡的实时帧率来实时调整刷新率,而G-SYNC的意义就是在每一秒都能做到刷新率跟显卡的实时帧数完美匹配,相当于是“无级变速”。对游戏开发人员而言,今后也不必再担心帧率会不足60fps,即便低帧率下也可以加入更多特效,而此时画面依然是流畅的!

正如NVIDIA所说,G-SYNC技术能够彻底解决垂直同步、刷新率限制带来的游戏画面撕裂、卡顿、延迟等问题,保证最好的流畅度。

4.SSSSS

http://www.iryoku.com/sssss/

blur一次,效果。。。。不过应该不止这么简单

Teaser

来源:wolf96

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2014年6月22日
下一篇 2014年6月22日

相关推荐