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

"Clipboard -> Print Current Camera" output is incomplete #54

Closed
elmkni opened this issue Apr 28, 2023 · 3 comments
Closed

"Clipboard -> Print Current Camera" output is incomplete #54

elmkni opened this issue Apr 28, 2023 · 3 comments

Comments

@elmkni
Copy link

elmkni commented Apr 28, 2023

Hi Michalis,

it's again me, Elmar!

Sorry, but I found another incovenience in conjunction with the fixes to issues #46 and #20.


Consider this code:

#X3D V4.0 utf8

PROFILE Full

Viewpoint {
 fieldOfView .4
 centerOfRotation 0 1 0
 position -5.875 5.34 6.9
 orientation -.64157 -.76 -.1 .8758
}
Shape {
 appearance Appearance {
  material Material {}
 }
 geometry Box {}
}
DEF CR Transform {
 children Transform {
  translation .056 -.037 -.2 children Shape {
   geometry DEF COPYRIGHT Text {
    string "Box (C) 28.04.2023 Elmar Knittel"
    fontStyle FontStyle { size 0.00213 family "SANS" justify "END" }
   }
  }
 }
}
DEF PS ProximitySensor { size 1e4 1e4 1e4 }
ROUTE PS.position_changed TO CR.set_translation
ROUTE PS.orientation_changed TO CR.set_rotation

It should result in this:

w

But when I copy the current Viewpoint parameters to the clipboard to be able to re-use them in other X3D files, I get something like this:

# Generated by view3dscene.
# Use view3dscene "Clipboard -> Print Current Camera..." to generate X3D code like below.
# Camera settings "encoded" in the X3D declaration below :
#   position -5.87 5.34 6.90
#   direction 0.56 -0.52 -0.64
#   up 0.25 0.85 -0.47
#   gravityUp 0.00 1.00 0.00
Viewpoint {
  position -5.87499809265137 5.33999824523926 6.89999914169312
  orientation -0.641826927661896 -0.760297358036041 -0.100030295550823 0.875799536705017
}

This gives me position and orientation, but for a correct re-creation of the original view, centerOfRotation and fieldOfView are also essential! Maybe even nearDistance and farDistance should be included in the printout.

Especially because I use a copyright tag in my X3D files, that is optimized for a certain fieldOfView and aspect ratio (3:2 for photo print-out), I have to copy centerOfRotation and fieldOfView manually (if they diverge from the standard), which is kind of inconvenient.

Sadly X3D allows not to set the aspect ratio of the viewing-window, like a video does for a media player ...


Be that as it may, I herewith kindly ask for adding at least centerOfRotation and fieldOfView to the print-out, if possible.

With best regards,

Elmar

P.S.: Please don't forget issue #52 (PixelTexture3D as emissive texture), because I need that to work properly for my models!

michaliskambi added a commit to castle-engine/castle-engine that referenced this issue May 8, 2023
@michaliskambi
Copy link
Member

michaliskambi commented May 8, 2023

Fixed! We now output centerOfRotation and fieldOfView (if they are not at default values).

Zrzut ekranu z 2023-05-08 02-28-54

The new build will be available on https://jenkins.castle-engine.io/public/builds/view3dscene/ , but please give it some time (even 20 hours) -- Jenkins needs to build both new CGE modification, and new view3dscene modification, And I see Jenkins is now busy building and testing previous changes :) You can keep observing the page castle-engine/castle-engine@snapshot...master : when it will no longer show the commit "Expose camera string/node properties through more flexible TMakeX3DVi…" then this CGE commit is in snapshots, and latest view3dscene will include it in next ~15 minutes.

@elmkni
Copy link
Author

elmkni commented May 10, 2023

Hi Michalis,

I have just tested the latest View3DSsene from 10-May-2023 04:49.


The "Print Current Camera" output for VRML and X3D now includes fieldOfView and centerOfRotation (if divergent from the default values) --- Thank you very much! ---


I saw, that you had to change 3 files (castlescenecore.pas, x3dloadinternal3ds.pas and x3dcamerautils.pas) with 224 additions and 31 deletions, to do the fix, which is far more than I (in my naivity) assumed! I thought 2 additional println would do the trick ;)


With best regards,

Elmar

@michaliskambi
Copy link
Member

I saw, that you had to change 3 files (castlescenecore.pas, x3dloadinternal3ds.pas and x3dcamerautils.pas) with 224 additions and 31 deletions, to do the fix, which is far more than I (in my naivity) assumed! I thought 2 additional println would do the trick ;)

I reworked related pieces of code, to also better support possible future additions to viewpoint output :)

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

No branches or pull requests

2 participants