Usage problem of anti-aliasing in WebAssembly

Hi.

I'm trying to add anti-aliasing to my WebAssembly application as follow, but it doesn't seems to work.

Graphic3d_RenderingParams& aParams = view->ChangeRenderingParams();
aParams.IsAntialiasingEnabled = Standard_True;

// I tried this as well not really sure how to use it
aParams.NbMsaaSamples = 8;

I also tried apply LineAspect considering the fact that maybe my line were too thin. But didnt' succeed here as well, if you have any insight to why it don't i'm really interested.


// Doesn't work
 m_aisshape->Attributes()->FaceBoundaryAspect()->SetColor(Quantity_NOC_BLACK);
 m_aisshape->Attributes()->FaceBoundaryAspect()->SetTypeOfLine(Aspect_TOL_SOLID);
 m_aisshape->Attributes()->FaceBoundaryAspect()->SetWidth(3.0);
 
// Doesn't work
m_aisshape->Attributes()->SetLineAspect(new Prs3d_LineAspect(Quantity_NOC_BLACK, Aspect_TOL_SOLID, 4.0));

Thanks for your help,

Best regards.

Kirill Gavrilov's picture

I'm trying to add anti-aliasing to my WebAssembly application as follow, but it doesn't seems to work.

Which version of OCCT is used? MSAA sample.

Emmanuel BIGEON's picture

Thank you for the explanation of line width problem, i'm currently using the 7.6 version of OCCT.

Kirill Gavrilov's picture

 Emmanuel BIGEON wrote:

I'm trying to add anti-aliasing to my WebAssembly application as follow, but it doesn't seems to work.

...
Thank you for the explanation of line width problem, i'm currently using the 7.6 version of OCCT.

WebGL 2.0 has limited support for MSAA (compared to desktop OpenGL 3.2 and OpenGL ES 3.1+ available on mobile devices), so that it required extra efforts to add it to OCCT - this has been done in current development branch (targeting OCCT 7.7.0). Graphic3d_RenderingParams::RenderResolutionScale could be used as alternative to MSAA for antialiased output.

Emmanuel BIGEON's picture

Thank you !
I upgraded my OCCT to 7.7 and now it works very well ! I've also tested the line width with Mozilla options and it does too.

Best regards.

Kirill Gavrilov's picture

 Emmanuel BIGEON wrote:

I also tried apply LineAspect considering the fact that maybe my line were too thin.

WebGL implementations on Desktop browsers usually do not support line width greater than 1.0. Though this could be changed in advanced browser settings (webgl.disable-angle=true within about:config in case of Firefox).