How to change the culling of objects too much close to camera in UDK

Hello my friends.

I am adding iron sights aiming for my game’s first person view mode, for all guns.

I got the programming part done, it was very simple, I just modified the zooming function of UTWeapon class by calling the function PlayWeaponAnimation to play some custom animations, since I created new boolean variables to store the ironsights animations, in, out and fire. In simple terms, I used a custom animation to reposition and rotate the guns to simulate the ironsights aiming.

The problem is that I don’t understand why objects which are too close to the player’s view got a bug, like backface occluding or something like, the inner part of the gun appears, and it should not appear.

Here is how the gun should look (this is inside 3dsmax)

Here is how it looks inside UDK Engine

Any help, please!

Is there some property of the skeletal mesh like culling distance, or something like?


UDKEngine.ini “NearClipPlane=10.0”

Thanks my friend, but the problem is that I am using a custom build of UDK Engine from May 2011, and in this build you can NOT change the nearclipplane in ini files. So I am kind of stuck

1 Like

Also by reading on the old udk engine forums, I have seen that changing the near clip plane can cause all sorts of rendering problems, specially regarding the depth sense of far objects.

Without C++ access, the ini file is the only way to change the near clip plane. Can you change it in any other *Engine.ini files? For example, do you have that line in you MyGameEngine.ini file?

The reason for the clipping plane is the way the depth buffer works. Depth is calculated with more precision the closer the object is to the camera. Once the object is far away, the engine makes very rough estimates of depth. That often isn’t a problem with static meshes, but decals can get very messed up if the engine doesn’t get their depth right. Setting a near clipping plane moves the depth buffer out farther. Usually if it’s just a few Unreal Units, there’s no noticeable difference. But with my game, where the camera can be thousands of UUs away from the action, I need to control the near clipping plane.

If you’re certain you can’t change the near clipping plane in the ini files, then you’ll probably need a workaround. Maybe put the camera a little farther away and decrease the field of view a little more.


Hello my friend Nathaniel, thanks for trying to help me.

Unfortunately the ability to control the NearClipPlane through ini files was added on July 2011 Build, while my custom UDK is based on the May 2011 build. However, yes, I do have C++ access, because my custom build of UDK Engine, and I already found the file where is declared the NearClipPlane:


FLOAT NEAR_CLIPPING_PLANE = 10.0f; /* Near clipping plane */

But the problem is that my PC is very old, it takes many hours the rebuild the entire UDKGame source code in Visual Studio. And also I use a lot of decals on my game’s maps, many particles also, so maybe changing the Near clipping plane for fixing my weapons can break other things.

Since I just wanted to change a bit the zoom aiming of my game, because many players complained of the zoom aiming of my game, just a non smooth transition from normal to zoomed mode, I decided to make something similar to iron sights of modern games.

And since this is just a cosmetic feature, I realized that it does not need to be exactly like those modern shooters, since I am looking for giving my game a retro vibe. So I simply changed the position of the gun on the iron sight animation, like this

As you can see, unfortunatelly the player can’t look through the scope lens, but at least it works…

1 Like