cnr-isti-vclab / 3DHOP

3D Heritage Online Presenter
http://www.3dhop.net
GNU General Public License v3.0
154 stars 42 forks source link

[Feature requests] Screenshot resolution multiplier; rotate plane section tool #41

Closed afr-git closed 4 years ago

afr-git commented 4 years ago

I'm continuing to enjoy using 3D-HOP! Thanks for all your work on this. I'm sorry I can't do more to help with these requested features below but I'm hoping to lodge these as possible improvements to the tools if they aren't on any roadmaps/existing requests.

Is your feature request related to a problem? Please describe. Request 1) The new screenshot feature is great, in terms of expanding on it I would love to see if in any way possible a way of expanding the resolution above native resolution. For example if the native screen res is 1080p, export screenshots at above-native resolutions e.g. 4k, 8k. I can see this having a real benefit to use in orthographic camera mode for folk wanting to create reference imagery, elevation, plan and section imagery.

Feature request 2) The plane sections tool works well, but ideally you could rotate the section tool around either axis, so it is possible to align the slices to 'off-plumb' geometry, and for models that naturally follow a slope or sit off-axis.

Describe the solution you'd like On request 1) I gather the screenshot function uses the toDataURL() function which from my brief research doesn't really have a good, native way to scale up/increase DPI for exported images. There seems to be poorly documented mentions of toDataURLHD() but it's not clear what this really offers. Unfortunately I think any implementation may be more complex e.g. requiring scaling up the canvas etc

mcallieri commented 4 years ago

hi. Thanks for the feedback.

1) the screenshot functionality is something new, and we would like to expand it in the future. High-res images could be a good idea. There are two ways to do that:

2) good news, the slanted plane is already available. It is not on the features described in the tutorials because it does not have a pre-made interface (you have to create your own in HTML/javascript), and because the parameters are more difficult to control w.r.t. the "axis-aligned sections". As soon as I have a minute, I'll write down some information on how to use this feature

mcallieri commented 4 years ago

As I said, the oblique section does NOT have a ready-made interface, you have to create one depending on your needs. as an example of interface, see http://vcg.isti.cnr.it/varie/terrain/M2_AUTO.html

The oblique sectioning plane is stored in the format normal + offset (and sign). The plane at offset 0 passes through the center of the scene bounding sphere.

To control the oblique section, you have to use these functions:

resetClippingPlane(); removes the current oblique section plane. The section disappears

setClippingPlane(angle1, angle2, sign, offset)

angle1 and angle2 can be between -90 +90, and control how much tilt over Y and Z axis sign can be 1.0 (positive side is clipped) or -1 (negative side is clipped) offset can be between -100 100, and determines the offset % of the plane, i.e. how much the plane is far from the scene center.

if you want, you can control the offset with an absolut value. e.g. I want to move the plane 12mm, you may add another parameter with the offset setClippingPlane(angle1, angle2, sign, 0, offsetabs)

if you know the exact plane you need, you may also specify directly the normal and offset of the plane in absolute values. setClippingPlaneExplicit(axis, offset) axis is a vector with three components, nx,ny,nz. the vectors has to be normalized. offset is

To have an example, load the minimal example, open the console, and try these commands

presenter.setClippingPlane(0, 0, 1.0, 0.0) straight vertical section (perpendicular to X), centered on the center of the scene, right half is removed

presenter.setClippingPlane(0, 0, -1.0, 0.0) straight vertical section (perpendicular to X), centered on the center of the scene, left half is removed

presenter.setClippingPlane(45, 0, 1.0, 0.0) vertical section, rotated 45° on the Y axis, centered on the center of the scene, front-right half is removed

presenter.setClippingPlane(0, 45, 1.0, 0.0) vertical section, rotated 45° on the Z axis, centered on the center of the scene, top-right half is removed

presenter.setClippingPlane(0, 45, 1.0, 20.0) vertical section, rotated 45° on the Z axis, 20% offset from the center, top-right half is removed presenter.setClippingPlane(0, 45, 1.0, -20.0) vertical section, rotated 45° on the Z axis, -20% offset from the center, top-right half is removed

presenter.setClippingPlane(0, 45, 1.0, 0.0, 6) vertical section, rotated 45° on the Z axis, 6mm offset from the center, top-right half is removed presenter.setClippingPlane(0, 45, 1.0, 0.0, -6) vertical section, rotated 45° on the Z axis, -6mm offset from the center, top-right half is removed

afr-git commented 3 years ago

Thank you Marco for replying in such detail.

To convey what I was envisaging with the rotation of the plane section tool to be feature like my attached image, enabling the rotation of the existing sections in tandem with translation.

3DHop_Rotation_slider