纳金网

标题: [Unity 组件参考手册]组件:资源组件之影片纹理 [打印本页]

作者: .    时间: 2013-1-25 14:25
标题: [Unity 组件参考手册]组件:资源组件之影片纹理
Assets are the models, textures, sounds and all other "content" files from which you make your game.
资源就是模型,纹理,声音和所有其他"内容",制作游戏所用的文件。
This section describes Components for all asset types. For a general overview of assets, see Assets overview page.
本部分介绍所有资源类型的组件。想要知道资源的一般概述,请参阅资源概览页面。

下面介绍影片纹理。





Note: This is a Pro/Advanced feature only.
注:这仅是专业版/高级版的功能。


【Desktop】
Movie Textures are animated Textures that are created from a video file. By placing a video file in your project's Assets Folder, you can import the video to be used exactly as you would use a regular Texture.
影片纹理(Movie Textures),从视频文件中创建的动画纹理(Textures )。通过在项目的资源文件夹中放置一个视频文件,可以导入要使用的视频,跟你使用一个普通的纹理(Texture)完全相同。
Video files are imported via Apple QuickTime. Supported file types are what your QuickTime installation can play (usually .mov, .mpg, .mpeg, .mp4, .avi, .asf). On Windows movie importing requires Quicktime to be installed (download here).
视频文件通过苹果的QuickTime 导入。支持的文件类型是QuickTime可以播放的文件类型(通常 .mov, .mpg, .mpeg, .mp4, .avi, .asf)。在Windows,影片的导入需要安装QuickTime(此处下载download here)。


【Properties 属性】
The Movie Texture Inspector is very similar to the regular Texture Inspector.
影片纹理检视面板与普通纹理(Texture )检视面板非常相似,


Video files are Movie Textures in Unity 视频文件是在Unity里的影片纹理
   
Aniso Level 各向异性等级

    Increases Texture quality when viewing the texture at a steep angle. Good for floor and ground textures

    提高在一个陡峭的角度观看纹理时的纹理质量。适合地板和地面纹理

   
Filtering Mode 过滤模式

    Selects how the Texture is filtered when it gets stretched by 3D transformations

    选择当3D变换拉伸时,纹理如何被过滤

   
Loop 循环

    If enabled, the movie will loop when it finishes playing

    如果启用,影片在完成播放时循环

   
Quality 质量

    Compression of the Ogg Theora video file. A higher value means higher quality, but larger file size 对Ogg Theora

    视频文件的压缩。值越高,意味着更高的质量,但文件大小会较大

【Details 详情】
When a video file is added to your Project, it will automatically be imported and converted to Ogg Theora format. Once your Movie Texture has been imported, you can attach it to any GameObject or Material, just like a regular Texture.
当一个视频文件添加到项目中,它会自动导入并转换为Ogg Theora 格式。一旦你的影片纹理导入后,你可以将它附加到任何游戏对象(GameObject )或材质(Material),就像一个普通的纹理一样。


[Playing the Movie 播放影片]
Your Movie Texture will not play automatically when the game begins ***nning. You must use a short script to tell it when to play.
你的影片纹理不会在游戏运行时自动播放。您必须使用一个简短的脚本来告诉它什么时候播放。
// this line of code will make the Movie Texture begin playing

//这行代码让影片纹理开始播放

renderer.material.mainTexture.Play();
Attach the following script to toggle Movie playback when the space bar is pressed:
将下面的脚本来触发当空格键被按下时,影片播放:
function Update () {

if (Input.GetButtonDown ("Jump")) {

  if (renderer.material.mainTexture.isPlaying) {

   renderer.material.mainTexture.Pause();

  }

  else {

   renderer.material.mainTexture.Play();

  }

}

}
For more information about playing Movie Textures, see the Movie Texture Script Reference page
播放影片纹理的详细信息,请参阅影片纹理脚本参考页面


[Movie Audio 影片音频]
When a Movie Texture is imported, the audio track accompanying the visuals are imported as well. This audio appears as an AudioClip child of the Movie Texture.
当影片纹理导入后,伴随着视像和音轨一并导入。该音频是AudioClip ,作为影片纹理的孩子。


The video's audio track appears as a child of the Movie Texture in the Project View

视频的音轨作为影片纹理的孩子出现在项目视图
To play this audio, the Audio Clip must be attached to a GameObject, like any other Audio Clip. Drag the Audio Clip from the Project View onto any GameObject in the Scene or Hierarchy View. Usually, this will be the same GameObject that is showing the Movie. Then use audio.Play() to make the the movie's audio track play along with its video.
播放音频,音频剪辑必须贴到一个游戏对象上,像任何其他音频剪辑。从项目视图拖动音频剪辑到场景的任何游戏对象或层级面板视图。通常,这是播放影片相同的游戏对象。然后使用 audio.Play()使影片的音轨伴随着其视频播放。


【iOS】
Movie Textures are not supported on iOS. Instead a full-screen streaming playback is provided using iPhoneUtils.PlayMovie and iPhoneUtils.PlayMovieURL.
影片纹理在iOS不支持。取而代之的是提供一个全屏幕的流媒体播放,使用iPhoneUtils.PlayMovie和iPhoneUtils.PlayMovieURL。
You can import your video file just like a regular asset or alternatively you can specify a network-based URL to play a movie located on a remote server.
您可以导入您的视频文件,就像一个普通资源,或者你也可以指定一个基于网络的网址,播放位于远程服务器上的一个影片。


