On Fri, 2010-03-26 at 16:55 +0100, Darko Makreshanski wrote:
> Darko Makreshanski wrote:
> > James Legg wrote:    
> >>
> >> Have you thought about how the z-order of the images would work in the
> >> outside sphere view?
> >>
> >> The overlapping images in Hugin eventually get merged with enblend. In
> >> the previews they are just drawn over the top of each other for speed.
> >>
> >> In a 3D sphere, the images will still overlap. If you continue to draw
> >> them over the top of each other, bits of the images on the back half of
> >> the sphere may be drawn over the front of the sphere.
> >>
> >> I don't think you could use OpenGL's depth buffer and depth test
> >> directly, because the overlapping images would z-fight.
> >>
> >> -James
> >>   
> > Yes, this is very tricky.
> >
> > I was so far assuming to use the depth buffer because it is most 
> > appropriate for 3D scenes.
> >
> > In this case if we don't use the depth buffer, then we will have to 
> > some how avoid drawing the back of the faces.
> > But in this case the problem is also that if we use the thing that I 
> > explained about shifting the spheres for the translation, then the 
> > scene becomes a mess.
> > For example some image may have a combination of translation and 
> > position such that it will displayed inside or outside the central 
> > sphere. In some cases images might cross each other.
> >
> > As for the depth buffer, the problem with the z-fight I believe can 
> > not be solved, because of the existence of translations. If we have 
> > projections on spheres with different centers, then z-fight is 
> > inevitable, and the only thing we can do is fiddle with the resolution 
> > of the meshes.
> >
> >
> Since my model was wrong and there is no need to draw multiple spheres, 
> the problem is now simplified.
> 
> Also, as I understood now how the Tr parameters affect the result, I 
> believe there should be two modes for the overview: A normal one just 
> showing the spherical model, and a linear mode where instead of just the 
> sphere, the plane would be rendered as well.
> 
> The linear mode would also change some stuff in the projection canvas as 
> well. For example, limit hfov to 180, disable yaw, pitch adjustments, 
> and enable translation adjustments.
> 
> Darko
> 

I've thought of an elegant solution.

Back-face culling can hide one side of the sphere. You only need to
check the vertex order is the same for all faces, and enable
GL_CULL_FACE.

So you can just leave depth testing turned off and draw the images over
the top of each other with no worries.

You can switch which side is culled with glCullFace, so if you want you
can even draw the back of the sphere, blend a circle over the sphere,
and then draw the front of the sphere over the top. This will get both
sides visible, ordered correctly, and the backside can be darkened (or
something else) to distinguish it.

This takes two passes to show both sides, but is better than trying to
clip meshes all the time.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugin-ptx@googlegroups.com
To unsubscribe from this group, send email to 
hugin-ptx+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx

To unsubscribe from this group, send email to 
hugin-ptx+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to