PDA

View Full Version : [???] Need help with "clip distance" in cameras.dat


Quagmire
10-24-07, 02:39 PM
I am trying my hand at a "bug fix" mod to the cameras.dat file and I need a little help. A while ago I had flickering textures in the control room. For example, the TDC is in the control room on the Porpoise class. Well the texture for the dials was flickering on and off when viewed from across the room. A very smart person (sorry I dont recall who) suggested that the "clip distance" in the cameras.dat file be changed to 0.001 to 0.1 in the "interior fore camera" section. Well I did this and the problem was solved! No more flickering textures on my TDC.

So I started thinking, maybe this fix would work with the flickering textures on ships. Many people have reported the problem where the textures on the sides of ships flicker at distance. This gets worse when the ship is damaged. So I started experimenting with the "clip distance" value on the exterior camera section in the cameras.dat file but so far no value change has helped.

Does anyone here have experience with this or understand the whole "clip distance" thing completely? This whole flickering textures thing really ruins what would otherwise be an excellent viewing experience.

THANKS!
.

l3th4l
10-24-07, 03:30 PM
think of it this way:

the whole scene is rendered on a coordinate system (x,y,z) relative to the camera position with z being the depth. now imagine there are only a limited amount of positions for each axis (depending on how many bits are used to store them (2^n)).
whenever two objects (polygons) occupy the same space you get that flickering effect since the engine doesn't know what to render in front and what behind.
increasing the clipping distange effectively cuts part of the scene in the forground and trades the z values used there to be used in the rest of the scene which increases the distance at which objects start to flicker because more z space becomes available for it. it's always a tradeoff so you always loose some stuff in the foreground when you try to increase the rendering accuracy in the background...

Quagmire
10-24-07, 10:25 PM
WHOA! Nice explaination. I kind of understand. So the greater the clip distance the more layers that can be displayed? I hope I just didnt seem like an idiot there... :oops:

Anyway, your explaination makes sense when discribing the control room. However why do textures flicker on the ships in the distance then? Or am I completely missing something here and it is the same thing.

Also, if the damage textures on the ships (which are flickering) are being rendered at the same level as the undamaged textures, do you know where the value is to change this so it can be rendered on top of the normal ship textures?
.

l3th4l
10-25-07, 04:21 AM
So the greater the clip distance the more layers that can be displayed?
the same amount are displayed at all times - you simply move the range away from the camera deleting (clipping) everything in front of that point - but be careful as increasing it too much will clip away a good part of the scene. look at the tbt and the binocs for example: i've increased thh tbts clipping distance in order to stop ones own sub from obscuring the view because ppl mentioned it would be unrealistic. with the binocs you can reposition yourself to look around the sub so i left the clipping range at a low value there.


Anyway, your explaination makes sense when discribing the control room. However why do textures flicker on the ships in the distance then? Or am I completely missing something here and it is the same thing.
same thing - only the scene has a lot more depth to it so problems appear sooner. (there's probably a lot of optimization going on in the background to use the z range as effectively as possible but the problem doesn't go away completely)

Also, if the damage textures on the ships (which are flickering) are being rendered at the same level as the undamaged textures, do you know where the value is to change this so it can be rendered on top of the normal ship textures?
no idea... some engines have some kind of "override" inb place for such things - kindof like saying: "when position of object a is the same as object b always render object a on top" or something like that. no idea if such a thing exist for sh4 (most likely though i imagine) and where and when it is used. i know that for particles there are switches that let you adjust the z-order of things and disable depth buffering altogether... no idea how the damage system works though.

Quagmire
10-26-07, 02:37 PM
Sadly, from what you are suggesting the flickering fix on the ships is hard coded. Bummer. Hopefully the new 20km viewing distance in patch 1.4 will solve the problem.

Thanks for the explaination though. It was VERY educational.