You need to keep your videos inside of the StreamingAssets folder located in your Project directory.

你需要保持你的影片在 你的项目目录下的StreamingAssets文件夹里。

Unity iOS supports any movies that already play correctly on an iPod or iPhone, usually that means files with the extensions .mov, .mp4, .mpv, and .3gp and using one of the following compression standards:
Unity IOS支持任何在iPod或iPhone上可以正确播放的影片,通常是指扩展名为.mov, .mp4, .mpv, .3gp 和使用下列压缩标准之一:
    H.264 Baseline Profile Level 3.0 video

    MPEG-4 Part 2 video
For more information about supported compression standards consult with iPhone SDK MPMoviePlayerController Class Reference.
欲了解更多有关支持的压缩标准的信息,查阅MPMoviePlayerController Class Reference。
As soon as you call iPhoneUtils.PlayMovie or iPhoneUtils.PlayMovieURL, the screen will fade from your current content to the designated background color. It might take some time while movie is ready for playing, meanwhile the player will continue displaying the background color and may also display a progress indicator to let the user know the movie is loading. When playback finishes, the screen will fade back to your content.
只要你调用iPhoneUtils.PlayMovie或 iPhoneUtils.PlayMovieURL,屏幕上会逐渐从目前的内容变到指定的背景颜色。而影片播放,这可能需要一些时间,同时播放器将继续显示背景颜色,也可能会显示一个进度指示器,让使用者知道影片正在载入。当播放结束时,屏幕上会渐退,回到你的内容。


Video player does not respect switching to mute while playing videos

视频播放器不支持在播放视频时切换到静音
As written above, video files are being played using Apple's embedded player (as of SDK 3.2 and iPhone OS 3.1.2 and earlier), so basically we cannot do anything about this, since it is a bug in Apple's software. So yes, mute switch is not respected here.
正如上面写的,正在播放的视频文件,使用苹果的嵌入式播放器(SDK3.2和iPhone操作系统3.1.2及更早版本),所以基本上我们不能这样做,因为它是苹果的软件中的错误。所以,这里不支持静音开关。


Video player does not respect device orientation

视频播放不支持设备的方位
Apple video player and iPhone SDK do not provide a way to adjust the orientation of the video. Common approach is to manually create two copies of each movie in landscape and portrait orientations, then to determine the orientation of the device before playback and choose one of two movies.
苹果视频播放器和iPhone SDK没有提供一种方法来调整视频的方位。常见的方法是在横向和纵向的方向手动创建每个影片的两个拷贝,再确定设备的方位,最后就选择两个影片中的一个进行播放。


【Android】
Movie Textures are not supported on Android. Instead a full-screen streaming playback is provided using iPhoneUtils.PlayMovie and iPhoneUtils.PlayMovieURL.
在Android上不支持影片纹理。而是提供一个全屏幕的流媒体播放,使用 iPhoneUtils.PlayMovie和iPhoneUtils.PlayMovieURL.
You can import your video file just like a regular asset or alternatively you can specify a network-based URL to play a movie located on a remote server.
您可以导入您的视频文件,就像一个普通资源,或者你也可以指定一个基于网络的网址,播放位于远程服务器上的一个影片。


You need to keep your videos inside of the StreamingAssets folder located in your Project directory.

你需要保持你的影片在 你的项目目录下的StreamingAssets文件夹里。
Unity Android supports any movies that already Android platform supports, usually that means files with the extensions .mp4 and .3gp and using one of the following compression standards:
Unity IOS支持任何在iPod或iPhone上可以正确播放的影片,通常是指扩展名为.mov, .mp4, .mpv, .3gp 和使用下列压缩标准之一:
    H.263

    H.264 AVC

    MPEG-4 SP
However device vendors are keen on expanding this list, so some Android devices are able to play HD videos and other than listed file formats.
然而,设备供应商都热衷于扩展此列表,因此一些Android设备能够播放高清视频和列出文件以外的格式。
For more information about supported compression standards consult with Android SDK Core Media Formats documentation.
有关支持的压缩标准的更多信息,查阅Android SDK的 Core Media Formats documentation。
As soon as you call iPhoneUtils.PlayMovie or iPhoneUtils.PlayMovieURL, the screen will fade from your current content to the designated background color. It might take some time while movie is ready for playing, meanwhile the player will continue displaying the background color and may also display a progress indicator to let the user know the movie is loading. When playback finishes, the screen will fade back to your content.
只要你调用 iPhoneUtils.PlayMovie或 iPhoneUtils.PlayMovieURL,屏幕上会逐渐从目前的内容变到指定的背景颜色。而影片播放,这可能需要一些时间,同时播放器将继续显示背景颜色,也可能会显示一个进度指示器,让使用者知道影片正在载入。当播放结束时,屏幕上会渐退,回到你的内容。
【来源:互联网】

更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/




欢迎光临 纳金网 (http://wwww.narkii.com/club/) Powered by Discuz! X2.5