Spain
Joined: May 9, 2012
Post Count: 154
Status:
Offline
Some questions mainly about camera
Hello.
I'm thinking of write a plugin and I have a few questions that I hope somebody can answer:
1) In the ObserverCamera class what is the depth returned by getDepth? I understand that the elevation is given by Z, right?
2) On the Camera.Lens enumeration does PINHOLE correspond to "depth of field"? If not, how can I specify "depth of field"?
3) For the "depth of field" lens is there a way to change the default focus distance of 2.5m so you can fine tune which objects will get blurred or not for being out of focus?
4) For the function "setVisualProperty" of the different classes, what are the default available visual properties if any?
Thanks in advance.
---------------------------------------- If a long walk every day were healthy, mailmen would be immortal.
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: Some questions mainly about camera
1) In the ObserverCamera class what is the depth returned by getDepth?
It's the depth of the virtual visitor in the plan.
I understand that the elevation is given by Z, right?
Yes
2) On the Camera.Lens enumeration does PINHOLE correspond to "depth of field"?
It's the NORMAL lens. A PINHOLE camera matches a very small hole in a black box, i.e. no depth of field because of a very small aperture.
3) For the "depth of field" lens is there a way to change the default focus distance of 2.5m so you can fine tune which objects will get blurred or not for being out of focus?
From version 4, you can change that distance by setting the com.eteks.sweethome3d.j3d.PhotoRenderer.lowQuality.normalLens.focusDistance or com.eteks.sweethome3d.j3d.PhotoRenderer.highQuality.normalLens.focusDistance System properties (i.e. these changes will act as if you set global variables). See also com/eteks/sweethome3d/j3d/PhotoRenderer.properties to get the full list of the properties you can set for SunFlow renderer.
4) For the function "setVisualProperty" of the different classes, what are the default available visual properties if any?
Looking for the references to this method in Eclipse would have given you the answer. It's called in AbstractPhotoController, HomeController, PlanController and VideoController and their matching view class. All the property keys used in Sweet Home 3D core classes start by "com.eteks.sweethome3d.", so just don't use this prefix to avoid any collision.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Spain
Joined: May 9, 2012
Post Count: 154
Status:
Offline
Re: Some questions mainly about camera
Thanks for the reply, Emmanuel.
I still have two doubts after your answers, though.
1) In the ObserverCamera class what is the depth returned by getDepth?
It's the depth of the virtual visitor in the plan.
I understand that the elevation is given by Z, right?
Yes
In that case I'm still not sure about what depth means here. Is it the level of the house to which the Z elevation belongs or is it another thing?
2) On the Camera.Lens enumeration does PINHOLE correspond to "depth of field"?
It's the NORMAL lens. A PINHOLE camera matches a very small hole in a black box, i.e. no depth of field because of a very small aperture.
So, if the "depth of field" lens is the NORMAL lens, how do I specify whether I want to use just the normal plain lens or the "depth of field" lens?
---------------------------------------- If a long walk every day were healthy, mailmen would be immortal.
Spain
Joined: May 9, 2012
Post Count: 154
Status:
Offline
Re: Some questions mainly about camera
3) For the "depth of field" lens is there a way to change the default focus distance of 2.5m so you can fine tune which objects will get blurred or not for being out of focus?
From version 4, you can change that distance by setting the com.eteks.sweethome3d.j3d.PhotoRenderer.lowQuality.normalLens.focusDistance or com.eteks.sweethome3d.j3d.PhotoRenderer.highQuality.normalLens.focusDistance System properties (i.e. these changes will act as if you set global variables).
Oops, I forgot to ask about this one. So these values can only be changed at launch time and not by a pluging at runtime?
---------------------------------------- If a long walk every day were healthy, mailmen would be immortal.
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: Some questions mainly about camera
In that case I'm still not sure about what depth means here. Is it the level of the house to which the Z elevation belongs or is it another thing?
Again, it's the depth of the virtual visitor in the plan, i.e. the depth of the following object when the Z height of the camera matches the eyes' elevation of a visitor with a human reasonable size:
So, if the "depth of field" lens is the NORMAL lens, how do I specify whether I want to use just the normal plain lens or the "depth of field" lens?
Use PINHOLE value for the Default lens and NORMAL value for the Depth of field lens.
So these values can only be changed at launch time and not by a pluging at runtime?
These values are used when the renderer is started (see PhotoRenderer class), and you can change them before launching the rendering process with the System#setProperty method.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Spain
Joined: May 9, 2012
Post Count: 154
Status:
Offline
Re: Some questions mainly about camera
OK, understood.
Or better I should say "almost". Now I understand the lens and the property parts... unfortunately I feel a bit dumb since I still not sure about the depth part. It sounds to me almost the same that the Z elevation, unless it refers to the elevation of the visitor's feet, for example. In such case I think the definition should be more precise about the size of the visitor instead use a vague term as "reasonable size". Anyway I think that I may not need the depth after all.
Thanks again, Emmanuel.
---------------------------------------- If a long walk every day were healthy, mailmen would be immortal.
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: Some questions mainly about camera
Please look at the comments in the source code of ObserverCamera class for explanations. As the depth is used only in the plan, I don't think you could need it for 3D computing.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator
Spain
Joined: May 9, 2012
Post Count: 154
Status:
Offline
Re: Some questions mainly about camera
Oh, I think I finally got it.
The term "depth" was confusing me, making me think of a vertical measure while it's actually a horizontal measure. Although I will not need it, I try to get it right for the sake of curiosity.
To say it the easy way, "width" is the distance from shoulder to shoulder, "depth" is the distance from chest to back and "height" is the distance from head to feet, all of them calculated for a human who has the eyes at a height of Z. So only width and depth are used on 2D plan view, while height will only be useful in the 3D view.
I'm right this time? At least I hope to be closer to the answer...
---------------------------------------- If a long walk every day were healthy, mailmen would be immortal.
France
Joined: Nov 7, 2005
Post Count: 9426
Status:
Offline
Re: Some questions mainly about camera
Yes you're right except that the height of the camera isn't used in the 3D view. It's just displayed in the tooltip of the camera shown in the plan to show the height of the virtual visitor for a given elevation of his eyes, when the user handles the elevation indicator in his back and this height is below 250 cm. You should know that before I add levels, the 3D view modification dialog box used to show a Visitor height field:
and when this dialog box was split in two dialog boxes, this field was replaced by Eyes elevation (i.e. Z) field in the Virtual visitor modification dialog box:
According to human proportions the height of a human body is equal to 15 / 14 x eyes elevation, but you will easily understand that with a camera elevation able to go from negative to very high values, showing a Visitor height field and forcing users to multiply that value by 14/15 to get eyes elevation was becoming awkward and/or counterproductive.
----------------------------------------
Emmanuel Puybaret, Sweet Home 3D creator