UE4ã®Occlusion Cullingã§è¯ãèããã質å2 Occlusion Cullingã«ãããªãã¸ã§ã¯ãã1ãã¬ã¼ã æ¶å¤±ãããã¨ããã
ãã®è¨äºã¯ UE4 Advent Calender 2018 その2 ã®4æ¥ç®ã®è¨äºã«ãããã¾ãã
ä»åã®ã¢ãã«ã¬ã§ã¯Occlusion Cullingã«ã¤ãã¦èª¬æãã¦ãã¾ãããé·ããªã£ããã2ã¤ã«åå²ãã¾ããããã¡ãã¯ãã®å¾åã«ãªãã¾ãã
- åå: Occlusion Culling自身の処理負荷を減らしたい
- å¾å: Occlusion Cullingã«ãããªãã¸ã§ã¯ãã1ãã¬ã¼ã æ¶å¤±ãããã¨ããã(æ¬è¨äº)
ååã§ããä¼ããã¾ããããOcclusion Cullingãã©ã®ãããªä»çµã¿ããåããªãæ¹ã¯ãã¾ããªãã£ã·ã£ã«ããã¥ã¡ã³ãVisibility and Occlusion Cullingãåèã«ãã¦ã¿ããã ããã以ä¸ã®èª¬æã§ã¯ä¸è¨ããã¥ã¡ã³ããèªãã ã¨ããåæã§è©±ãé²ãã¦ã¾ããã¾ãã
Occlusion Cullingã«ãããªãã¸ã§ã¯ãã1ãã¬ã¼ã æ¶ãã¦
ãã«ãã¯
ã¿ã¤ãã«ã®éããªã®ã§ãããOcclusion Cullingãåå ã§ãªãã¸ã§ã¯ãã1ãã¬ã¼ã æ¶ãã¦ãã«ããã¦ãã¾ãã¨ãæ¯æåæãããåãåãããé ãã®ã§ããããã®ãããã以ä¸ã®äºã¤ã®ã©ã¡ããã®åé¡ã¨ãªã£ã¦ãã¾ããã
- ã«ããã·ã¼ã³ãªã©ã«ã¡ã©åæ¿æã«ãªãã¸ã§ã¯ãã®è¡¨ç¤ºã1ãã¬ã¼ã é ãã
- æ°ããã«ã¡ã©ã«å ¥ã£ã¦ãããªãã¸ã§ã¯ãã®è¡¨ç¤ºã1ãã¬ã¼ã é ãã
ãããã®æ ¹æ¬ã®åå ã¯ããªã¯ã«ã¼ã¸ã§ã³ã«ãªã³ã°ãåç
§ããããã¹ã1ãã¬ã¼ã åã®ãã®ã ãããªã®ã§ãããä»åã¯åå ã®è©³ç´°ã¯è¿½ãããä¿®æ£æ¹æ³ããä¼ããã¦ãããã¨æãã¾ãã
åå 1. ã«ã¡ã©åæ¿æã«ãªãã¸ã§ã¯ãã®è¡¨ç¤ºã1ãã¬ã¼ã é ãã
ä¾ãã°ã·ã¼ã±ã³ãµã¼ã§ã«ã¡ã©ã®ã«ãããåãæ¿ãã以ä¸ã®æ§ãªã·ã¼ã³ãèãã¾ããå£ã®ã¢ããããåºãå ´é¢ã«ã«ãããåãæ¿ãã£ãéããã¥ã¼ãã1ãã¬ã¼ã é
ãã¦åºç¾ããã®ãããããã¨æãã¾ãã
ãã¡ããä¿®æ£ããã®ãä¸ã®ãã®ã§ããä¸ã¨æ¯ã¹ãã¨ãã«ä»ãããªããªã£ã¦ããã®ãããããã¨æãã¾ããï¼ã¢ã¼ã·ã§ã³ãã©ã¼ã§ãããã«ãããªã£ã¦ãã¾ã£ã¦ãã¦ããããªããï¼ï¼ï¼
ããã§ã¯ãå ·ä½çãªç´ãæ¹ã«ã¤ãã¦èª¬æãã¾ãã
対ç1: ã«ã¡ã©ã®ã«ãããåãæ¿ãã
ã·ã¼ã±ã³ãµã¼ã§ã«ãããåå²ããã«ä¸ã¤ã®ã«ã¡ã©ã1ãã¬ã¼ã ã§ãã¬ãã¼ãããããããã¨ããã®æ§ã«ãã«ã¤ãã¦ãã¾ãå¯è½æ§ãããã¾ãã
UE4ã§ã¯ãã«ãããåãæ¿ããç¬éã¯èªåçã«Occlusion CullingãOffã«ãã¾ãããªã®ã§ãæ示çã«ã«ã¡ã©ã®ã«ãããåãæ¿ããäºã§ã«ããããªãããã¨ãã§ãã¾ãã
(â»2022å¹´4æ7æ¥è¿½è¨: æ£ç¢ºã«ã¯ãã«ã¡ã©ã«ããã§ãã®åã®ã«ã¡ã©ã«ããã使ãã«ã¡ã©ã¨ã¯å¥ã®ã«ã¡ã©ãæå®ããå¿
è¦ãããã¾ããåãã«ã¡ã©ãé£ç¶ããã«ã¡ã©ã«ããã§ä½¿ã£ã¦ãããã é«éã«ã«ã¡ã©ã移åããã ãã¨ãããããªä½ãã¨ãªã£ã¦ãã¾ãããã§ãã)
対ç2: ã«ã¡ã©ã大ãã移åããã¨ãã
èªåçã«Occlusion CullingãOffã«ãªãããã«ãã
ã©ããã¦ãåä¸ã®ã«ã¡ã©ã§ããããå ´åãã¾ãã¯åç´ã«ã«ã¡ã©ã®ç§»åéãå¤ãã¦ãã®æ§ãªãã«ã¤ããèµ·ãã¦ãã¾ãå ´åã以ä¸ã®ãã©ã¡ã¼ã¿ãæçããããã¾ããããã®2ã¤ã®é¾å¤ãããã«ã¡ã©ã1ãã¬ã¼ã ã§ç§»åããå ´åãèªåçã«ãã®ç¬éã®ãã¬ã¼ã ã®Occlusion CullingãOffã¨ãã¦ããã¾ãã
- CameraRotationThreshold (Default 45.0)
- CameraTranslationThreshold (Default 1000)
â»ãã®2ã¤ãCVaråããã¦ããªãã®ã§ãåçå¤æ´ã¯ã§ãã¾ããããCVaråãã¦ãåé¡ã¯ãªããã¨æãã¾ãã試ãã¦é ããã°ã
ããã§ãããã¾ããããªãå ´åãr.AllowOcclusionQueriesã®On/Offãæåã§åãæ¿ããããéã¯ãªãããããã¾ããã
åå 2. ç»é¢ç«¯ããå ¥ã£ã¦ãããªãã¸ã§ã¯ãããã«ã¤ã
以ä¸ã®æ§ã«ç»é¢ç«¯ã®ãªãã¸ã§ã¯ããã«ã¡ã©ã«å
¥ã£ã¦ããéã«ããã«ãã«ã¨1ãã¬ã¼ã é
ãã¦åºç¾ãã¦ãã¾ããã¨ãããã¾ãã
対ç1: ç»é¢ã«å ¥ã£ã¦ããç¬éã®ã¿ãªãã¸ã§ã¯ãã®ãã¦ã³ã¹ãä¸æçã«å¤§ãããã
UE4ã¯ãç»é¢è¦éã®å¤ããä¸ã«å ¥ã£ã¦ãããªãã¸ã§ã¯ãã«å¯¾ãã¦ããã®å ¥ã£ãç¬éã®ã¿Occlusionã®ãã¦ã³ã¹ãæ¡å¤§ãããªãã·ã§ã³ãããã¾ãã
r.ExpandNewlyOcclusionTestedBBoxesAmount (Default =0.0f)
ãã®ãã©ã¡ã¼ã¿ã¯Defaultã§0ã®ããç¡å¹ãªã®ã§ããããã®å¤ãä¸ãããã¨ã§ç¬éçã«ãªã¯ã«ã¼ã¸ã§ã³ã«ãªã³ã°ç¨ã®ãã¦ã³ã¹ã大ãããã¦ããã¾ãããã®ãã¦ã³ã¹ã¯ãã©ã¹ã¿ã ã«ãªã³ã°ãªã©ã§ä½¿ããããã¦ã³ã¹ã¨ã¯å¥ã§ãããã¾ã§ãªã¯ã«ã¼ã¸ã§ã³ã«ãªã³ã°æã«ãã使ããªããã¦ã³ã¹ãªã®ã§ä»ã«å½±é¿ãä¸ãã¾ããã
試ãã«ãExpandNewlyOcclusionTestedBBoxesAmountã100(1m)ã«è¨å®ããOcclusion Cullingã§ä½¿ããããã¦ã³ã¹ãè¦è¦åãã¦ã¿ã¾ãããã«ã¡ã©ããå
¥ã£ããªãã¸ã§ã¯ãã®ãã¦ã³ã¹ã大ãããªã£ã¦ããã®ãããããã¨æãã¾ãã(大ãããªã£ã¦ããã®ãããããããæ§ã«ãæ¡å¤§ããæéãæå®ããr.FramesToExpandNewlyOcclusionTestedBBoxesãä¸ãã¦ãã¾ã)
ãã®ãã©ã¡ã¼ã¿ãä¸ãããã¨ã«ããã誤ã£ã¦Cullingãããå¯è½æ§ã軽æ¸ãããã¨ãã§ãã¾ãã
ãã¾ã: 常ã«Occlusion ã®ãã¦ã³ã¹ã大ããããæ¹æ³
ä¸è¨è¨å®ã¯ããªãã¸ã§ã¯ããã«ã¡ã©ã«å ¥ã£ã¦ããã¿ã¤ãã³ã°ã®ã¿Boundsãæ¡å¤§ãããã®ã§ããã常ã«æ¡å¤§ããããªãã·ã§ã³ãããã¾ãã
- ã½ã¼ã¹ã³ã¼ãå é¨ãOCCLUSION_SLOPã®å¤ã大ãããã
- r.ExpandAllOcclusionTestedBBoxesAmountã®å¤ã大ãããã
ããããåã®ãªãã·ã§ã³ã§å¹æããã¾ãåºãªãå ´åãæçµæ段ã¨ãã¦ãã¡ããè¨å®ããã®ããããã¨æãã¾ããå®éãå¦çè² è·ã注ææ·±ã確èªãã¦åé¡ãªããã¨ãããã£ãã®ã§ããã®OCCLUSION_SLOPã®å¤ã500ãªã©ã«è¨å®ãã¦ãªãªã¼ã¹ããã¿ã¤ãã«ãããã¨ä¼ºã£ã¦ãã¾ãã
以ä¸ã§ããOcclusion Cullingã§ãã«ã¤ãã¦ããããªå ´åãä¸è¨ã試ãã¦è¦ã¦ãã ããã°å¹¸ãã§ãã
ãããã¨ããããã¾ããï¼
UE4ã®Occlusion Cullingã§è¯ãèããã質å1: Occlusion Cullingèªèº«ã®å¦çè² è·ãæ¸ãããã
ãã®è¨äºã¯ UE4 Advent Calender 2018 その2 ã®4æ¥ç®ã®è¨äºã«ãããã¾ãã
Occlusion Cullingã¯ã沢山ã®ãªãã¸ã§ã¯ããã·ã¼ã³ã«åå¨ããã¨ããªã©ã«å¹ãã¦ãããã¬ã³ããªã³ã°é¢é£ã®æé©åææ³ã®ä¸ã¤ã§ããããã©ã«ãã§ONãªã®ã§çããæ°ã¥ããªããã¡ã«ä½¿ã£ã¦ããã®ã§ãããã©ã®ãããªä»çµã¿ããåããªãæ¹ã¯ã¾ããªãã£ã·ã£ã«ããã¥ã¡ã³ãVisibility and Occlusion Cullingãåèã«ãã¦ã¿ã¦ãã ãããã¡ããã©UE4.21ãããEpic Gamesã®Tim Hobsonãããããã¥ã¡ã³ããã¢ãããã¼ãããOcclusion Cullingãå«ããUE4ã®Cullingã·ã¹ãã ãé常ã«è©³ç´°ã«èª¬æãã¦ããã¦ã¾ãããã¤ã¹ã¿ã¤ãã³ã°ã以ä¸ã®èª¬æã§ã¯ä¸è¨ããã¥ã¡ã³ããèªãã ã¨ããåæã§è©±ãé²ãã¦ã¾ããã¾ãã
便å©ãªOcclusion Cullingãªã®ã§ãããã»ã¼æ¯æãé¡ä¼¼ã®è³ªåãåæããããã ãã¾ãããªã®ã§ä»åã¯ããããã¾ã¨ãã¦ã·ã§ã¢ãããã¨æãã¾ããå°ã é·ãã®ã§è¨äºã¯2ã¤ã«åãããã¦ãã ããã
- Occlusion Cullingèªèº«ã®å¦çè² è·ãæ¸ãããã (æ¬è¨äº)
- Occlusion Cullingによりオブジェクトが1フレーム消失することがある
ã§ã¯æ©éãOcclusion Cullingã®å¦çè² è·ã®åæ¸ã«ã¤ãã¦ã§ãã
Occlusion Cullingã®å¦çè² è·ãæ°ã«ãªã£ããããã
ã¾ããã®åã«ããã
Occlusion Cullingèªèº«ã®ã³ã¹ããæ¸ããåã«ãããããOcclusion Culllingã®å段éã§çãããªãã¸ã§ã¯ãã¯çãã¦ãã¾ãã®ãæå¼·ã§ãããã®çãæ¹ã«ã¤ãã¦ãUNREAL FEST EAST 2018ãã«ãããæ ªå¼ä¼ç¤¾ã¦ã¼ã¯ã¹æ§ã®ãè¬æ¼ã§é常ã«è©³ãã説æããã¦ãã¾ããã·ã¼ã³ã«ãªãã¸ã§ã¯ããå¤ãã²ã¼ã ã§ã¯ãã¹ããªå
容ãªã®ã§æ¯éï¼ï¼ï¼ã¦ã¼ã¯ã¹æ§è²´éãªæ
å ±å
±æèª ã«ãããã¨ããããã¾ãï¼ï¼
ããã§ãã¾ã Occlusion Cullingã®ã³ã¹ããé«ãå ´åãä¸èº«ã調æ´ããå¿ è¦ãåºã¦ããããããã¾ãããã¾ãã¯ããããã¨ãã¦Occlusion Cullingã®å©ç¹ã¨æ¬ ç¹ã«ã¤ãã¦è¦ã¦ããã¾ãã
Occlusion Cullingã®å©ç¹
以ä¸ã®å·¦å³ã®æ§ãªã·ã¼ã³ãèãã¾ãã
Occlusion Cullingã¯ã¿ãã§ã¯ãªã
ããããããªOcclusion Cullingã«ãã³ã¹ãã¯ããã¾ããOcclusion Cullingã«æå
¥ããããªãã¸ã§ã¯ãã¯ãä»ã®ãªãã¸ã§ã¯ãã«é®è½ããã¦ãããã©ãããã®ãã§ãã¯ãå¿
è¦ã§ãããã®ãã§ãã¯ã«ããã¡ããã³ã¹ãããããã¾ããã¤ã¾ããä¸å³ã®ç»é¢ã«è¦ãã¦ãããã¥ã¼ãéã«ã¯ãä½è¨ã«ãã®ãã§ãã¯ã®ã³ã¹ããããã£ã¦ããã¨ãããã¨ã«ãªãã¾ãã
試ãã«ãç´6500ãªãã¸ã§ã¯ãå
¨ã¦ããªã¯ã«ã¼ã¸ã§ã³ã«ãªã³ã°ã«æå
¥ãããããã«ãã¦ã¿ã¾ããã
OcclusionCullingã®ã¿ã®å¦çè² è·ãæ½åºãã¦ã¿ãã¨ãæãã©ãããã©ã¼ã ã§ã¯ä»¥ä¸ã®ãããªå¦çè² è·ã«ãªãã¾ããã
CPU | 6.6ms |
---|---|
GPU | 3.0ms |
Occlusion Queries (æå ¥ãããObject) | 6561 Objects (100%) |
åãã¬ã¼ã ã§è¦ãã¦ããStaticãªãã¸ã§ã¯ãã¯ç¢ºççã«Occlusion Cullingã«æå ¥ãã
é常ã«å¤§ããªæ´æ°ããªãéãåãã¬ã¼ã ã§è¦ãã¦ãããªãã¸ã§ã¯ãã¯ä»ã®ãã¬ã¼ã ã§ãè¦ãã¦ããã ãããããã¨ããã³ã³ã»ããã®ãã¨ãUE4ã¯Occlusion Cullingã®å¦çè² è·ã軽æ¸ããããã«âåãã¬ã¼ã ã§è¦ãã¦ããStaticãªãã¸ã§ã¯ãâã¯ç¢ºççã«ãªã¯ã«ã¼ã¸ã§ã³ã«ãªã³ã°ã«æå ¥ãã¾ãã
SceneVisibility.cppå é¨ FetchVisibilityForPrimitives_Range()é¢æ°ã«ã¦ããã
bRunQuery = (FractionMultiplier * Rnd) < GEngine->MaxOcclusionPixelsFraction;
ãã®æå
¥ã®ç¢ºçãå¶å¾¡ãããã©ã¡ã¼ã¿ãMaxOcclusionPixelsFractionã§ããEngine.iniã«ã¦è¨è¼ããã¦ããDefaultã§ã¯0.1ãã¤ã¾ã10%ã«ãªã£ã¦ãã¾ãã(â»å³å¯ã«ã¯10%ã§ã¯ãªãã®ã§ãã詳細ã¯ã³ã¼ããåç
§ãã¦ãã ããã)
ãã®ããã©ã«ãè¨å®ã«ããOcclusion Cullingã®ã³ã¹ãã¯åã«ä¸ããä¾ã§ä»¥ä¸ã®æ§ã«å¤åãã¾ããã
MaxOcclusionPixelsFraction | 1.0 | 0.1 |
---|---|---|
CPU | 6.6ms | 1.9ms |
GPU | 3.0ms | 0.3ms |
Occlusion Queries (æå ¥ãããObject) | 6561 Objects (100%) | 668 Objects (10.18%) |
æå¾ã«çµè«ããããã注æç¹ã
ãã®ããã°ã®çµè«ã¨ãã¾ãã¦ã¯
çµè«
ãããOcclusion Cullingã®CPU/GPUè² è·ãæ°ã«ãªã£ãããããMaxOcclusionPixelsFractionãæ°ã«ãã¦ã¿ã¾ãããï¼
ã¨ãããã¨ãªã®ã§ãããããã¤ã注æç¹ãããã¾ãã®ã§ã·ã§ã¢ãã¾ãã
注æç¹: Occlusion Cullingã¯ã©ã³ãã ã§çºçããã®ã§ãå®éã«ã«ãªã³ã°ãããã¿ã¤ãã³ã°ãã©ã°ãçºçãã¾ã
ãªãã¸ã§ã¯ãã®è£ã«ãã£ã¦ã確ççã«æå ¥ãããã®ã§ãã°ããããªãã¨Occlusion Cullingããã¾ããããã®åã®è² è·ã¯å¢ãã¦ãã¾ãã¾ãããå ¨ãªãã¸ã§ã¯ãæ¯ãã¬ã¼ã ãã§ãã¯ããããã¯è¯ãå¹æãåºãæ¹ãé¥ãã«å¤ããã¨æãã¾ãã
注æç¹: Was Rencently Renderedã®ã¿ã¤ãã³ã°ãããã¾ã
Was Recently Renderedã¯GPUã«æå ¥ãããéã«æ´æ°ããã¾ããã¤ã¾ããOcclusion Cullingã§ã®ã«ãªã³ã°ã確ççã«è¡ãããã¨ãã«ãçµµã¨ãã¦ã¯å¥ãªãã¸ã§ã¯ãã«é®è½ããã¦è¦ããªããªã£ããã¬ã¼ã ã¨ãå®éã«WasRecentlyRenderedãè¿ããã¬ã¼ã ã«ãããçããå ´åãããã¾ãã
注æç¹: ãã®ç¢ºççæå ¥ã¯Static/Stationaryãªãªãã¸ã§ã¯ãã®ã¿
ãã®Occlusion Culllingã®æé©åã¯bAllowApproximateOcclusionãtrueã®ãªãã¸ã§ã¯ãã®ã¿ã§è¡ããã¾ããã§ãããã®å¤ã¯ããã©ã«ãã§ã¯Movableã«å¯¾å¿ãã¦ãã¾ããã
PrimitiveSceneProxy.cppå é¨
, bAllowApproximateOcclusion(InComponent->Mobility != EComponentMobility::Movable)
Movableãªãªãã¸ã§ã¯ãã¯åãåãã®ã§åå¾é¢ä¿ãé »ç¹ã«å¤ããããã¨ããçç±ããã ã¨æãã®ã§ãããè¦ãã¦ãã¦ãæ¯ãã¬ã¼ã æå
¥ãããã®ã§ã注æããã
ãããMovableã§ããã®ä»æ§ã§OKãªå ´åãbAllowApproximateOcclusionã®ãã§ãã¯å¼ãå¤æ´ããããç¬èªã§æ¡å¼µãã¦ã¿ã¦åä½ã確èªãã¦é ããã°ãæå
ã§å°ã試ãã¾ããããã¾ãåä½ãã¦ããã¨æãã¾ãã
注æç¹: MaxOcclusionPixelsFractionã®è©³ç´°ãCVarãããªãããã¤ã
- Engne.iniã«ã¦è¨è¼å¯è½ã§ããã¨ã³ã¸ã³ã®BaseEngine.iniå é¨ã«Defaultå¤0.1ã¨è¨è¼ããã¦ãã¾ãã
- CVaråããã¦ãã¾ããï¼ãªã®ã§åçå¤æ´ã¯ä¸å¯ã§ãã (ã§ãããè¡ãããå ´åã¯æ¡å¼µãã¦é ããã°ããå®è£ ãè¦ã¦ããéãåé¡ãªãã¯ãã§ãã)
- 1.0ã¨ãããã¨ã§ãå ¨ãªãã¸ã§ã¯ããæ¯ãã¬ã¼ã Occlusion Cullingã«æå ¥ãããããã«ãªãã¾ãã
- ãªãã¸ã§ã¯ããå°æããç»é¢ã®ãã¯ã»ã«ã®å²åããã®å¤ããã大ããã¨ãããã«ä½ã確çã§ãã®ãªãã¸ã§ã¯ããæå ¥ãããã¨ãã¾ãã(ã¤ã¾ããç»é¢ãå ããå²åã大ãããªãã¸ã§ã¯ãã¯ç´ãã«ã«ãªã³ã°ãããã§ã¯ãªãã ããã¨ããç®æ®µã§ããã)
以ä¸ã§ããæå¾ã«æ³¨æç¹ã ããã§å«ãªæãã«ãªã£ã¡ãã£ãããããã¾ããããå¼·åãªæé©åææ³ãªã®ã§ã·ã§ã¢ããã¦ããã ãã¾ããã次ã¯ãRwiããã®ãUE4åå¿è
ã«ããå
¬å¼ããã¥ã¡ã³ãã®å¤§äºãããªç¹ã¾ã¨ã+αãæ¸ãã¾ãï¼ã§ãã
ãããã¨ããããã¾ããï¼
Testãã«ãã§ãè²ã è¨æ¸¬ã§ããããã«ãã
Developmentãã«ãã§æ£ç¢ºãªCPUè² è·ãå³ãã®ã¯é£ãã
UE4ã§ã¯ãæ¥ã
ã®éçºã¯Developmentãã«ãã§è¡ããæçµçã«ãªãªã¼ã¹ããããã±ã¼ã¸ã¯Shippingãã«ãã§ä½æããã®ãåºæ¬çãªããã¼ã¨ãªãã¾ããããããDevelopmentãã«ãã¯ãã¼ã¿ã®æ´åæ§ã®ç¢ºèªã§ãã£ãããã¼ã¿ãéè¨ãã¦ãããã¨ãå®éã«ãªãªã¼ã¹ãããã²ã¼ã ã§ã¯é¤å¤ããããããã°ç¨ã³ã¼ãã沢山å«ã¾ãã¦ãã¾ããçµæãDevelopmentãã«ãã®CPUå¦çè² è·ã¯Shippingãã«ãã«æ¯ã¹ã¦èããéãããå®éã«ãªãªã¼ã¹ãããã²ã¼ã ã®CPUå¦çè² è·ãè¨æ¸¬ããã®ã«ã¯é©ãã¦ãã¾ããã â»Developmentãã«ãã§ã¯æ§ã
ãªUE4ã®statæ©è½ã使ãã¾ããããããé§ä½¿ãã¦å¦çå
容ãç解ãããæå
¥ããã¦ãããªãã¸ã§ã¯ãæ°ãªã©ãç¥ããã¨ã«é©ãã¦ããã¾ãã
æ£ç¢ºãªCPUè² è·ã®ãã©ããã³ã°ã«ã¯Testãã«ãã
ããããShippingãã«ãã¯å®éã«ã¦ã¼ã¶ã«è§¦ãããããã«ããªã®ã§ãstat unitã¯ãããã³ã³ã½ã¼ã«ã¦ã£ã³ãã¦ãªã©ãéãããã¦ãã¾ãã¾ãããªã®ã§ããªãã¹ã製åã«è¿ãç¶æ
ã§ã³ã³ã½ã¼ã«ã¦ã£ã³ãã¦ãªã©æä½éã®æ©è½ã®ã¿ã許å¯ããTestãã«ãã¨ãããªãã·ã§ã³ãUE4ã«ã¯ããã¾ãã (â»Testãã«ãã¯ãã¨ã³ã¸ã³ã«ã¹ã¿ã ãã«ãã®ã¿ã®æ©è½ã§ãã©ã³ãã£ã¼ããè½ã¨ãUE4ã§ã¯Testãã«ãã¯ãªãããã§ãã)
Build.hã®defineãè¨å®ãã¦ãèªå好ã¿ã®Testãã«ãã
ããããTestãã«ãã¯ããã©ã«ãã§ã¯ãã°ãªã©ã®æ©è½ãOffã«ãªã£ã¦ãããããã ã¨ãGCã®è² è·ã®ãã°ã...ãã¼ãæéã...ããªã©ã¨ãã£ãã¨ãã«éå®ããUE4ã®Logã³ãã³ãã使ããªããªã£ã¦ãã¾ãã¾ãããã ããã¯ããã©ã«ãã§ãªããªã ãã§ãã¦ã¼ã¶ãBuld.hã¨ããä¸ã¤ã®ãã¡ã¤ã«å
ã®defineãããããè¨å®ãããã¨ã§ã«ã¹ã¿ãã¤ãºå¯è½ã§ããä»åã¯èªåããã¤ãTestãã«ãã§å¤æ´ãã¦ããè¨å®ãç´¹ä»ãã¾ãã
Testãã«ãã§ããã°ãåºåããæ¹æ³
ã¨ã³ã¸ã³ããã®æ
å ±ã®ã¢ã¦ãããããéãããã¦ããã®ã§ãã¾ãã¯ãã°åºåæ©è½ãONã«ãã¾ããï¼ç¹ã«GCã®è² è·ãç´°ããè¨æ¸¬ããããã«ããLogGarbage ã®æ
å ±ãªã©ã¯å¿
é ã§ããï¼
Testãã«ãã§ãNamedEventsãåºåããæ¹æ³(4.19ãã)
åCPU Profilerãªã©ã§CPUã®å¦çè² è·ãé層çã«è¨æ¸¬ããããã®NamedEventsããTestãã«ãã§ãONã«ãããã¨ãã§ãã¾ãã
注æç¹ã¨ãã¦ãã®defineã¯UE4ã®statæ©è½ãoffã«ãã¦ãã¾ãã®ã§ãã®ã¾ã¾1ã«ããã¨Developmentãã«ãã§statæ©è½ã使ããªããªã£ã¦ãã¾ãã¾ããä¸ã®æ§ã«Testã§å²ãã§1ã«ãã¦ããã¦ãã ããã
Testãã«ãã§ãProfileGPUãè¡ãæ¹æ³
GPUè² è·ã¯Developmentãã«ãã§è¦ã¦ãåé¡ãªãã®ã§ãããProfileGPUã§ã¬ã³ããªã³ã°å
容ãç°¡åã«ãããã¨ãã§ããã®ã§ãCPUã§ãRender Threadã®è§£æã«ã¯ä¾¿å©ã ã£ãããã¾ãã
ãªã©ãªã©ããã®ä»ã«ãBuild.hã«ã¯æ²¢å±±ã®è¨å®ãããã¾ãã®ã§ãèªèº«ãè¨æ¸¬ãããå 容ã«åºã¥ãã¦DefineãONã«ãã¦ã¿ã¦ãã ããã
UE4åã¯UE5ã§.iniãã¡ã¤ã«ã®è¨å®ãã³ãã³ãå¼æ°ã§ä¸æ¸ãããæ¹æ³
UE4ã«ã¯æ§ã ãªè¨å®ã.iniã¨ããæ¡å¼µåã®ãã¡ã¤ã«ã«è¨å®ã§ãã¾ãããããã¯Shipping以å¤ã§ã¯ã©ã³ã¿ã¤ã ã§å¤æ´å¯è½ãªã®ã§ãããèµ·åæã«èªã¾ããè¨å®ãªã©ã¯ã©ã³ã¿ã¤ã ã§å¤ãã¦ãå¿è«å¹æãããã¾ããããªã®ã§ãèµ·åæã«ã¯.iniã®å¤ãè²ã å¤ãã¦ç½®ãããã¨ããã®ã¯ããããéè¦ã§ããç¹ã«ããã¤ããªã¼ã§ãã«ãããå種ãã©ãããã©ã¼ã ç¨ãã«ãã®åä½ç¢ºèªãã¦ããã¨ããããã®è¨å®å¤ãããã©ããªãã ããï¼ï¼ãã¨æã£ã¦ãã.iniãã¡ã¤ã«ã1è¡æ¸ãæãã¦ããã±ã¼ã¸ããªããã®ã¯ãã¯ãé¢åããããã¾ãã
ãããã£ãã¨ãã®ãããUE4ã§ã¯å®è¡æã®å¼æ°ã§.iniãã¡ã¤ã«ãä¸æ¸ãã§ãã¾ãã
-ini:Engine:[ConsoleVariables]:r.screenpercentage=2000000,[/Script/Engine.GarbageCollectionSettings]:gc.MaxObjectsNotConsideredByGC=1
ãããªæãã§ãã(è¨å®å¤ã«ã¯æªæãããã¾ãã)
è¨èã§ããã¨ä»¥ä¸ãªæãã§ãã
-ini:(.iniãã¡ã¤ã«ã®Prefixãªãã®åå. Engineã¨ãGameã¨ã):(å¤æ°ã®ã«ãã´ãª):(å¤æ°=è¨å®å¤),....
ã¹ãã¼ã¹ã¯ã©ãã«ãå
¥ããããªãã®ã§ã.iniããã³ãããã¦ããã¨å¡ãã¹ããã®ã§ãæ°ãã¤ãä¸ããã
èªåã¯ããã¼ããGCãªã©ã®èª¿æ»ã§ã¯ãããæ¬å½ã«å½¹ç«ã£ã¦ãã¦ãã使ãã¾ãã
CustomDepthãæ¡å¼µãã¦è²ãåºåãã¦ã¿ãã
ãã®è¨äºã¯ UE4 Advent Calender 2015 その1 ã®16æ¥ç®ã®è¨äºã«ãããã¾ãã
ååã®è¨äºã¯@nano06126728ããã®ä½ãé©å½ã«ã ãã¦ã¿ã¾ãã§ããã
ãã£ããã¨: ã«ã¹ã¿ã ããã¹è¨ç®æã«ã«ã©ã¼ãã§ããããã«ãã¾ããã
æ¬æ¥ã®ãããªã¢ã«ã§ã¯ãPixelDepthOffsetãä¸çªä¸ã«æ¥ã¦ããã¨æãã¾ãããããã«CustomColorã¨ããé
ç®ã追å ãã好ããªå¤ãå
¥ããããããã«ãã¾ããã
ããã§åºåããCustomColorã¯G-Bufferã®æ¡å¼µé åã¨ãªãã¾ãã®ã§ããã¹ãããã»ã¹ãããªã¢ã«ã®SceneTextureã§åç
§ãããã¨ãã§ãã¾ãã
é対象è : æ¡å¼µãããã¨ã³ã¸ãã¢ã®æ¹ã¸
å ·ä½çãªæ¡å¼µã®è©±ã¯ãã¾ããã使ãéã¨ä»çµã¿ã«ã¤ãã¦ç°¡åã«èª¬æãã¾ãããããå ·ä½çãªæ¡å¼µæ¹æ³ãæ°ã«ãªãæ¹ã¯ä»¥ä¸ã®ã³ã¼ãã«å¾ã£ã¦ãã ãããã
if (ã¨ã³ã¸ãã¢ã§ããããï¼) { return; //ãã®ããã°ãéãã¦ãPixelDepthOffsetã®å®è£ ãã¾ãã¦ãã ãã }
ãªãå®è£ ããï¼: â æ¥æ¬ã§æµè¡ããã³ãã©ããCustomDepth/Stencilããã¹ã¯ã¨ãã¦è¡ã£ã¦ãããã®ãããã
ãåç¥ã®éãããã³ãã©ãã¬ã³ããªã³ã°ãæ¥æ¬ã§æµè¡ã£ã¦ãããUE4ã§ãæ§ã
ãªæ¹ãææ¦ãã¦ããã¾ããã¨ããã¯ã²ã¼ã ãºã¸ã£ãã³ã®ä¸ç°ããããUnrealFes2015ã§ãã³ãã©ãã®è¬æ¼ãè¡ã£ã¦ãã¾ãã
forums.unrealengine.com
ããã§ãらりほまããã®ä¸è¨ã®ããã°ãè¦ã¦ã¿ãã¨ãCustomDepthã«ããã¨ãã¸ã®ãã¹ã¯ã®è¨è¼ãããã¾ãã
Dè¨èªãã以å¤ã®ãªãã¸ã§ã¯ãã«ãã¯ãªã¼ã¹ç·ã¨è²ã®å¢çç·ãæç»ããã¦ãã¾ã£ã¦ããã®ã§ããã¹ãã³ã°ãè¡ãã¾ããCustomDepth ããã¹ã¯ã¨ãã¦å©ç¨ãã¾ãã
UE4 にて特定の Actor に対して輪郭線・クリース線・色の境界線を描画する、あるいはD言語くんを真の姿にする方法 | rarilog
ä¸è¨ã®ç»åã®ããã«é°ãèæ¯ã«ä¸è¦ã«ã¨ãã¸ãããã£ã¦ãã¾ãã®ãé²ãããã«ããã¹ã¯ãå¿
è¦ã¨ãã訳ã§ããããã»ã¾ãããç»åã®è»¢è¼è¨±å¯ãããã¨ããããã¾ãï¼ï¼
ãªãå®è£ ããï¼: â¡Customdept/Stencilhã§ã¯æ å ±ã足ããªãã
便å©ãªCustomDepthã§ããããã®ãªãã¸ã§ã¯ããåºåããããã¹å¤ãä¿åããæ©è½ãªã®ã§ã®ã§ãã¦ã¼ã¶ãèªç±ã«å¤æ´ãããã¨ã¯ã§ãã¾ããã
ãã®ãããUE4.9ãããCustomStencilã«ãã£ã¦å¥½ããªå¤ãï¼ã¤åºåã§ããããã«ãªãã¾ããã
ãããããã®ã¹ãã³ã·ã«ãåé¡ãããã¾ãããã®ã¹ãã³ã·ã«å¤ã¯ãã¡ãã·ã¥ã®ã¬ã³ããªã³ã°é
ç®ã§ã®ã¿è¨å®ã§ãã¾ãã
ã¤ã¾ããã¡ãã·ã¥åä½ã§ä»»æã®ä¸ã¤ã®å¤ããåºåã§ãã¾ãããï¼ã¤ã®ã¡ãã·ã¥ã®ä¸ã§ãããã£ã©ã¯ã¿ã®ç®ãçæ¯ã«ã¯ã¨ãã¸ãããã¦ã»ãããªãã¨ããããé¼»çã®ã¨ãã¸ã©ã¤ã³ã¯é常ã«ç´°ããããã¨ããããã¨ãã¸ããã詳細ã«èª¿æ´ãããã¨ãªãã¨ãã¹ãã³ã·ã«ãããã¹å¤ã§ã¯éçãããã¾ãããããªãããªã§ãããã¹ãã¹ãã³ã·ã«ãåºåãããªãã°ãã«ã©ã¼ãä¸ç·ã«åºåããããã«ããã°ããããããããã¦ããã®å¤ã好ãã«ãããªã¢ã«ã§èª¿æ´ã§ããã°ããã¹ã¯ã ããããªãã¦ç¹æ®ãªä½¿ãæ¹ããããå ´åãªã©ãå¹ åºãè²¢ç®ã§ããããªã¨æã£ã¦ä½ã£ã¦ã¿ã¾ããã
使ç¨ä¾
ããããªãããå
·ä½çã«ãã³ãã©ãã¬ã³ããªã³ã°ã«é©ç¨ãããã£ããã§ãããã¢ã»ãããéã«åãã¾ããã§ããããåºæ¬çã«ã¯ã好ããªãã®ãåºåãã¦å¥½ãã«ä½¿ãã°ããã ãã§ããä¸ä¾ã¨ãã¦ã¯ãã«ã¹ã¿ã ããã¹ãã¹ãã³ã·ã«ã®ãã¹ãã³ã°ã§ã¯å¶å¾¡ã§ããªããããªãã¹ã¯ãä½ããã¨ã§ãããããä¾ãã°ä¸è¨ã®ããã«ããã®ã¾ã¾ã®ã¨ãã¸æ½åºã¢ã«ã´ãªãºã ã ã¨ãç®ãå£ãé¼»ã«éå°ãªã¨ãã¸ãåºã¦ãã¾ãã¾ããï¼å®ã¯ãã®ã¨ãã¸ã¢ã«ã´ãªãºã ã ã¨çæ¯ãã»ãã®ã赤ããªããï¼
CustomColorã§ãã¹ãã³ã°ãã¦çããã¨ãã§ãã¾ãã
å¾ã¯ãããªã¢ã«IDãªã©ãã¨ãã¸ã®è²ã太ãã®å¶å¾¡ãªã©ããããããã¨ããèªç±ã«ã¨ãããã®ã§ãããã®ããã«ã¨ãã¸ãç´°ããå¶å¾¡ãã¦å®éã®è£½åã§å®ç¾ãããã®ãã俺å±2ã§ããCEDECã§å
·ä½çãªå®è£
ã«ã¤ãã¦èª¬æãã¦ãã¾ãã®ã§ããåèã«ãã¦ãã ããããã³ãã©ãã¬ã³ããªã³ã°ã¯ãå¶å¾¡ã®é£ãããããæ¤è¨¼ã¬ãã«ã¾ã§ã¯ããããã®ã®ãããã¯ã·ã§ã³ã¬ãã«ã¾ã§æã£ã¦ãã®ãé常ã«é£ããæè¡ãã¨æãã¾ãããããæºå¸¯å¨PSVitaã§å®ç¾ãããç´ æ´ãããæåä¾ãã¨æãã¾ãã
cedec.cesa.or.jp
www.inside-games.jp
注æç¹: CustomDepthã«ã¯è² è·ãããã¾ãããªãã¸ã§ã¯ããããä¸åº¦æå ¥ãã¦ã¬ã³ããªã³ã°ãã¾ãã
ProfileGPUãè¦ãã¨G-Bufferãä½æãã"BasePass"ã¨ãããã®ã¨ã¯å¥ã®å ´æã«CustomDepthã¨ããé ç®ãããã¾ããCustomDepthãOnã®ãªãã¸ã§ã¯ãã¯ãããä¸åº¦GPUã«æå ¥ããããã¹ãè¨ç®ããããã追å ã®è² è·ããããã¾ãã(æ¬å½ã¯ãããä¸åº¦æå ¥ãããªãã¦æ´æã«åºãã®ãªãã°ã«ã©ã¼ãåºãã¦ãã¾ãã¨æã£ã¦æ¡å¼µãããã®ãçºç«¯ã§ãã)
èªãã§ããã ããããã¨ããããã¾ãã
ææ¥ã¯ãntaro@年末に向けて準備中 (@tarotarokun) | Twitterããã®ãæ¨æºã®UE4ã ã¨Windowsã®ãã«ãã¿ããã使ããªãããã®å¯¾å¿æ¹æ³ãæ¸ãã¾ããã§ããã¤ã³ãããããã¤ã¹é¢é£ã«ã¯çãã®ã§ãåå¼·ããã¦ããã ãã¾ãï¼
Stationary Light ã®å½±ã«ã¤ãã¦
ãã®è¨äºã¯Unreal Engine 4 (UE4) 其の弐 Advent Calendar 2015ã®16æ¥ã®è¨äºã§ããæ¨æ¥ã¯じゅる (@xxJulexx) | Twitterããã®映像クリエータ視点な使い方とか。ã§ãããããããã³ã³ãã¸ããããªãã©ã¤ã³ã§ãããã¨ãåæã«ãBasePassã¨ä¸é¨ã®ãã¹ãã¨ãã§ã¯ãããã®ã¾ã¾åºåã§ããæ©è½ãããã°ãUE4ã®æ åå¶ä½ããã£ã¨æãããã§ããã
ä»åã¯ã©ã¤ãã£ã³ã°ã®ç´°ãã話ããããã¨æãã¾ãããªãã¨ãªãè¨å®ãã¦ãã人ãå¤ããã¹ãã¼ã·ã§ããªã¼ã©ã¤ãã®ä»çµã¿ã§ããã«ã¿ã«ãã¨è±èªãä¹±ç«ãã¾ãããæ°ãåãããç´ããã¦ãã ããã
UE4ã®ã©ã¤ãã£ã³ã°ã¯æ§ã ãªçµã¿åããã«å¿ãã¦å é¨å®è£ ãå¤ããã¾ã
é«ã¯ãªãªãã£ãªã©ã¤ãã£ã³ã°ãåºãã¤ã¤ãä¸å®ã®ããã©ã¼ãã³ã¹ãåºãããå ´åãªã©ã§ã¯ãä½æããã©ã¤ãã£ã³ã°ç°å¢ãå
é¨ã§ã©ããªè¨ç®ããã¦ããããææ¡ããå¿
è¦ãããã¾ãã
ä»åã¯ãä¸éæ(Maskedãå«ã)ãªãã¸ã§ã¯ãã«å¯¾ãã¦ãStationary Lightã®å½±ãã©ããªåä½ãããããç°¡åã«èª¬æãã¦ããããã¨æãã¾ãã
話ã¯StaticãªMeshãMovableãªMeshãã§äºåããã¾ãã
Static Meshã®å½±ã«ã¤ãã¦
Stationary Lightã¯ãªãã§5å以ä¸éãã¡ããããªãï¼
ã¹ãã¼ã·ã§ããªã¼ã©ã¤ãã®é°ã§ãããå ¬å¼ãµã¤ãã§ã¯ãã®ããã«è¿°ã¹ããã¦ãã¾ãã
ã©ã¤ãã㹠㯠Stationary light (åºå®ã©ã¤ã) ã«å¯¾ã ãã£ã¹ã¿ã³ã¹ ãã£ã¼ã«ã ã·ã£ãã¦ããã ãçæãã¾ãã
...
ã©ã¤ãã¯ãã·ã£ãã¦ããã ãã¯ã¹ãã£ã®ç°ãªããã£ã³ãã«ã¸ã®å²ãå½ã¦ãå¿ è¦ãªããã 4 ã¤ã¾ãã¯ãã以ä¸ã®ãªã¼ãã¼ã©ãããã Stationary light (åºå®ã©ã¤ã) ã®ã¿ãéçã·ã£ãã¦ã表ç¾ãããã¨ãã§ãã¾ãã
Unreal Engine | Stationary lights (固定ライト)
ã©ããä¸åã®ãªãã¸ã§ã¯ãã«5å以ä¸ã®ã¹ãã¼ã·ã§ããªã¼ã©ã¤ããéãªãã¨ããã®ã©ã¤ãã®ä¸ã®ï¼åã¯ã¹ãã¼ã·ã§ããªã¼ã©ã¤ãç¨ã®ã·ã£ãã¦ãããã§ã¬ã³ããªã³ã°ã§ãã¾ãããæ®ãã®ã©ã¤ãã¯ã·ã¼ã³å
¨ä½ãåçã«ã·ã£ãã¦è¨ç®ãããã¨ã«ãªãã¾ãã5å以ä¸ã¹ãã¼ã·ã§ããªã¼ã©ã¤ããéãªãã¨ãUE4ã¯èªåçã«ãã©ã®ã©ã¤ããåçã·ã£ãã¦è¨ç®ã«ããã決ãã¾ããä¸ã®å³ã§Ãå°ãã¤ãã¦ããã®ãåçè¨ç®ã¨ã¿ãªãããã©ã¤ãã§ããæ®å¿µãªããã©ã®ã©ã¤ãã仲éå¤ãã«ããããèªåã§æ示ã§ããªããã§ãã
ããã¾ã§ã¯ã¿ãªãããåç¥ãã¨ãæãã¾ããã§ããããããªãã§ãªãã§ãããï¼ï¼
ã¹ãã¼ã·ã§ããªã¼ã©ã¤ãã®ã·ã£ãã¦ããããæã¤ã®ã¯ã©ã¤ãã§ã¯ãªãã(ã¹ã¿ãã£ãã¯ãª)ã¡ãã·ã¥ã§ãã
ã¹ãã¼ã·ã§ããªã¼ã©ã¤ãã®ã·ã£ãã¦ãããã¯ãã·ã¼ã³ã«ç½®ãããåã¹ã¿ãã£ãã¯ã¡ãã·ã¥ãæã¡ã¾ããã¹ã¿ãã£ãã¯ã©ã¤ããã©ã¤ããããã«ãã¤ã¯ãããã®ã¨åæ§ã§ãããã®æ¶è²»ãã¼ã¿ã¯ãStatãè¦ã㨠NumSM / TextureSMã¨ãã£ãé
ç®ã§ç¢ºèªã§ãã¾ãã
NUM SMã5ã¨æ¸ãã¦ããã®ã¯ãéãªã£ã¦ããã©ã¤ããã«ã¦ã³ãããã¦ããããã§ãããTextureSMã®ãµã¤ãºãè¦ãã¨ã4åã®ããããæã£ã¦ãããã®ã¨ãã¼ã¿éãå¤ãããªãã®ãããããã¨æãã¾ããå®ã¯ãã¹ãã¼ã·ã§ããªã¼ã©ã¤ãã¯èªèº«ã«ã©ã¤ãã®ã¤ã³ããã¯ã¹çªå·ã1ã¤(0~3ã®å¤)æã¡ããã®ã¤ã³ããã¯ã¹ã«å¯¾å¿ããã·ã£ãã¦ãããã«èªèº«ã®å½±ãæ¸ãè¾¼ãã®ã§ãããã®ã¤ã³ããã¯ã¹ã¯UE4ãåæã«å é¨ã§æ±ºãã¾ãã
ã©ã®ã©ã¤ãã仲éå¤ãã«ãªãã®ãï¼ãæ°ã«ãªãæ¹ã¯ULightComponent::ReassignStationaryLightChannelsé¢æ°ã®ä¸èº«ãåèã«ããã¨è¯ãã¨æãã¾ãã
Stationary Lightã®Shadow Mapã¯ãG-Bufferãçµç±ãã¦ã©ã¤ãã£ã³ã°è¨ç®æã«åç §ããã¾ã
ä¸å³ã®ããã«ãã¹ã¿ãã£ãã¯ã¡ãã·ã¥ã«ç¼ãããã·ã£ãã¦ãããã¯G-Bufferã«åãè¾¼ã¾ãã¦ãã©ã¤ãã£ã³ã°è¨ç®ã«éããã¾ããã¹ãã¼ã·ã§ããªã¼ã©ã¤ãã®ããã®è¨ç®ãG-Bufferã®åå¾ã«ããã®ã¯éå¹çã«è¦ããããããã¾ãããã§ãããã©ã³ã¿ã¤ã ã§ã®ããã¹æ¯è¼ãç¨ããã·ã£ãã¦è¨ç®ããªããããé«éãã¤é«ç²¾ç´°ãªå½±ãã¹ãã¼ã·ã§ããªã¼ã©ã¤ãã§å®ç¾ã§ãã¦ããã®ã§ãã
ããããã¹ã¿ãã£ãã¯ãªã¡ãã·ã¥ãã¹ã¿ãã£ãã¯ãªã¡ãã·ã¥ã«ãã£ã¦åããã¹ãã¼ã·ã§ããªã¼ã©ã¤ãã®å½±ã®è¨ç®ã§ããã¤ã¾ããåçãªãã¸ã§ã¯ããé¢ä¿ããå ´åããã¡ããæåã¯å¤ããã¾ãã
Movable Meshã®å½±ã«ã¤ãã¦
Movable ObjectãStationary Lightã«åã¼ãå½±
次ã¯Movableãªã¡ãã·ã¥ãStationary Lightãåã¼ãå½±ã«ã¤ãã¦ã§ããä¸è¨ã§ã ãã ã話ãã¦ããã·ã£ãã¦ãããã®ãã¨ã¯ããå
¨ãé¢ä¿ããã¾ãããå¿ãã¦ãã ããã話ãå¤ãã¦ã以ä¸ã®ãããªãã¤ã³ãã©ã¤ãä¸åã®ã·ã¼ã³ãèãã¾ããå¨ãã«æµ®ãã¦ããã®ã¯ãã¹ã¦Movableã«è¨å®ããããªãã¸ã§ã¯ãã§ãã(注: Directional Lightã¯Cascade Shadowã使ããã®ã§ä»åã¯ãã¤ã³ãã©ã¤ããã¹ãããã©ã¤ãã«éå®ãã¾ããå¾ã§èª¬æãã¾ãã)
ãã®ã¨ããStationary Lightã¯ãMovableãªMeshæ¯ã«ã·ã£ãã¦ããããã¤ããã¾ããå®éã«ã·ã£ãã¦ãããããã£ããã£ããã¨ä»¥ä¸ã®ãããªãã¯ã¹ãã£ã§ãã
å·¦ä¸ã«å°ãããªãã¸ã§ã¯ããæç»ããã¦ããã®ããããã§ããããï¼å·¨å¤§ãªã·ã£ãã¦ãããä¸æãã°ãªããä¸ã«åå²ããåãªãã¸ã§ã¯ããåã¼ãã·ã£ãã¦ããããä½ã£ã¦ãã¾ãã
ãã®å¾ãå
¨ã¦ã®Meshæ¯ã«ãShadowã®å½±é¿ãã¬ã³ããªã³ã°ããã¾ããå®éã«ä¸ã¤ã®ãªãã¸ã§ã¯ãã«å¯¾ãã¦ã©ã¤ãã£ã³ã°ãããçµæãè¦ãã¨ã以ä¸ã®ãããªé»è²ãé¨åããï¼ã¤ã®ãããªãã¸ã§ã¯ããé¢ä¸ããå½±é¨åã®æç»ã§ãã(æç»ç¯å²ã¯Shadow Frustumã®ã¹ãã³ã·ã«ãã¹ãã§æå®ãã¦ãã¾ãã)
ã¤ã¾ããMovable Meshã«æ¼ããStationary Lightã®å½±ã®ã³ã¹ãã¯ä»¥ä¸ã«ãªãã¾ãã
Movable Meshã«ãããStationary Lightã®å½±ã®ã³ã¹ã =
ã©ã¤ãã®å½±é¿ä¸ã«ããMovable Meshã®æ°ã* ä¸ã¤ä¸ã¤ã®ã·ã£ãã¦çæåã³æç»ã³ã¹ã
Stationary Lightã®Shadowã¯ãMovable Meshæ¯ã«è¨ç®ããã
(Directional Lightã¯Cascade Shadow MapãDF Shadowã«ãããã®å¶éãåãã¾ããï¼Directional Lightã®æåã¯UE4 Docãåç §ãã¦ãã ããã)
ãã¦ãå
ã»ã©ã®ããã«ãStationary Lightã®Shadowã¯ãMovableãªMeshã«å¯¾ãã¦ä¸åãã¤Shadow Mapãä½æãããã¬ã³ããªã³ã°ãä¸åãã¤è¡ãããã¨è¨ãã¾ããããã®ç¶æ³ã§ä¾ãã°ãã©ã¤ãã®å½±é¿ç¯å²å
ã«æ²¢å±±Movable Meshãããã¦ã¿ã¾ãã
ããã ãç½®ããå¾ã®ShadowMapã¯ä»¥ä¸ã®ããã«ãShadowMapã§æç»ããããªãã¸ã§ã¯ããå¢ãã¦ããã®ããããã¾ãã
ããã¦ããã®ãã¨ãã®å¤§éã®ãªãã¸ã§ã¯ãï¼ã¤ï¼ã¤ã«å¯¾ãã¦å½±ã®å½±é¿ãè¨ç®ãã¾ãã
å®éã«ProfileGPUã§è¦ã¦ã¿ãã¨ãShadowMapä½æãã§ã¤ãºã®ShadowDepthsFromOpaqueProjectedã§å¤§éã®ã¡ãã·ã¥æ¯ã®ã·ã£ãã¦ããããä½æããã¦ããã®ããããã¾ããä¸å³ã®èµ¤ãã·ã£ãã¦ããããä½æãã¦ãããã§ã¤ãºã§ããã
ãã®ãã¨ãå®éã®å½±ã®å½±é¿ãè¨ç®ãããã§ã¤ãºã®ShadowProjectionOnOpaqueãè¦ã¦ã¿ãã¨ãåã¡ãã·ã¥ã«å¯¾ãã¦ãå®éã®ã·ã£ãã¦ãè¨ç®ãã¦ããã®ããããã¾ãã
ãããStationary Lightã®å½±é¿ç¯å²å ã«MovableãªMeshã大éã«ç½®ãã¨éããçç±ã§ãã
Stationary Lightã¯ãMovable Meshæ¯ã«å¥ã
ã«å½±ã®è¨ç®ããããå¥ã
ã«å½±ã®è¨ç®ããããããMovable Meshãå¢ããã°å¢ããã»ã©ã³ã¹ãã®å¢å¤§ãæ¿ããããã®ä¸æ¹ãLightãMovableã«ããã¨ãShadowã¯Meshåä½ã§ã¯ãªããã©ã¤ãä¸åã«å¯¾ãã¦ã¾ã¨ãã¦è¨ç®ããã¾ãã
ãªã®ã§ãStationary Lightã®å¦çè² è·ã¯MovableãªMeshã®æ°ã«ä¾åãã¦ãã¾ãã®ã§ããã®ããã«åçãªãªãã¸ã§ã¯ãã«å¯¾ããå½±é¿ãå¤ãã©ã¤ãã¯Movableã«ããã»ããå½±ã®ã³ã¹ããä¸ãããã¨ãããã®ã§ãã
確èªã®ããã試ãã«ãã©ã¤ããMovableã«ãã¦ã¿ã¾ãã
ãããã¦ãããã¡ã¤ãªã³ã°ããã¨ãå½±æç»ãWholeSceneã¨ããä¸ã¤ã«ã¾ã¨ãããã¦ãåè¨ã®æç»ã³ã¹ããä¸ãã£ã¦ããã®ããããã¾ããã·ã¼ã³å
¨ä½ã§ä¸ã¤ã®ã·ã£ãã¦ããããä½æãä¸åã§ã¬ã³ããªã³ã°ããMovableã®ã©ã¤ãã®æ¹ããMovableãªMeshæ¯ã«å½±ãæç»ããStationary Lightã®å½±ãããå¦çè² è·ã軽ããªãè¯ãä¾ãã¨æãã¾ãã
Directiona Lightã®å½±ã«ã¤ãã¦
ã説æã®éããã©ã¤ãã®å½±é¿ä¸ã«ããMovableãªMeshã¯ãã®ã¾ã¾å½±çæã®ã³ã¹ãã«ã¤ãªããã¾ããä»ã¾ã§ã®èª¬æã¯Point Lightã§è¡ãã¾ããããDirectional Lightã¯åºæ¬çã«ã·ã¼ã³å
¨ä½ã«å½±é¿ãåã¼ãã®ã§ããã§ã¯åé¡ã§ãããã®ããããããDirectional Lightã¯åºæ¬çã«ãå½±æç»ãCascade Shadow Mapã§è¡ãããã«ãã¦ãã¾ããã§ãã®ã§ãä¸è¨ã®ã·ã¼ã³ããããã¡ã¤ã«ããã¨ã«ã¹ã±ã¼ãã·ã£ãã¦ã«ãã£ã¦ã·ã¼ã³ãåå²(Split)ããã¦å½±æç»ããã¦ããã®ããããã¾ãã
ã§ãã®ã§ãæ®æ®µä½¿ããã¦ããéDirectional Lightã§Movableãªã¡ãã·ã¥ã«ããã³ã¹ãã ããæ°ã«ãªããã¨ã¯å°ãªãã¨æãã¾ããä¸å¿Cascade Shadowã®å¤ã®ãªãã¸ã§ã¯ãããã¤ã³ãã©ã¤ãã¨åãææ³ã«ãã£ã¦å½±æç»ãããªãã·ã§ã³ãããã¾ããCascade Shadow Mapã®è¨å®ã®Inset Shadows For Movable Objectsã§ãã
ãã¡ããè¨å®ããDynamic Shadow Distance Stationary Lightã®è·é¢ãå°ãããã¦å
¨ã¦ã®ãªãã¸ã§ã¯ããã«ã¹ã±ã¼ãã®å¤ã«åºãã¦ã¿ã¾ããããã¨ä¸è¨ã®ããã«ããªãã¸ã§ã¯ãæ¯ã«å½±æç»ç¨ã®ãã©ã¹ã¿ã ãä½æããããã¨ãè¦ã¦åãããã¨æãã¾ãã
ãããã¡ã¤ã«ãã¦ãåãªãã¸ã§ã¯ãã®ã·ã£ãã¦ã³ã¹ããçºçãã¦ããã®ããããã¾ãã
èªãã§ããã ããããã¨ããããã¾ãã
ã¾ã¨ããã¨ãStationary Lightãä½ãå½±ã¯ããã
- StaticãªMeshã®å ´åããã®ã·ã£ãã¦ãããã¯ï¼ã©ã¤ããããã¨åæ§ã«ï¼äºåã«è¨ç®ãããåMeshãæã¡ã¾ããã¬ã³ããªã³ã°æã¯ãã®å¤ãèªã¿è¾¼ãã ãã§å½±ã®å¤ããããã®ã§å¦çè² è·ã軽ãã§ãã
- MovableãªMeshã®å ´åããã®ã·ã£ãã¦ã¯Meshæ¯ã«åçã«è¨ç®ããã¾ãã沢山ã®MovableãªMeshãå½±é¿ãåããå ´åãMovable Lightã«ããã»ããå¦çã軽ããã¨ãããã¾ãã
ææ¥ã¯ãntaro@年末に向けて準備中 (@tarotarokun) | Twitterããã®ãC++ã使ã£ãSocketã使ã£ãéä¿¡å¨ãã®æ¸ãæ¹ã解説ããããã§ãã
éä¿¡å¨ãã®æ
å ±ãã©ãã©ãå
å®ãã¦ãã¦ã¦é常ã«ãããããã§ãï¼æ¥½ãã¿ã§ãï¼
ãã¼ãã£ã¯ã«ã«Light追å ãããGPUè² è·ãè·³ãä¸ãã£ã話
çºç«¯: ãã¼ãã£ã¯ã«ç½®ããã"Tiled" Deferredãèµ°ãããã«ãªã£ãã
ä½ããªãã·ã¼ã³ã
ãããã¡ã¤ã«ãã¦ã¿ããã©ã¤ãã£ã³ã°ã¯1.0msãããã
(Startar Contetnsã®)P_Sparksãããã¦ã¿ãã
ãããã¡ã¤ã«ãã¦ã¿ããã©ã¤ãã£ã³ã°ã¯4.03ms!!!!
TiledDeferredã¨ããå¦çãèµ°ãããã«ãªã£ã¦ããã
ã©ããã¦ï¼ ãã¼ãã£ã¯ã«ã«ã©ã¤ãã¢ã¸ã¥ã¼ã«ãããããã§ãã
ã¨ãããã¨ãèµ·ãã¾ãããå®ã¯ããã¼ãã£ã¯ã«ã®ã©ã¤ããä¸åã§ãããã¨ãè£ã§ãã®"Tiled Deferred"ãèµ°ãã¾ãã
ãã®å¦çãé常ã«å¤§éæã«è¨ãã¨ãã©ã¤ããå½±é¿ãä¸ããç»åã®ç¯å²ãåãã£ã¦èª¿ã¹ãä¸è¦ãªãã¯ã»ã«ã¸ã®æç»å¦çãçãææ³ã§ãã ã©ã¤ããã·ã¼ã³ã«æ²¢å±±ããå ´åã¯é常ã«é«éã«ãªãã®ã§ãããããã©ã¤ããé«ã æ°åã®å ´åã¯éã§ããã®âåãã£ã¦èª¿ã¹ãâã¨ããé¨åã®ã³ã¹ããä¸å®éããã£ã¦ãã¾ããããããå¦çè² è·ãå¢å¤§ããã¦ãã¾ãã¾ãã ä»çµã¿ã«ã¤ãã¦è©³ãã説æãã¾ãããæ¡ã®å®ãã¤ãã©ããè¦ããã«çç´ã«ããããã®äºæ³éãå¹³ããã¨ããã¯ã°ãããã«æ£ç´ã«è¨ã£ã¦ãã¾ãã°ãããããããããã¡ãã«ã¤ãã¦è©³ããæ¸ãã¦ããã¾ãã®ã§ããã¡ããåèã«ãã¦ãã ããã
ä½è«ã§ãããUE4ã®åºæ¬è¨å®ã§ã¯ãæ®éã®ãã¤ã³ãã©ã¤ãã80å以ä¸ç½®ãã¨TiledDeferredãèµ°ãã¾ãã(ããããããããããã¨ããããã¾ãã) éãè¨ãã¨ããããããã©ã¤ãã®æ°ãå¢ããªãã¨TiledDeferredã«ããé«éåã®æ©æµãå¾ãããªãã¨ãããã¨ã§ãããªã®ã«ããã¼ãã£ã¯ã«ã®ã©ã¤ãã¯ä¸åã§ãããã¨ããã®ã¿ã¤ã«åå¦çãèµ°ã£ã¦ãã¾ãã®ã§ãã
ã§ã¯ããã¼ãã£ã¯ã«ã©ã¤ãã使ãï¼Tiled Deferredãèµ°ãããªããã¨ããæ¹æ³ã¯åããªããï¼å°ã調ã¹ã¦ã¾ããã.iniã®è¨å®çã§ã¯ã§ããªããã§ãã
ããã¾ããï¼.iniãã¡ã¤ã«ã«
r.TiledDeferredShading=0
ã¨è¨è¼ããããä¸å³ã®æ§ã«ãBlueprintã§ç´æ¥ã³ã³ã½ã¼ã«ã³ãã³ããæã¡è¾¼ããã¨ã§ãæ®éã®ãã£ãã¡ã¼ãã¬ã³ããªã³ã°ã«ãããã¨ãã§ãã¾ãã(ä¸æ¬ã§ã®å¤æ´ã®ã¿ããã®ãã¼ãã£ã¯ã«ã©ã¤ãã ãTiledã§ãããã¨ãã¯ã§ãã¾ããã)
ãã¼ãã£ã¯ã«ã©ã¤ãã¯é常ã«ç¶ºéºãªã®ã§ä½¿ããã人ã¯å¤ãã¨æãã¾ãã ãã®ãã¼ãã£ã¯ã«ã®ã©ã¤ãã£ã³ã°ã«ã¤ãã¦ã¯toaru_designerããã®ä»¥ä¸ã®ã¹ã©ã¤ããé常ã«ãããããã説æãã¦ãã¾ãã®ã§ããã¡ããåèã«ãã¦ãã ããï¼ ãã ãããã¼ãã£ã¯ã«ã©ã¤ãã®æ°ãå°ãªãå ´åã¯ãä¸è¨ã®ã³ãã³ãã§TiledDeferredãèµ°ãããªãæ¹ãè¯ãã§ãããã
ã¾ã¨ã
- åé¡
- ãã¼ãã£ã¯ã«ã®ã©ã¤ãã¢ã¸ã¥ã¼ã«ãç½®ãã¨TiledDeferredã¨ãããã®ãèµ°ã£ã¦GPUã³ã¹ããä¸ãããã©ã¤ãã沢山ããå ´åã¯é«éãªæ©è½ã ããã©ã¤ããå°ãªãå ´åã¯éã«è² è·ãé«ãã¦ãã¾ãã®ã§Offã«ããã»ããè¯ãã
- TiledDeferredãOffã«ããæ¹æ³
- ã»âr.TiledDeferredShading=0âãDefaultEngine.iniã«è¿½å
- ã»ãããã¯execute console commandã§âr.TiledDeferredShading 0âã¨æã¡è¾¼ã
- åè
- ããã¯SM5ãåãPCççã§ã®è¨å®ã§ãã試ãã¦ãã¾ããããã¢ãã¤ã«çã§ã¯ãã®TiledDeferredã®å¦çã¯èµ°ãã¾ããã試ãã¦ã¾ãããã試ãã¦ã¾ãããã©ã誰ã試ãã¦ã
åå : ãªãã§TiledDeferredãèµ°ãã®ï¼
æ¬ä»¶ã®åé¡ã¨ãªãã³ã¼ããè¼ãã¦ããã¾ãã(UE4.6ã§æ¤è¨¼)
FDeferredShadingSceneRenderer::RenderLights()
(RenderLights.cpp)å
ã®ä»¥ä¸ã³ã¼ãã§ãã
if (NumSortedLightsTiledDeferred > 0 || SimpleLights.InstanceData.Num() > 0) { // Update the range that needs to be processed by standard deferred to exclude the lights done with tiled StandardDeferredStart = NumSortedLightsTiledDeferred; RenderTiledDeferredLighting(RHICmdList, SortedLights, NumSortedLightsTiledDeferred, SimpleLights); } }
SimpleLightsãä¸åã§ãã·ã¼ã³ã«ããã¨èªåçã«TiledDeferredãèµ°ãã¾ãã ãã®SimpleLightsãã©ãããéç¨ã§çæãããã®ã詳ããè¦ã¦ãã¾ãããããã¼ãã£ã¯ã«ã®Lightã¢ã¸ã¥ã¼ã«ã¯ãSimpleLightsã¨ãã¦çæãããããã§ãã
ãã®é¨åãèªãã¨ã¢ãã¤ã«ãªã©ã§ã¯ã¿ã¤ã«ãã¼ã¹ã®å¦çã¯èµ°ããªãããã«ãªã£ã¦ããæ§ã§ããã試ãã¦ã¯ããã¾ããã
èªãã§ããã ããããã¨ããããã¾ãã
ãªããè¦ã¤ãããã¡ããã¡ããæ¸ãã¦ãã¾ãã