Irev-Dev / cadhub

We're out to raise awareness and put CodeCAD on the map. The success of CadHub can be measured by the amount it promotes the use of CodeCAD within the mechanical/manufacturing industry and the strength the CadHub community.
https://cadhub.xyz
GNU General Public License v3.0
319 stars 60 forks source link

CQ models rendering not usable #383

Closed adam-urbanczyk closed 3 years ago

adam-urbanczyk commented 3 years ago

Thanks for all the work on integrating CQ. Sadly, current rendering of models is not really usable - I cannot really see any features/edges:

afbeelding

What would you need from CQ to fix it? Currently VRML and VTKJS (take a look here: https://kitware.github.io/vtk-js/examples/SceneExplorer/index.html?fileURL=https://data.kitware.com/api/v1/file/5878eb978d777f05f44b142a/download) export is supported, it should be easy enough to display those with descent shading. Or would another format be needed?

Irev-Dev commented 3 years ago

Thanks @adam-urbanczyk

This is just bad lighting in the three.js scene. No changes in format is needed.

Irev-Dev commented 3 years ago

I've improve it somewhat with #384 image

But I'll leave this issue open as I'd like to improve it further.

marcus7070 commented 3 years ago

You might be interested in this: https://github.com/CadQuery/sphinxcadquery/blob/0b7050c0204b8b2c6f7e6912eaee97ca02b9e776/sphinxcadquery/sphinxcadquerystatic/main.js#L130-L165

I think you can see that lighting in action here: https://paramak.readthedocs.io/en/main/example_parametric_reactors.html

I'm pretty sure that's an old version of Three.js though.

Irev-Dev commented 3 years ago

Once #448 is merged, I was planning on closing this issue, while I hope it continues to improve I think it's much better than it was. Surfaces and edges can easily be identified now.

https://user-images.githubusercontent.com/29681384/128854453-a6960d50-cf06-4cd6-ad83-803acb96855e.mov

Are you happy with the state of it now @adam-urbanczyk @marcus7070 ?

adam-urbanczyk commented 3 years ago

LGTM, I'd change the line color though (to eg black)

marcus7070 commented 3 years ago

It's a great improvement @Irev-Dev. I think your line colours are part of the CadHub theme? In which case they're perfectly legible, no worries.

A minor point: I think most CAD viewers spin the object, not the camera. Sometimes you might get a shadow or reflection that obscures a feature, if you're only able to move the camera then you can't un-obscure. On the other hand, I do think spinning the camera with fixed lights gives a better sense of depth to the scene, but maybe that's just me.

Irev-Dev commented 3 years ago

Thanks @adam-urbanczyk, @marcus7070,

Why do you think the lines should be black Adam? The lines are roughly a CadHub theme, but at somepoint I'll probably want to re think the whole design of the 3D viewer so it's likely to change.

Thats a good point Marcus, I might do a bit of both, I tried attaching a light to the camera, and it adds a fair amount of consistency to the lighting.

adam-urbanczyk commented 3 years ago

I can barely see them with the current color scheme (black was just a contrasting color - maybe not so good given the background).