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ã§ãã«ã¤ãã¦ããããªå ´åãä¸è¨ã試ãã¦è¦ã¦ãã ããã°å¹¸ãã§ãã
ãããã¨ããããã¾ããï¼