Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mesh3d lighting fix #3415

Merged
merged 16 commits into from Jan 16, 2019
Merged

Mesh3d lighting fix #3415

merged 16 commits into from Jan 16, 2019

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Jan 8, 2019

Possibly fixes #3353 & #2477 by applying an identical light positioning and shading algorithms for mesh3d & surface traces i.e. following the logic used in surface trace.
@plotly/plotly_js

Here is a demo illustrating the fix for reversed ranges.

package.json Outdated
@@ -77,7 +77,7 @@
"gl-heatmap2d": "^1.0.4",
"gl-line3d": "^1.1.6",
"gl-mat4": "^1.2.0",
"gl-mesh3d": "^2.0.2",
"gl-mesh3d": "git://github.com/gl-vis/gl-mesh3d.git#a8e8feaf48b280108a953f4541acbcc1f5a7aa4c",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etpinard etpinard added this to the 1.44.0 milestone Jan 8, 2019
@etpinard
Copy link
Contributor

etpinard commented Jan 9, 2019

@archmoj https://github.com/gl-vis/gl-mesh3d/compare/3353-light-reversed-ranges looks good to me. I made one small comment in gl-vis/gl-mesh3d@9fae35a, but yeah this indeed looks more similar to how gl-surface3d handles lightposition.

That said, I did notice one odd diff in the gl3d_tetrahedra mock:

peek 2019-01-09 11-19

is that new "shaded" part in the bottom third of the tetrahedra face on purpose?

@archmoj
Copy link
Contributor Author

archmoj commented Jan 9, 2019

That said, I did notice one odd diff in the gl3d_tetrahedra mock:
is that new "shaded" part in the bottom third of the tetrahedra face on purpose?

Good 👁️
I made few more changes in mesh3d and we have new baselines.

@etpinard
Copy link
Contributor

@archmoj are you happy with the results now? Would this be a good time to take a second look at this PR?

@archmoj
Copy link
Contributor Author

archmoj commented Jan 14, 2019

Yes. Now the number of changed baselines is at minimum. So, it is good to review.
Thanks @etpinard

@etpinard
Copy link
Contributor

etpinard commented Jan 14, 2019

@archmoj could you explain why the green tetrahedra in

peek 2019-01-14 11-54

appears to be all shaded now? Where is the light coming from in that mock?

@archmoj
Copy link
Contributor Author

archmoj commented Jan 14, 2019

@archmoj could you explain why the green tetrahedra in
[..]
appears to be all shaded now? Where is the light coming from in that mock?

Light position is the default and the reason is that those two faces have identical angle to the light source. But if you slightly rotate the scene they would show different shadings.

@etpinard
Copy link
Contributor

by applying an identical light positioning and shading algorithms for mesh3d & surface traces i.e. following the logic used in surface trace.

This sounds like a step in the right direction. Let's get this in 💃

@archmoj archmoj merged commit cc45972 into master Jan 16, 2019
@archmoj archmoj deleted the fix3353-light-reversed-ranges branch January 16, 2019 20:43
@etpinard
Copy link
Contributor

thanks for fixing that new baseline 💃 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lighting behaves weirdly on mesh3d when an axis range is reversed
2 participants