- Home /
How to exclude object from camera clipping
Hi everyone.
I want to add smoke object on skyline, but don't want to increase Camera far distance of clipping plane. How can I exclude smoke object from clipping?
Answer by 2dkot · Jun 02, 2012 at 10:40 PM
I fount solution of my issue. It is quite simple, but I should read documentation more carefully (. I add layer 8 as Smoke, than assign it to smoke objects. I did following script:
#pragma strict
function Start () {
var distances = new float[32];
distances[0] = 2000;
camera.layerCullDistances = distances;
}
function Update () {
}
And attach it to camera. This script means that for all object, which has layer 0(default), far clipping distance is 2000 for others(like smoke onbjects) far clipping distance is set in Camera settings - 5000.
Answer by drizztmainsword · Jun 02, 2012 at 01:45 PM
Here's a possible solution.
Put the smoke object in its own layer.
Have another camera that exactly matches your primary camera's positioning and movements. This camera will have a far clipping plane that goes out to the distance you want to see the smoke, and a near clipping plane far away enough to make that economical.
Now, you tell this new camera to have a layer mask that only sees the smoke, and layer it behind the rendering of your normal camera.
@drizztmainsword: You don't have enough karma yet that's why your posts are placed in the moderation queue. Be patient, someone have to verify your posts. Once you have more karma (i guess above 15) you can directly post questions or answers.
The moderation queue is far from being optimal, but it's better to fight 50+ spam posts / hour. We had a lot spam bots on UA and the moderation queue is quite effective against them.
ok, I got the idea but cant figure how to match both camera rendering. I made 1st camera as parent and second one as child, but I still see only 1st camera picture.