You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hmm… looks like possible flipped normals to me. I'd suggest maybe gl_FrontFacing isn't properly supported, but 2016 seems pretty recent to fail on that, and reading the stack overflow issue more closely… not sure that's it.
Gotchas like pow(-abs(x), 2.0) being inconsistent across platforms bit me a couple times, but I didn't happen to catch anything obvious with a quick glance.
Not that it should inherently make it fail, but mesh3d uses the Cook-Torrance model. E.g. here one can choose the reflection model in a dropdown: http://www.calebjohnston.com/webgl.html
One more thing - possibly relating to the above possibility (lower precision floats): I needed to tweak the EPSILON value in the normals calculation. The brain mesh is made up of very small triangles. With the wrong EPSILON value, whole swaths of lighting just don't happen. This is my current best guess.
Way to test it: load some coarser mesh3d content from eg. plot.ly and see if that works fine.
Just a minor note, these last two images aren't too different; both seem to be primarily or exclusively lit by ambient light; it appears that the darker one simply has a lower light level. A high ambient level is usually not good because it "washes away" detail and reduces plasticity, as can be seen on the brainbrowser example. Neither seem to have eg. the specular component, compare to this:
In short, I think the dark brain above wants to be like what's seen in the codepen example, but misses components other than the (justly) subdued ambient component. I go by the look so I may well be wrong.
@monfera The issue is that the same mesh looks completely different depending on the viewer's computer. Here's another example: https://plot.ly/~empet/14759/. This mesh look completely different on my laptop versus my phone. These are the exact same plot (no lighting as been adjusted).
This is a huge bug IMO. Plotly meshes shouldn't look completely different depending on what computer you're using.
AFAICT it's a GPU issue. The MBP where Plotly.js meshes appear dark has an Intel 515 GPU, but the exact same MBP (same model, OS, and Chrome) with an Intel 5300 GPU displays meshes with "normal" lighting.
The Plotly Cloud image server also renders Plotly.js meshes overly dark, wonder what GPU it's using ATM:
Sorry, too quick on the draw! I had initially seen these issues in a Dash app that showed a brain. Not sure what an easy-to-access test case is. Happy to check on anything pre/post if you like on my machine.
Activity
rreusser commentedon Feb 9, 2017
Hmm… looks like possible flipped normals to me. I'd suggest maybe
gl_FrontFacing
isn't properly supported, but 2016 seems pretty recent to fail on that, and reading the stack overflow issue more closely… not sure that's it.See: https://github.com/gl-vis/gl-surface3d/blob/master/shaders/fragment.glsl#L28-L30
http://stackoverflow.com/questions/24375171/is-there-a-reliable-alternative-to-gl-frontfacing-in-a-fragment-shader
etpinard commentedon Feb 9, 2017
cc @dfcreative which have insight about this.
monfera commentedon Feb 9, 2017
I don't have access to this machine but guessing is always fun:
gl
floats arelowp
- I think the standard is quite permissive about precisionOne thing to try: visiting a bunch of WebGL content on the web to see if those work properly.
jackparmer commentedon Feb 9, 2017
Quick update: It doesn’t seem to matter what value I set for
diffuse
orspecular
. I can set them to 0.1 or 1 or 1000 and nothing changes.monfera commentedon Feb 9, 2017
Do these work fine? http://webglsamples.org/
rreusser commentedon Feb 9, 2017
Gotchas like
pow(-abs(x), 2.0)
being inconsistent across platforms bit me a couple times, but I didn't happen to catch anything obvious with a quick glance.jackparmer commentedon Feb 9, 2017
Yeah, nothing looks "off" with those. I can also change the
diffuse
andspecular
settings here:http://multivis.net/lecture/phong.html
monfera commentedon Feb 9, 2017
Not that it should inherently make it fail, but
mesh3d
uses the Cook-Torrance model. E.g. here one can choose the reflection model in a dropdown: http://www.calebjohnston.com/webgl.htmljackparmer commentedon Feb 9, 2017
Seems to work too - I see this?
rreusser commentedon Feb 9, 2017
Oops, sorry. I had the wrong module.
Maybe………(though this is necessarily positive, isn't it?)? https://github.com/stackgl/glsl-specular-cook-torrance/blob/master/index.glsl#L26
monfera commentedon Feb 9, 2017
One more thing - possibly relating to the above possibility (lower precision floats): I needed to tweak the EPSILON value in the normals calculation. The brain mesh is made up of very small triangles. With the wrong EPSILON value, whole swaths of lighting just don't happen. This is my current best guess.
Way to test it: load some coarser
mesh3d
content from eg.plot.ly
and see if that works fine.Also, my old commits made EPSILON configurable from within Plotly: mikolalysenko/normals@a519d8a#diff-f02129f250a223ce2d22f0b6e4fa7297
jackparmer commentedon Feb 9, 2017
Hm, yeah, larger triangles seem OK:
https://plot.ly/~empet/13481/delaunay-triangulation-and-alpha-shapes-for-a-set-of-3d-points-1-delaunay-triang/

https://plot.ly/~RPlotBot/3008/moebius-band-triangulation/

(I found these
mesh3d
plot.ly creations via: https://plot.ly/feed/?q=plottype:mesh3d)jackparmer commentedon Feb 9, 2017
Changingdiffuse
andspecular
still doesn't seem to have an effect though:I can actually see visible changes with
diffuse
whenambient
is turned down, I don't see any changes withspecular
.monfera commentedon Feb 9, 2017
I added the epsilon attribs to the codepen, with their respective default values: http://codepen.io/monfera/pen/XjxZjZ
Could you test if lower values make it work? E.g. 1e-9 instead of 1e-6, or 1e-15 instead of 1e-12. Or some much more ambitious change.
11 remaining items
jackparmer commentedon Jan 31, 2018
One things that is weird, I don't see any shading issues in this gl-mesh3d example:

https://gl-vis.github.io/gl-isosurface3d/brainbrowser.html
I would expect to see the same issue as the plotly.js
mesh3d
brains.monfera commentedon Jan 31, 2018
Just a minor note, these last two images aren't too different; both seem to be primarily or exclusively lit by ambient light; it appears that the darker one simply has a lower light level. A high ambient level is usually not good because it "washes away" detail and reduces plasticity, as can be seen on the brainbrowser example. Neither seem to have eg. the specular component, compare to this:
In short, I think the dark brain above wants to be like what's seen in the codepen example, but misses components other than the (justly) subdued ambient component. I go by the look so I may well be wrong.
jackparmer commentedon Feb 3, 2018
@monfera The issue is that the same mesh looks completely different depending on the viewer's computer. Here's another example: https://plot.ly/~empet/14759/. This mesh look completely different on my laptop versus my phone. These are the exact same plot (no lighting as been adjusted).
This is a huge bug IMO. Plotly meshes shouldn't look completely different depending on what computer you're using.
iPhone:

Laptop:

dy commentedon Feb 3, 2018
We have that fixed in gl-mesh3d gl-vis/gl-mesh3d#8, it takes a separate effort meeting the requirements here though
jackparmer commentedon Feb 3, 2018
AFAICT it's a GPU issue. The MBP where Plotly.js meshes appear dark has an Intel 515 GPU, but the exact same MBP (same model, OS, and Chrome) with an Intel 5300 GPU displays meshes with "normal" lighting.
The Plotly Cloud image server also renders Plotly.js meshes overly dark, wonder what GPU it's using ATM:
jackparmer commentedon Feb 5, 2018
Note: @nicolaskruchten also sees this with an Intel Iris GPU on his MBP
nicolaskruchten commentedon Feb 5, 2018
Here are my specs, for the record
nicolaskruchten commentedon Apr 17, 2018
FWIW the first few links now look great on my machine :)
nicolaskruchten commentedon Apr 17, 2018
(ah, but they look fine with 1.35.0 also... What's an updated test case I can try?)
etpinard commentedon Apr 17, 2018
Strange. I haven't updated the CDN links yet.
nicolaskruchten commentedon Apr 17, 2018
Sorry, too quick on the draw! I had initially seen these issues in a Dash app that showed a brain. Not sure what an easy-to-access test case is. Happy to check on anything pre/post if you like on my machine.
etpinard commentedon Apr 17, 2018
https://cdn.plot.ly/plotly-1.36.0.min.js is now up!