相机渲染剔除面具和深度 [英] Camera rendering culling mask and depth

查看:181
本文介绍了相机渲染剔除面具和深度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在2D游戏中,我有两个正交相机和两个游戏对象,一个在另一个后面。
近游戏对象有透明精灵,所以我们可以看到后面的游戏对象。
近游戏对象的深度是0,另一个是-1。我想让我的第一台相机渲染近场景,另一台相机渲染后面的游戏对象。第一个相机跟随角色,所以我想让第二个相机缓慢跟随他,并显示漂亮的图形。

In the 2D game I have 2 orthographic cameras and two game objects, one behind another. Near game objects have transparent sprites so we can see the back game object. The near game object's depth is 0 and the other one's is -1. I want my first camera to render the near scene and another camera to render the back game object. The first camera follows the character so I want the second camera to follow him slowly and to show nice graphics.

推荐答案

你只想看到一个摄像头应该放在自己的层。然后你可以使用它的相机的剔除掩码只看到那层(或让我们说层和背景层)。

The game object that you only want visible to one camera should be put in it's own layer. Then you can use its camera's culling mask to only see that layer (Or lets say that layer and the background layer).

然后对于不应该看到对象的相机,取消选中对象的图层。

以下是有关该主题的视频此处 a>从Pluralsite在Youtube上。

Then for the camera that should never see the object, uncheck the object's layer.
Here is a video on the subject here from Pluralsite on Youtube.

这篇关于相机渲染剔除面具和深度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