Unity3d里RenderTexture在屏幕中做小屏幕用.doc

上传人:scccc 文档编号:13941523 上传时间:2022-01-27 格式:DOC 页数:9 大小:178.50KB
返回 下载 相关 举报
Unity3d里RenderTexture在屏幕中做小屏幕用.doc_第1页
第1页 / 共9页
Unity3d里RenderTexture在屏幕中做小屏幕用.doc_第2页
第2页 / 共9页
Unity3d里RenderTexture在屏幕中做小屏幕用.doc_第3页
第3页 / 共9页
Unity3d里RenderTexture在屏幕中做小屏幕用.doc_第4页
第4页 / 共9页
Unity3d里RenderTexture在屏幕中做小屏幕用.doc_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《Unity3d里RenderTexture在屏幕中做小屏幕用.doc》由会员分享,可在线阅读,更多相关《Unity3d里RenderTexture在屏幕中做小屏幕用.doc(9页珍藏版)》请在三一文库上搜索。

1、先创建一个至少包含2个摄像机的场景,在这里我就创建2个摄像机,一个是看着角色的即MainCamera, 个是要被渲染进小地图的Camera。2部摄像机调整如下: nspctor* VT ag smjflWapLayer DefaultStall t1 TransformPositionX 0.5 76S544ZO.660962.920253P otationX 90ScleX 1-rYHX 0W 1DepthPenderinfl Path Uce 卩Ijysr SettingsTmrget TexturesmallMaof y Flare Layer ?GUILayer Audiiew Por

2、t PeetX W 1Depth1R eridenng Path Us e P lay trSwrtlriqwTarget Texture None fRender Texture 1先做准备工作,我们要用到Render Texture.先创建一张 Render texture图片。Assets-Create-Re nder TextureReijnipor t1| Create卜FoUrShaw in ExplorerOp拿鼎JtvsScript C Shmrp Seri f tBoo SeriptShaderIfftpor t He*Ctrl+RImport P.clf .Expor t

3、Fckcc .EitprtfileFrfabAjLiffiati o鞋BtiwitlLtm ?1 *x*Custom FontRei importSjmc Vi KuilStud.i -o ProjectHander Txtur tfhysi c atr i alGUI Skm这时候这张照片是空的,因为我们没指定摄像机在Camera的Target Texture选项里,选择刚才创建的 render texturesFar 1000Y 0H 1Depth0Rendering Path PlaytrMtingu 了 Smooth Laok At (Script)W dTag smaflMap*La

4、 y er口 efault*1 TMnsformPosition71 *X 0.576S544Y 20.66096z2.92 B 253P otationX 90Y 0Z0ScoleX 1丫 110 In specterJ ”工V Cameral Statici- C a meraClr FldgsBdckgraundCulling MaskPrcje cticmField of viewClipping Planeshear 0.2Normalized View Port FeetX Q艸1这时候render texture里面就有画面了。如图J CanrreraBl義C lear Fl 科

5、 wSlcytwxTBsckGround ColorNormalized iew Port Retthlar clip plane0.3Far clip plane1000FhEd of view50Orthog raphicOrthographic size100CXpth0CuEling MaskEvtrything;Target Texturerend er textur-eT接下来我们就要让它显示出来。代码如下: using Un ityE ngine;using System.Collectio ns;public classsmallMap : MonoBehaviour publ

6、ic RenderTexturepic;void OnGUI()GUI.Box(new Rect(700, 10, 200, 200), pic);/ Use this for initializationvoid Start () / Update is called once per framevoid Update ()最后把代码拖到 Ma in Camera中,并设置 Re nder Texture为刚才创建的Re nder Texture,注意 Main Camera 里的 Target texture 不用设置O Inspeetar2 -=7 MainCarnrStaticEwe

7、r/tbingTag UrvNQgtdi La/er Defaiilt;Projectian Field of ViewP er p ectirvef60X -0.2053653T04766262z6,175978Potationx aYISOz0ScaleX 1Y11T J- Transform闌、Position* V ameraClectr FlagsBa ckgro uridCulling MaskSkyboxClipping PlanesFar 1000Near 0.3Pic眄 smallMepRerderinq Path Use Plai/ei Settings 1 wTarget Texture Hone fRendr TfiKturs)o-労 Flare Layer a,17 %GUlLayerffl aTAudio Litener喲o, 7 Smooth Follow (Script)闸$Normalized View Rort PeetX 0W 1Depth * Small Map (Script)Script sm a I IM dp现在,我们就可以看到游戏中有一个小地图来显示我们的场景了StartDownload UpLoading

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1