View distance

Started by Dr PR, April 05, 2014, 10:08:54 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dr PR

Changing the view distance in "Perspective" view changes the apparent distance from the viewer (you, or the screen) to objects. Try setting the distance to 1000 and then use "View/Fit to Window" (CTRL W). Then change the distance to 1,000,000,000. Notice how the image gets smaller?

Admittedly, it really isn't as small as you would expect by increasing the distance from you to an object by a million times, but it does get smaller.

If you use "Fit to Window" again the view changes so the objects fill the window.

This is one way DesignCAD allows "impossible" things (real world) to happen. No matter what the view distance is you can see the objects with the same clarity. It gives you vision much greater than an eagle's.

****

The primary effect of changing view distance is to change the perspective angle. View distance applies only to "Perspective" view.

If you draw a cube and set the view distance to only about the length of the cube's side (with the view center inside the cube) you will see a very "close up" view with lots of perspective distortion.

In the "cube distance 5.jpg" image the cube is 4 units on a side, and the view distance is 5 units from the corner.

Now change the view distance to 100 and you get a less distorted image of a cube (cube distance 100.jpg).

So changing view distance is a lot like changing the focal length of a camera lens - the view angle from the camera to the objects gets smaller with longer view distances. At a view distance of infinity you get no perspective distortion. This is essentially what you see in "Isometric" and "Parallel" views.

****

So why not set the view distance to a very large number and avoid all this distortion? OK, now take a deep breath. There is an undesirable side effect of very long view distances.

The two images of the boat are from the same angle, but the distance in one is a thousand units and the other is a billion units. Notice how screwed up the image is at a view distance of one billion. Notice how more distant parts of the drawing that are supposed to be hidden behind nearer objects "bleed through" in odd ziz-zag stripes?

When DesignCAD (or any CAD program) generates a view of a scene it examines all of the objects and assigns a relative distance to each (this is the "Z buffer"). Then it pieces together the image, showing some parts and hiding others, depending upon which parts are "in front" of others (longer or shorter Z buffer distances).

The depth resolution of the Z buffer is not infinite - like everything else in the computer the depth value is a binary number with a limited number of bits. This means the total depth of the view must be divided into a finite number of "slices" that are planes perpendicular to the view direction. This is what the Z buffer does. It is a lot like the little view boxes children make in school where a sequence of flat images at different depths gave the impression of a continuous 3D view when seen through the opening in the end of the box.

Objects on a nearer slice are displayed over objects in more distant slices.

DesignCAD has a limited number of "slices" in the Z buffer. All objects or parts of objects within the space between increments in the Z buffer depth are displayed as if they were in the same plane.

In the case of the picture with a view distance of 1000 the Z buffer resolution was a relatively short distance compared to the total object depth, and the program did a good job rendering the image (this is just the screen image, which has relatively poor resolution). But in the image with a view distance of a billion, every part of the boat fell within a single Z buffer distance increment, so all were displayed as if they were in a single plane. But the objects have many different colors, and the program had to guess which to display on top, taking into account surface normals, colors and such. As you can see, what you get when you tell it to do this (by setting a huge view distance) is more or less a montage of bits and pieces and colors.

Assume that Z buffer resolution is 10,000 planes (I don't know the real number, but it probably isn't more than 2^15), so each plane is 1/10,000 of the view distance. The boat is 352x147x132 units XYZ. So at a view distance of 1000 the Z buffer distance resolution is 1000/10,000 or 1/10 a unit. Side on the view of the boat would be sliced into 1320 Z buffer planes.

But at a view distance of 1,000,000,000 the Z buffer resolution would be 1,000,000,000/10,000, or 100,000 units, each about 750 times the depth of the boat! So all parts of the boat fall within a single Z buffer slice, and we see a kaliedoscopic image.

That's why you don't use very large view distances.

This problem shows up in more subtile ways. You can't "paint" one surface over another by separating them by very small distances, because both surfaces will fall in the same Z buffer plane at fairly short view distances relative to the overall object dimensions. See this link for more about this problem:

http://forum.designcad.com/index.php?topic=3357.msg18034#msg18034

Phil
DesignCAD user since 1987

prl

Tremendous. If ever you leave DesignCAD behind, we get to pickle your brain and what you know for the good of the forum.


samdavo

