Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cameras and Light Chapter 4, The Inventor Mentor.

Similar presentations


Presentation on theme: "Cameras and Light Chapter 4, The Inventor Mentor."— Presentation transcript:

1 Cameras and Light Chapter 4, The Inventor Mentor

2 Camera structure Image plane Focal length

3 Camera nodes Camera node should be near the top left Camera node generates a picture after it A scene should contain only one camera The camera position is set by current trans. Viewport – rectangular rendered area How can we use more than one camera?

4 Built-in viewer Using viewer (predefined camera) –SoWinExaminerViewer * viewer = new SoWinExaminerViewer(window); –viewer->setSceneGraph(root); –viewer->show(); Using your own window –SoWinRenderArea *myRenderArea = new SoWinRenderArea(window); –root -> addChild(myCamera) –myCamera->viewAll(root, myRenderArea- >getViewportRegion()); –myRenderArea->setSceneGraph(root); –myRenderArea->show();

5 Perspective camera widthAngle = heightAngle*aspectRatio

6 Orthographic camera width = height*aspectRatio

7 Orthographic – Perspective

8 SoCamera viewportMapping (SoSFEnum) –How to map camera to the viewport –Adjust the viewport (dead space remains) CROP_VIEWPORT_FILL_FRAME CROP_VIEWPORT_LINE_FRAME CROP_VIEWPORT_NO_FRAME –Adjust the camera to fit the viewport (default) ADJUST_CAMERA Temporarily override aspectRatio –Adjust the image (distortion) LEAVE_ALONE

9 SoCamera position (SoSFVec3f) –Location of the camera viewpoint (origin). –Modified by the current transformation. orientation (SoSFRotation) –Orientation of camera’s viewing direction (V). –Camera rotation with respect to the default. The default position and orientation of a camera is at (0,0,1) looking along the negative z-axis. The up direction is (0, 1,0).

10 SoCamera aspectRatio (SoSFFloat) –Ratio of the camera viewing width to height. –Must be greater than 0 –SO_ASPECT_SQUARE = 1/1 –SO_ASPECT_VIDEO = 4/3 –SO_ASPECT_HDTV = 16/9 nearDistance (SoSFFloat) –Camera viewpoint to the near clipping plane.

11 SoCamera farDistance (SoSFFloat) –Camera viewpoint to the far clipping plane. focalDistance (SoSFFloat) height / heightAngle (SoSFFloat)

12 SoCamera functions void pointAt(SbVec3f &target) –Sets the orientation towards specific target void viewAll(SoNode *root, SbViewportRegion &vpRegion, float slack = 1.0) –View the entire scene –Orientation does not change –Position, near distance and far distance change –SbViewportRegion vpRegion(myRenderArea->getSize());

13 Example

14 Lights in Inventor Light node in Inventor determines –What the light illuminates (following nodes) –Where it is located (affected by current transformation) Light sources are cumulative SoTransformSeparator –Light should not be under standard separator –You can separate only light transformation –Only the light position can be changed

15 Light Nodes SoLight fields –On (SoSFBool) If the source is turned on / off –Intensity (SOSFFloat) 0 – minimum 1 – maximum –color (SOSFColor) Color of the light

16 Light Nodes SoPointLight (Point Source) – location (SoSFVec3f) 3D location of a point light source affected by current geometric transformation

17 Light Nodes SoDirectionalLight (Parallel source) –direction (SOSFVec3f) Direction of rays Affected by current transformation

18 Light Nodes SoSpotLight –A point light restricted to a cone – location (SoSFVec3f) 3D location of a point light source affected by current geometric transformation – direction (SoSFVec3f) primary direction of illumination – dropOffRate (SoSFFloat) rate at which the light intensity drops off from the primary direction. 0.0 = constant intensity 1.0 = sharpest drop-off

19 Light Nodes cutOffAngle (SoSFFloat) –angle, in radians, where the intensity is 0.0 –measured from one cone edge to the other

20 Light Nodes Directional lights are the fastest Spotlights are the slowest To increase speed use fewer lights

21 Multiple Lights Example The example contains: –A red stationary directional light –A green light moved back and forth by SoShuttle


Download ppt "Cameras and Light Chapter 4, The Inventor Mentor."

Similar presentations


Ads by Google