General Question Setsize and clipping

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,671
Reaction score
2,401
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
So what determines when clipping occurs? I know the distance is 2 meters. But how does it know it is 2 meters away from the surface?

The settings for the Z-buffer in the graphics card, as defined by the graphics engine you use.

A Z-Buffer is simply a system, that counts for every pixel in the image, how far the closest polygon is in the projection of this pixel. If you draw a pixel of a polygon, that is closer than the previous, you over write the Z-buffer distance and paint the pixel. If not, the painting operation is skipped.

Since even a 32 bit Z-Buffer has only 4 billion possible values and many similar Z-buffer entries cause rendering glitches (as you can often see), you need to find a compromise between covering a large distance and having a high accuracy in the distance.

This is finetuned by defining a minimum and a maximum Z-distance for the projection to the Z-buffer. If you use 1 mm steps, you could only cover 4,000 km distance in the Z-buffer, and would still be pretty coarse for a VC. 0.001 mm would result in maximal 4 km visible in the Z-buffer (too small for orbit), but you would get very good quality nearby.

And often, you can only use 16-bit Z-Buffers, which make things MUCH harder.

http://en.wikipedia.org/wiki/Z-Buffer

http://en.wikipedia.org/wiki/Z-fighting
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,779
Reaction score
2,763
Points
203
Location
Dallas, TX
Thanks. But I guess how does Orbiter know the Ummu is 2.5 or more or less from a wall/surface of a vessel? Is it in dll, cfg or mesh?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,671
Reaction score
2,401
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Thanks. But I guess how does Orbiter know the Ummu is 2.5 or more or less from a wall/surface of a vessel? Is it in dll, cfg or mesh?

Not at all. Orbiter doesn't know it. The clipping happens inside the GPU. Orbiter only tells it how to do this Z-buffering for all triangles in the scene. AFAIR, orbiter uses three rendering passes:

  • Distant planets and moons (large minimum distance, low accuracy)
  • near vehicles and bases (2.5 meters minimum, high accuracy)
  • Virtual cockpit (~25 cm minimum, very high accuracy, maximum around 20 meters AFAIR)
In your case, the clipping simply happens because these polygons are closer to the cameras position than about 2.5 meters.
 
Last edited:

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,779
Reaction score
2,763
Points
203
Location
Dallas, TX
Ok. But I have 2 vessels and one I can get to about 2.5 and then clipping occurs another clipping occurs at a further distance. That is why I question the settings (size of vessel),....
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,671
Reaction score
2,401
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Ok. But I have 2 vessels and one I can get to about 2.5 and then clipping occurs another clipping occurs at a further distance. That is why I question the settings (size of vessel),....

Maybe the vessel size is used in the calculations for the view frustrum before the actual rendering starts. One of the developers of the graphics clients should help you there with better information. I rarely had vessels of more than 120 meters length to notice problems.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,779
Reaction score
2,763
Points
203
Location
Dallas, TX

BruceJohnJennerLawso

Dread Lord of the Idiots
Addon Developer
Joined
Apr 14, 2012
Messages
2,585
Reaction score
0
Points
36
ok this is weird. If I use a SC3 config and put my mesh in it I get no clipping. But make a dll with it I get clipping galore. Same set size. No clipping in D3D9 though
mesh in a sc3 notice how close the ummu can get .
http://i373.photobucket.com/albums/oo179/gattispilot/ummuclipping_zps49668fdc.jpg

a dll
http://i373.photobucket.com/albums/oo179/gattispilot/ummuclipping1_zps1cc53fba.jpg


MESHVIS_EXTERNAL | MESHVIS_EXTPASS);

Which mesh is clipping, the astronaut or the spacecraft? I cant pick out anything odd yet.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,779
Reaction score
2,763
Points
203
Location
Dallas, TX
Oh. I would say the spacecraft since I can get close with the Ummu in the one image. The distance is the where clipping first occurs. The one I got close with was a Spacecraft3.ini/cfg that I put the mesh in. The same as the Dll version. The setsize are the same.

Does SetCrossSections have anything to do with it?
 

BruceJohnJennerLawso

Dread Lord of the Idiots
Addon Developer
Joined
Apr 14, 2012
Messages
2,585
Reaction score
0
Points
36
Oh. I would say the spacecraft since I can get close with the Ummu in the one image. The distance is the where clipping first occurs. The one I got close with was a Spacecraft3.ini/cfg that I put the mesh in. The same as the Dll version. The setsize are the same.

Does SetCrossSections have anything to do with it?

Doubtful, I would suspect that the call Spacecraft 3 uses to add a mesh is the difference? Really not sure, but maybe theres an old outdated function somewhere in the API that happens to be working better in this case. Gotta go digging to find out for sure though.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,779
Reaction score
2,763
Points
203
Location
Dallas, TX
It is my vessel as I can fly another one right up to it. I have tried the mesh just external always,....

No clue. Could it be the way the dll is made?
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,779
Reaction score
2,763
Points
203
Location
Dallas, TX
Code:
leonov_idx = AddMesh (oapiLoadMeshGlobal ("Leonov"));
No clue why I get clipping. On a dll for a similar vessel no clipping. But Not sure how the mesh is shown? Always, cockpit,....

This was from a vessel for Orbiter 2006
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,779
Reaction score
2,763
Points
203
Location
Dallas, TX
Ok. So is the default setting for a mesh EXTERNAL?

So if I set the setting on my vessel to external I get clipping. If I put in a mesh that is similar in size I get clipping.
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,779
Reaction score
2,763
Points
203
Location
Dallas, TX
Got another question. Are the graphic engines engine different between the 2006 version and the 2010p1 version in regards to clipping?

The reason I have vessel using basically the same mesh and no clipping in 2006 but clipping in 2010. External view. The ship is long but not very wide. I have set the size to the Z length.

But when I zoom in on the ship in the center the tail or head gets clipped.
 
Top