#2
Here's a drawing of sleepers receding into the distance.
"Sleepers receding V01"
Each sleeper is about 2.4m wide -  uptrack and downtrack - and they reced 170m into distance (at very approx 3m   2.2m centres).
I have set origin half way down, hence their location varies +85m to -85m.
(edit:- and view point is at the origin as well)
I draw a sphere at the origin, 7m in diameter.
I have set view distance to 3.5m.

Anyway, the final effect is severely distorted.  - and you can only see the sleepers ahead of you (i.e. the back half).

Which proves that you can;t see out of the back of your head.
Unless you are a charmelion I guess. (?)
cheers

PS those dimensions, approx as they are, only apply to the first png below .
As if anyone could give a shinbone lol.

PS I have cut a bit off the end of this post (re changing view distance to 50m) and tacked it onto the next where it belonged - apologies for any confusion.




samdavo

#3
Sorry
I have coloured the first half of sleepers magenta.
And in the perspective view, you can only see 1.5 of them.
Also the "fisheye" view of the inside of a sphere is interesting imo.

PS I also enclose a view distance modified to 50m - roughly 10 magenta sleepers are not visible  ( = 22m),  see the png file "V02 with 50m view distance".
I won;t include the dcd for that particular change - because all you have to do is change the view distance from 3.5 to 50m.

(Not sure why more sleepers aren;t visible  (i.e. view distance 50m , but only 22m or at most 30m of sleepers back from the view point are visible - albeit off to the side) but we move on - to other more important matters - and leave this problem to railway engineers lol)

samdavo

Just repeating the previous posts - this time shaded.

a) V02 with 3.5m view distance ( i.e. a fisheye view inside the 7m diameter sphere, and a couple of sleepers visible  (2.2m centres);  Note that 3.5m is the radius of the sphere;

also V02 with 6.5m view distance ( for some reason this still "breaks the surface" of the 7m diam);

also V02 with 50m view distance - the truncation at the bottom of the jpeg is all about view distance

and just for fun,   with the shortest distance possible = 1m.
 

samdavo

#5
sorry to hi-jack another thread :)
but ...
I post a dcd of a "trick Jaffa"
alias "Jaffa-that-will-break-your-tooth".

The red diameter is 7  (maybe 7/10 of an inch lol)
the brown chocolate centre is 5 diam
and then there's a surprise inside.

The centre of the Jaffa is the origin.
so is the View Centre.

As they say at Seaworld, the porpoise of this exercise is to progressively reduce the view distance.
I enclose some of the early trials ( with 7,  6.9,  and 5).

Note that the chocolate interior just starts to be visible at 6.9 - which suggests (?) that there is a factor of 2 in there somewhere, i.e. piercing the wall when the view distance is less than the diameter (rather than the radius, which would be more intuitive imo).

prl

#6
Sam, these are creative and informative pictures your are posting. 

Is there anyone on the forum that can translate what DesignCAD is doing into terms such as camera lens, depth of view, field of view, focal length, etc.  The DesignCAD view distance dialog for the perspective mode does something very complicated.  I've never been able to get my mind around it.

samdavo

#7
continuing to reduce that view distance ...
view distance of 4 well and truly breaks the surface of the 5 diam inner chocolate sphere
and vd of 2 zooms in even more. - ALTHOUGH , because you are MAYBE ?? viewing the far side of the chocolate sphere, ?? (to be confirmed!) it looks less zoomed in than the vd=4 jpeg ( 2 cents)
cheers
PS sorry to labour this - I just found it err  "interesting" :)

The first jpeg reminds me of a bloodshot eye - could be male or female I guess - intent on marriage. (2 cents)

samdavo

#8
Quote from: prl on April 06, 2014, 02:52:27 AM
Sam, these are creative and informative pictures your are posting. 
thanks prl - i am just watching sunday night TV here, and I guess by now you know which I prefer, (TV or DCAD) lol

Quote from: samdavo on April 06, 2014, 02:54:06 AM
ALTHOUGH , because you are MAYBE ?? viewing the far side of the chocolate sphere, ?? (to be confirmed!) it looks less zoomed in than the vd=4 jpeg ( 2 cents)
I started to have doubts about my theory that I am looking at the far side of the brown sphere ....
BUT now I agree with it again.

