cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

How to make backfacing polygons are automatically culled in Vuforia Studio ?

loyang
5-Regular Member

How to make backfacing polygons are automatically culled in Vuforia Studio ?

3 REPLIES 3

Hi @loyang , 

could you provide , please, an example where you have an issue with the back facing polygons According a definition  in 

https://www.khronos.org/opengl/wiki/Face_Culling

 

Triangle primitives after all transformation steps have a particular facing. This is defined by the order of the three vertices that make up the triangle, as well as their apparent order on-screen. Triangles can be discarded based on their apparent facing, a process known as Face Culling.
... further ...
Face culling allows non-visible triangles of closed surfaces to be removed before expensive Rasterization and Fragment Shader operations.

To activate face culling, GL_CULL_FACE must first be enabled with glEnable. By default, face culling is disabled....

 

currently there is no supported way to have direct change of the  OpenGL  setting , so that this is valid change for preview mode but also for the mobile devices. The option what we have to use GLSL for preview and mobile or HLSL for the HoloLens device is to use vertex and fragment shaders. When we use a GLSL no all openGL variable are passed to the shader. Also the outputsof the shaders will effect only few openGL variables like gl_Position (past to the fragment shader) and gl_FragColor (result of the display)  variable are passed to the shaders and also few variable could be changed by the shaders

We can apply shaders to any widget to change the display of them. Or try to optimize the display (the current shader is already a good optimization so far) or to change the display showing some feature like medium flow, gradients etc.  Also  default widget shaders used in Studio ,so far I know will not  display any tessellated surfaces , therefore in the normal case we do not have the requirement to perform extra face culling

Therefore it will be interesting to know why do you need extra setting of back facing culling, or with other words where do you have an issue where this causes Problems with the display? Thanks

loyang
5-Regular Member
(To:RolandRaytchev)

I add  if(gl_FrontFacing){ discard;}   in fragment shaders  to make frontfacing polygons are automatically culled .

gl_FrontFacing — indicates whether a primitive is front or back facing

 

The application scenario is the operating room, surrounded by walls, and the user needs to see the inside of the operating room without being blocked by the wall.

Yes, when the gl_FrontFacing is passed to the fragment shader , then is no issue to  use it. Otherwise, you can use some space coordinate to discard the display or to switch to a transparent shader


Top Tags