partridgejiang / Kekule.js

A Javascript cheminformatics toolkit.
http://partridgejiang.github.io/Kekule.js
MIT License
250 stars 61 forks source link

Issue with image quality #196

Open schneiderfelipe opened 4 years ago

schneiderfelipe commented 4 years ago

I am having a small issue with the quality of the image produced by Kekule.ChemWidget.Viewer3D. Namely, the image seems a bit pixelated (see below).

pixelating

It is likely due to the light-colored background, but I think I might tweak the rendering through three.js. Is there an easy way to smooth the 3D rendering? Thanks in advance!

partridgejiang commented 4 years ago

Hi @schneiderfelipe, please check the latest dist file in this repository, the antialias of WebGL context is turned to on by default in it. Of course you can turn it off for performance in certain limited devices:

viewer.getRenderConfigs().getEnvironmentConfigs().setAntiAlias(false);
viewer.resetRenderEnvironment();

Further more, you can also use the following code to improve the rendering quality of a 3D viewer:

viewer.getRenderConfigs().getEnvironmentConfigs().setGraphicQuality(Kekule.Render.Render3DGraphicQuality.EXTREME_HIGH);  // default is MEDIUM
schneiderfelipe commented 4 years ago

Hi @schneiderfelipe, please check the latest dist file in this repository, the antialias of WebGL context is turned to on by default in it. Of course you can turn it off for performance in certain limited devices:

viewer.getRenderConfigs().getEnvironmentConfigs().setAntiAlias(false);
viewer.resetRenderEnvironment();

Further more, you can also use the following code to improve the rendering quality of a 3D viewer:

viewer.getRenderConfigs().getEnvironmentConfigs().setGraphicQuality(Kekule.Render.Render3DGraphicQuality.EXTREME_HIGH);  // default is MEDIUM

Excellent, thanks a lot!