Is there a way to implement an isometric camera (similar to blender isometric projection)?
It seems like I sohuld pass something like this https://en.wikipedia.org/wiki/Isometric_projection to TCamera.SetProjectionMatrix... Can you point me to example/documentation or an explanation that will link math 3x3 matrix to 4x4 projection matrix? Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You should not manually call TCamera.ProjectionMatrix , the scene manager does it for you. (I added comments to TCamera.ProjectionMatrix and TCamera.SetProjectionMatrix to make it clear.)
To use an orthographic camera, simply use OrthoViewpoint (instead of Viewpoint) in the main X3D file. See http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/navigation.html#OrthoViewpoint . The isometric view is a special case of the orthographic projection (see https://en.wikipedia.org/wiki/Orthographic_projection in addition to the page you linked about isometric camera.) So simply rotate the OrthoViewpoint to get the isometric view:) You can rotate it by OrthoViewpoint.orientation and/or by placing OrthoViewpoint under Transform. Using view3dscene "Console->Print Current Camera..." options may be useful to do it by hand, using CamDirUp2OrientQuat procedure may be useful to do it by code:)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I.e. I create an OrthoViewpointNode and add it as a child to the RootNode -> MainScene. However, ViewpointsCount is zero and I just get a standard examine camera at render...
How do I specify render to use OrthoViewpointNode instead of a 'normal' camera?
I have MainScene.ViewpointStack; and CastleControl1.SceneManager.Viewports; but they seem to be read-only...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hm, weird. What you're doing should work correctly. The ViewpointsCount and GetViewpointName should allow you to access the new viewpoint. Also, it should be chosen as the default viewpoint, and used.
Note:
1. The camera mode will still be Examine by default. It should just be in orthographic mode. To control the navigation mode, use NavigationInfo node with type like "WALK". The navigation mode (examine, walk, fly...) is completely independent from the viewpoint (perspective, orthographic).
2. Are there no other viewpoints in untitled.x3d ? If there are, they will be picked first (although you would see ViewpointsCount >= 2 in this case..) You can add the viewpoint as 1st to avoid it:
Root1.FdChildren.add(0, Ortho);
If this doesn't help, I will need more info/code to debug the problem. Your code looks cool, it should definitely work!:)
3. As for the stack: you can place your viewpoint on top of the stack at any moment by "OrthoViewpoint.EventSet_Bind.Send(true);". But you should not need it in your case (in your case, the simpler mechanism that chooses the 1st available viewpoint at start should work Ok).
Last edit: Michalis Kamburelis 2015-11-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Is there a way to implement an isometric camera (similar to blender isometric projection)?
It seems like I sohuld pass something like this https://en.wikipedia.org/wiki/Isometric_projection to TCamera.SetProjectionMatrix... Can you point me to example/documentation or an explanation that will link math 3x3 matrix to 4x4 projection matrix? Thanks!
You should not manually call TCamera.ProjectionMatrix , the scene manager does it for you. (I added comments to TCamera.ProjectionMatrix and TCamera.SetProjectionMatrix to make it clear.)
To use an orthographic camera, simply use OrthoViewpoint (instead of Viewpoint) in the main X3D file. See http://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/navigation.html#OrthoViewpoint . The isometric view is a special case of the orthographic projection (see https://en.wikipedia.org/wiki/Orthographic_projection in addition to the page you linked about isometric camera.) So simply rotate the OrthoViewpoint to get the isometric view:) You can rotate it by OrthoViewpoint.orientation and/or by placing OrthoViewpoint under Transform. Using view3dscene "Console->Print Current Camera..." options may be useful to do it by hand, using CamDirUp2OrientQuat procedure may be useful to do it by code:)
Sorry for asking more questions... still this one does not work for me...
I.e. I create an OrthoViewpointNode and add it as a child to the RootNode -> MainScene. However, ViewpointsCount is zero and I just get a standard examine camera at render...
How do I specify render to use OrthoViewpointNode instead of a 'normal' camera?
I have MainScene.ViewpointStack; and CastleControl1.SceneManager.Viewports; but they seem to be read-only...
Hm, weird. What you're doing should work correctly. The ViewpointsCount and GetViewpointName should allow you to access the new viewpoint. Also, it should be chosen as the default viewpoint, and used.
Note:
1. The camera mode will still be Examine by default. It should just be in orthographic mode. To control the navigation mode, use NavigationInfo node with type like "WALK". The navigation mode (examine, walk, fly...) is completely independent from the viewpoint (perspective, orthographic).
2. Are there no other viewpoints in untitled.x3d ? If there are, they will be picked first (although you would see ViewpointsCount >= 2 in this case..) You can add the viewpoint as 1st to avoid it:
If this doesn't help, I will need more info/code to debug the problem. Your code looks cool, it should definitely work!:)
3. As for the stack: you can place your viewpoint on top of the stack at any moment by "OrthoViewpoint.EventSet_Bind.Send(true);". But you should not need it in your case (in your case, the simpler mechanism that chooses the 1st available viewpoint at start should work Ok).
Last edit: Michalis Kamburelis 2015-11-08