Re: [css3-transforms] Relation between mathematical description and effect of a transformation

Aryeh Gregor:

...
>
> Correct.  This isn't in the spec now because it's not clear what to do
> with negative values of p'.  If p' is positive, then it's clear we
> want (x'/p', y'/p').  And if p' is nonpositive for all four corners of
> a box, we want the box not to render.  But it's not at all obvious
> what to do if some corners of a box have p' > 0 and some have it <= 0.
>
> I've proposed a solution at
> <https://www.w3.org/Bugs/Public/show_bug.cgi?id=15605#c9>.  Perhaps
> you could give some feedback on it.
>

This is the old problem with either objects behind the eye of the
observer or within the eye(-plane) of the observer.
In reality you can't see what is behind you back. And if an object
sticks into your eye you have other problems than projection ;o)

Anyway, maybe already more useful to say
"we want (x'/|p'|, y'/|p'|) for p' not 0".

Mathematically there is no big problem with objects behind the observer 
- nevertheless you might not want to render it. 
But this may depend on the taste of the author of the shape, that has to 
be displayed.
A ususal approach is to leave the choice to this author
(this is shared care - the author of the applications should now best,
what matters, the viewer just has to render the stuff) - maybe
yet another property, not sure, if this is useful for many authors.
Options could be 
'simple'  - if parts of the object is behind the observer, don't render it at 
all
'around' - render objects behind the observer as well (needs a check,
if it causes problems, if parts of the object are behind and parts are in 
front)
'cut' - cut objects close to the eye-plane and display only what is in front
of the observer (needs presumably an additional length-value to decide, 
at which distance from the observer to cut).

Objects in the eye-plane - a specific problem of the central projection,
in reality nothing specific happens, if an object is 100m on the left or
right of you, only if it sticks directly into your eye. 
A spherical projection (don't know, if this is the correct english 
translation, it is more realistic compared to eyes, you can see similar 
effects on super-wide-angle lenses and especially fish-eyes) avoids this 
practically except for one point. But because this method does not
project lines on lines or points, you may not like it, because it is more 
difficult to draw - I have done approximations of this including animation
with SVG and PHP, hand made 3D projections, large files, but looks nice, 
see for example here:
http://upload.wikimedia.org/wikibooks/de/f/f8/SVGzeichenreihenfolge06.svg
;o)

If you want to go on with central projection - what I assume - I think at
least you have to exclude or care about parts of objects around the 
eye-plane to be rendered.

Another more simple approach of shared care with central projection is to
leave everything to the author - just note in the draft, that the author has 
to take care, that everything to be rendered is in front of the observer and
that all objects with parts not in front of the observer will not be displayed
at all. And maybe you can add a note, that future versions may add
another property as mentioned above, if it turns out, that it is 
required/desirable to have more access to this issue for the author.
With this approach, you can solve more difficult problems later, if required,
and you can go on to implement the simple and maybe practically 
more useful aspects faster.

But if you try to project infinite to finite values somehow, to get something
interesting/relevant, I think you need a continuous function/distortion
to get something acceptable - this is comparable again to something
that super wide angle photo lenses do - you will always have to
accept some kind of distortion, if you want to detect viewing angles
on a flat area, which are normally not accessible for this approach. 
Maybe experts from Canon, Leica, Nikon, Sigma, Tamron, Tokina, Zeiss 
etc can help to get a nice function to solve the problem to render everything 
somehow without too much distortion - but this is even more complex 
than the spherical projection. 

But maybe there are simple enough solutions to smooth the
function 1/z somehow around z=0 with limited numerical efforts.
Obviously one can replace it with something like b/(z*z+a)^1/2
or b*exp(-z*z/a) around 0 and adjust a and b to get a finite 
continuous differentiable replacement of 1/|z| and |z| small compared 
to characteristic sizes of the rendered objects.
Still this approach will cause non-trivial distortions of objects, having
parts around z=0 - maybe still too difficult for viewers, that have to
render (X)HTML and SVG documents fast online.


> > My assumption is, that this is a quite simple function, with most of the
> > not completely trivial things you need already stored in p'.
>
> It's mathematically pretty simple.  If w > 0, (x, y, z, w) is mapped
> to (x/w, y/w, z/w).  If w < 0, (x, y, z, w) is mapped to nothing.  The
> point (0, 0, 0, 0) is also mapped to nothing.  And for (x, y, z) not
> the origin, the point (x, y, z, 0) is mapped to the point at infinity
> in the direction of (x, y, z).  But how to translate this into
> something that can actually be rendered on the screen is not so
> obvious, which is why the spec doesn't yet say anything about it -- we
> don't have text that's agreed upon.

Obviously there has to be some normative text finally, else the feature
is not testable ...
Meanwhile one could add this hint about
'work in progress/missing text' in an info-box to the draft to 
inform readers, that they can't understand,
what is not decided yet ;o)


Olaf

Received on Monday, 23 April 2012 11:11:14 UTC