THE FOLLOWING NEEDS SOME GUIDANCE :-
I post the view of vd = 1  (which is the closest you can get)
- Initially I thought that there was a problem with my theory, in that it looks like the brown sphere is covering the diamond.
THEN IT DAWNED ON ME - lol - the diamond is also being cut-off / clipped whatever (the diamond itself is 1.17 in the z direction,  hence vd=1 will start to truncate the diamond).  So, in my mind, I am fairly certain that a factor of 2 is involved,

And just to prove it, I rotated the gold ring ( as against the diamond), and it too is truncated in the vd=1 view (i.e. jpeg below).

i.e. SUMMARY:- to see the corner of a diamond which is (1.17/2) units from the view centre without "cut-off", you have to be at a view distance of 1.17 (edit - make that AT LEAST 1.17 - and probably 1.9 or 2 as it turns out ?).   Cheers   

PS If you want to use real dimensions rather than dimensionless units,  think of this as the diameter of Mars = 6800km,  or approx 7000.   And we all know that happens when you have heat and pressure - you get diamonds :)

prl

#9
Quote from: samdavo on April 06, 2014, 03:27:33 AM
thanks prl - i am just watching sunday night TV here, and I guess by now you know which I prefer, (TV or DCAD) lol

Your pics bring up what I don't understand. What does view distance 2000mm or 1000mm zoomed out mean?  So something has broken the surface of the sphere and then you zoomed out?

Would this be an outer body experience?  Your physical head with attached peepers are inside the sphere looking at the ring, and then by zooming out, you escape your own head looking at yourself looking at the ring through your own eyes.  But since your own eyes can never see your own head, you don't see the camera (your head).  Oh yes, I can understand this easily.  ???


samdavo

#10
Quote from: prl on April 06, 2014, 03:33:26 AM
What does view distance 2000mm or 1000mm zoomed out mean?  So something has broken the surface of the sphere and then you zoomed out?
Sorry to confuse - I started talking 7m diam (to suit the scale of the railway sleepers), then changed the object of my discussion to be a Jaffa.  And 7m became pretty stupid.

Initially I said it was 7/10 of an inch :)
But I had already done my jpegs at 1000,  2000 etc. [colr=red](edit now renamed 1, 2, etc)[/color]
So then I introduced the idea of Mars  ...

In summary, 1 = close ( as does 1000) - please read the "view distance" included in the jpeg.

Or better still, open the dcd, and just try these view distances :-
7, 6.9, 5, 4, 2, 1 and any other distances along the way.   
cheers, sam
PS and apologies for any confusion.

PS I have re-titled all the jpeg attachments  from 1000 to 1, 2000 to 2 etc - hopefully less confusing now, cheers.

Hey prl, If you look carefully at the last jpeg - There is even a bright central light in the vd=1 view, lol - let's not go there. :)   Maybe out of body experience as you say - maybe nirvana? lol. 

prl

Quote from: samdavo on April 06, 2014, 03:46:38 AM
Sorry to confuse -

No, this is good.  I was asking myself those questions, thinking aloud (or aforum). 

prl

Quote from: samdavo on April 06, 2014, 03:46:38 AM
- let's not go there. :) 

Maybe this has to do with time travel. You watching yourself watching yourself watching yourself.   Did your screen just blink rapidly?  That's not your video card my friend.  Lar's theory  - a glitch in the space time continuum.

samdavo

#13
exactly -
I tried it with wireframe and Hidden Line Removed ( as you have done).   My proposal "that vd = 1.17 would be ok" doesn't quite hold water !! - I found I needed about vd = 2 to show the full diamond.    mmm  Are we ever gonna fully nail this > lol - I doubt it.   Cheers

PS I should quickly warn you that I have deleted a couple of planes of the diamond to make it look more transparent on those facets.

PS As for seeing the backs of our heads,  I just posted a poem that includes this idea :-

QuoteOld Galileo would take up his telescope, Stare at the shadows on Venus,
Calmly predicted the sun was the centre, inStead of some Pope or his genus,
Einstein went on to say - stare out for long enough, Something quite horrid and heinous, the
Back of our heads somehow comes into view, and - Turn around quickly  - we’ve seen us!!

prl

#14
Quote from: samdavo on April 06, 2014, 04:28:14 AM
PS As for seeing the backs of our heads,  I just posted a poem that includes this idea :-

Do you recall our discussion of spinning reference systems?  At one point we were talking about gravity and if you threw a baseball at the right speed it would circle the earth and you could turn around and catch it at the same height as when it left your hand.  Similar concept, so simple when you think about it.