V3d_View::SetSurfaceDetail(V3d_TEX_ALL) causes weird behavior

Hello all,

I have been experimenting with the projection models, and texture settings in OCC and found something very weird.

I have a V3d_View, where I manually set the Projection and Orientation parameters (through modifying the members of the underlying Visual3d_View class) and I get back more or less the results that I expect. However, if I set the surface details so that it supports the textures, the body I want to show (a cylinder) gets smaller. All the other parameters remain the same! Do any of you know about a bug, where setting the surface details modifies the view orientation and/or projection?

Attached you see a picture with the two different scenarios: the picture is the two views (each of them is of size 1024*768) next to each other.

Any clues?

Attachments: 
Laszlo Kudela's picture

I get the same behavior, if I set the surface detail to V3d_TEX_ENVIRONMENT.

Laszlo Kudela's picture

I just compiled OCC 6.7.0, the problem still persists there. Any ideas?

Laszlo Kudela's picture

Here is the cause:

OpenGL_View_2.cxx (starting at line 905)

// Add translation necessary for the environnement mapping
if (mySurfaceDetail != Visual3d_TOD_NONE)
{
// OCC280: FitAll work incorrect for perspective view if the SurfaceDetail mode is V3d_TEX_ENVIRONMENT or V3d_TEX_ALL
// const GLfloat dep = vptr->vrep.extra.map.fpd * 0.5F;
const GLfloat dep = (myExtra.map.fpd + myExtra.map.bpd) * 0.5F;
glTranslatef(-dep*myExtra.vpn[0],-dep*myExtra.vpn[1],-dep*myExtra.vpn[2]);
}

I had to comment these lines out. I have absolutely no experience with OpenGL, and I have no idea what this part does... If any developer could confirm if this was a bug or a feature?

At least now I get the expected result WITH the textures on...

Forum supervisor's picture

Dear Laszlo,

Previous OCCT releases (including OCCT 6.7.1) have significant issues in view camera management, including unnatural perspective projection mode.
In current state this logic has been completely rewritten, and the problem described in your message is most likely gone (taking into account that the lines you commented out have been removed).
This redesign is already available in master branch of official git repository and will be included in the nearest OCCT release 6.8.0.

Please fill free to check this problem as soon as OCCT 6.8.0 beta will be published, or right now if you are familiar with OCCT build procedures.
However, if the problem is still there - please provide more detailed description a scenario to reproduce the problem and register it in OCCT Mantis BugTracker availabele via the Collaborative portal - http://dev.opencascade.org/index.php?q=home/get_involved.
Best regards
FSR

Laszlo Kudela's picture

That's nice to hear!

I am going to have a look on the new version soon.