2

I am building a set of 3D figures for online display (as supplementary material for a physics paper), and I am having some issues getting the transparency features to work.

Specifically, I have a set of surfaces built using the <IndexedFaceSet> primitive, prefaced with a <Material> element inside an <Appearance> tag, which contains the transparency element:

<Shape>
 <Appearance>
  <Material diffuseColor='1. 0.5 0.'
      specularColor='1. 1. 1.'
      shininess='0.9' 
      transparency='0.5' />
 </Appearance>
 <IndexedFaceSet colorPerVertex='false'
     normalPerVertex='true'
     solid='false'
     coordIndex='0 1 2 -1 3 4 5 -1 ...'
     />

However, when displayed within x3dom, the figure shows a jagged appearance with patchy behaviour:

From what I can tell, only some of the polygons in the <IndexedFaceSet> are getting rendered in a way that accounts for the polygons behind them, but I can't be sure.

The plot is available to view here, and the x3d file was produced in Mathematica as described in this Mathematica Stack Exchange Q&A, with the transparency added in by hand. I don't know whether the issue is intrinsic to x3dom or to the x3d format -- I get the same in freeWRL and in view3dscene but the renderers there don't fill me with confidence either.

So:

  • What is the name of this effect? I imagine this is quite a common thing to see in 3D graphics, but I don't know what to call it and I get the feeling that this is making it harder to find relevant solutions.
  • Is this a bug in x3dom? a sign of an imperfect renderer? In other words, is the x3dom engine restricted to displaying these graphics in this way, and I need to either accept that or drop the transparency? or
  • is there a way to fix the model or the scene or the settings or the rendering, to stop this patchy appearance from occurring?

I'm kinda lost as to how to approach this (I'm just a humble physicist trying to innovate in graphics formatting) and would be grateful for any pointers about how to approach this.

E.P.
  • 342
  • 4
  • 13
  • Posted as an issue on the x3dom GitHub project [here](https://github.com/x3dom/x3dom/issues/1053). – E.P. Mar 23 '20 at 14:14
  • Just a quick comment, we are experiencing this for some years now. There is also a thread for threeJS discussing this issue. So this is not only related to X3DOM. However depending on your view angle, you can switch the order of the IFS and the one added later to the scene might work better. Also make sure that your triangles are all oriented in the same way (clock-wise or CCW) by ordering the indices. It might also help to supply the normal rather than relying on X3DOMs calculation. – mistapink Mar 24 '20 at 08:23
  • @mistapink Many thanks for your comment. The triangle-orientation question sounds like a plausible explanation for why some polygons are darker than others (i.e. why those ones and not a different subset?), but I just had a deeper look at the model and the triangles in the Mathematica export are all oriented in the same way, and they are all consistent with the normals provided by Mathematica. – E.P. Mar 25 '20 at 11:21
  • Also, I can't make the model depend on the viewpoint -- the figure is meant to be interactive so that the reader can manipulate it and explore it. (There is already a fixed-viewpoint render in the paper itself, but it's a hard geometry to parse and I want the reader to be able to move it around.) – E.P. Mar 25 '20 at 11:22
  • (and also, if you have the links to the threeJS discussions handy, they would be extremely useful!) – E.P. Mar 25 '20 at 12:05
  • I am not mistaken it is this one: https://discourse.threejs.org/t/depth-peel-and-transparency/5365 and https://github.com/mrdoob/three.js/issues/9977 – mistapink Mar 25 '20 at 14:20

0 Answers0