Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Ogre 3D 1.7 Beginner's Guide
Ogre 3D 1.7 Beginner's Guide
Ogre 3D 1.7 Beginner's Guide
Ebook702 pages3 hours

Ogre 3D 1.7 Beginner's Guide

Rating: 0 out of 5 stars

()

Read preview

About this ebook

In Detail

Want to make your own 3D applications, simulations, and games?

OGRE 3D, an open source Object-Oriented 3D Graphics Rendering Engine written in C++, which can be utilized to create a variety of 3D applications and is commonly used in game creation, can help you to do so!

OGRE 3D 1.7 Beginner's Guide, based on the latest version 1.7, makes it super easy for you to make your own monsters, spaceship shooters, weapons, enemies, and more!

OGRE 3D 1.7 Beginner's Guide will teach you to develop 3D applications that are exciting and interesting and if used correctly can result in stunning games and simulations. You will start from the very beginning and then work your way up to complex scenes and stunning effects.

In this book you will start with how to download and configure OGRE 3D, then create your first example scene. With the help of this sample scene, you will be introduced to several related topics each of which will be explained through several other examples and by do-it-yourself tasks.

After each example there is a section that explains the theory behind the technique used for deeper understanding. You will also use what you learned in one example in another example and repeat each technique several times while learning new ones at the same time to strengthen the topics learned. Within no time you will master the art of game creation. Imagine how great you will feel when all your friends are playing the great-looking games you've created with OGRE 3D and this book.

A step-by-step guide for beginners, filled with examples and simple do-it-yourself exercises

Approach

This book is an example-driven introduction to OGRE 3D. Each example shows some new features and you learn step-by-step to create complex scenes with different effects using OGRE 3D. After several examples discussing one topic there is a do-it-yourself part where you will be challenged to solve problems on your own.

Who this book is for

If you have ever wanted to develop 3D applications with OGRE 3D, this example-driven book will enable you to do so. Understanding of C++ is needed to follow the examples in the book.

LanguageEnglish
Release dateNov 24, 2010
ISBN9781849512497
Ogre 3D 1.7 Beginner's Guide
Author

Felix Kerger

Felix Kerger is a Computer Science Student at the Technical University of Darmstadt and has been developing 3D real-time applications using OGRE 3D for more than 5 years. He has given several talks on software development and 3D real-time applications at different conferences and has been working for three years as an assistant researcher at the Fraunhofer Institute for Computer Graphics Research. He also works as a freelance journalist and reports yearly from the Game Developer Conference Europe.

Related to Ogre 3D 1.7 Beginner's Guide

Related ebooks

Computers For You

View More

Related articles

Reviews for Ogre 3D 1.7 Beginner's Guide

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Ogre 3D 1.7 Beginner's Guide - Felix Kerger

    Table of Contents

    Ogre 3D 1.7

    Credits

    About the Author

    About the Reviewers

    Preface

    What this book covers

    What you need for this book

    Who this book is for

    Conventions

    Reader feedback

    Customer support

    Errata

    Piracy

    Questions

    1. Installing Ogre 3D

    Downloading and installing Ogre 3D

    Time for action — downloading and installing Ogre 3D

    What just happened?

    Different versions of the Ogre 3D SDK

    Exploring the SDK

    The Ogre 3D samples

    Time for action — building the Ogre 3D samples

    What just happened?

    Pop quiz — which post effects are shown in the samples

    The first application with Ogre 3D

    Time for action — starting the project and configuring the IDE

    What just happened?

    ExampleApplication

    Pop quiz — which libraries to link

    Loading the first model

    Time for action — loading a model

    What just happened?

    Pop quiz — ExampleApplication and how to display a model

    Summary

    2. The Ogre Scene Graph

    Creating a scene node

    Time for action — creating a scene node with Ogre 3D

    What just happened?

    How to work with the RootSceneNode

    3D space

    Scene graph

    Pop quiz — finding the position of scene nodes

    Setting the position of a scene node

    Time for action — setting the position of a scene node

    What just happened?

    Pop quiz — playing with scene nodes

    Have a go hero — adding a Sinbad

    Rotating a scene node

    Time for action — rotating a scene node

    What just happened?

    Pop quiz — rotating a scene node

    Have a go hero — using Ogre::Degree

    Scaling a scene node

    Time for action — scaling a scene node

    What just happened?

    Pop quiz — creating child scene nodes

    Have a go hero — using createChildSceneNode()

    Using a scene graph the clever way

    Time for action — building a tree using scene nodes

    What just happened?

    Pop quiz — even more about the scene graph

    Have a go hero — adding a following ninja

    Different spaces in a scene

    Time for action — translating in World space

    What just happened?

    Different spaces in a 3D scene

    Translating in local space

    Time for action — translating in local and parent space

    What just happened?

    Pop quiz — Ogre 3D and spaces

    Have a go hero — adding symmetry

    Rotating in different spaces

    Time for action — rotating in different spaces

    What just happened?

    Scaling in different spaces

    Summary

    3. Camera, Light, and Shadow

    Creating a plane

    Time for action — creating a plane

    What just happened?

    Representing models in 3D

    Adding a point light

    Time for action — adding a point light

    What just happened?

    Have a go hero — adding a second point light

    Adding a spotlight

    Time for action — creating a spotlight

    What just happened?

    Spotlights

    Pop quiz — different light sources

    Have a go hero — mixing light colors

    Directional lights

    Time for action — creating a directional light

    What just happened?

    Pop quiz — different light types

    The missing thing

    Time for action — finding out what's missing

    What just happened?

    Adding shadows

    Time for action — adding shadows

    What just happened?

    Creating a camera

    Time for action — creating a camera

    What just happened?

    Have a go hero — doing more with the thing

    Creating a viewport

    Time for action — doing something that illustrates the thing in action

    What just happened?

    Have a go hero — playing with different aspect ratio

    Summary

    4. Getting User Input and Using the Frame Listener

    Preparing a scene

    Time for action — preparing a scene

    What just happened?

    Adding movement to the scene

    Time for action — adding movement to the scene

    What just happened?

    FrameListener

    Pop quiz — design pattern of FrameListener

    Modifying the code to be time based rather than frame based

    Time for action — adding time-based movement

    What just happened?

    Pop quiz — the difference between time- and frame-based movement

    Have a go hero — adding a second model

    Adding input support

    Time for action — adding input support

    What just happened?

    Window handle

    Pop quiz — window questions

    Adding movement to the model

    Time for action — controlling Sinbad

    What just happened?

    Have a go hero — using a speed factor for movement

    Adding a camera

    Time for action — making the camera work again

    What just happened?

    Mouse state

    Pop quiz — capturing the input

    Have a go hero — playing with the example

    Adding wireframe and point render mode

    Time for action — adding wireframe and point render mode

    What just happened?

    Adding a timer

    Time for action — adding a timer

    What just happened?

    Have a go hero — changing the input mode

    Summary

    5. Animating models with Ogre 3D

    Adding animations

    Time for action — adding animations

    What just happened?

    Pop quiz — the importance of time

    Have a go hero — adding a second model

    Playing two animations at the same time

    Time for action — adding a second animation

    What just happened?

    Have a go hero — adding a factor to the animation speed

    Let's walk a bit

    Time for action — combining user control and animation

    What just happened?

    Adding swords

    Time for action — adding swords

    What just happened?

    Animations

    Printing all the animations a model has

    Time for action — printing all animations

    What just happened?

    Summary

    6. Scene Managers

    Starting with a blank sheet

    Time for action — creating a blank sheet

    What just happened?

    Getting the scene manager's type

    Time for action — printing the scene manager's type

    What just happened?

    What does a scene manger do?

    Octree

    Another scene manager type

    Time for action — using another scene manager

    What just happened?

    ResourceManager

    setWorldGeometry

    Creating our own model

    Time for action — creating a model for displaying blades of grass

    What just happened?

    Manual object

    Texture mapping

    Have a go hero — playing with the manual object

    Adding volume to the blades of grass

    Time for action — using more triangles for volume

    What just happened?

    Creating a field of grass

    Time for action — building a field of grass

    What just happened?

    Exploring the name scheme

    Time for action — printing the names

    What just happened?

    Static geometry

    Time for action — using static geometry

    What just happened?

    Rendering pipeline

    Indices

    Summary

    7. Materials with Ogre 3D

    Creating a white quad

    Time for action — creating the quad

    What just happened?

    Creating our own material

    Time for action — creating a material

    What just happened?

    Materials

    Have a go hero — creating another material

    Texture coordinates take two

    Time for action — preparing our quad

    What just happened?

    Using the wrapping mode with another texture

    Time for action — adding a rock texture

    What just happened?

    Using another texture mode

    Time for action — adding a rock texture

    What just happened?

    Using the mirror mode

    Time for action — using the mirror mode

    What just happened?

    Using the border mode

    Time for action — using the border mode

    What just happened?

    Changing the border color

    Time for action — changing the border color

    What just happened?

    Pop quiz — texture modes

    Have a go hero — Using texture modes

    Scrolling a texture

    Time for action — preparing to scroll a texture

    What just happened?

    Time for action — scrolling a texture

    What just happened?

    Animated scrolling

    Time for action — adding animated scrolling

    What just happened?

    Inheriting materials

    Time for action — inheriting from a material

    What just happened?

    Fixed Function Pipeline and shaders

    Render Pipeline

    Time for action — our first shader application

    What just happened?

    Writing a shader

    Texturing with shaders

    Time for action — using textures in shaders

    What just happened?

    What happens in the render pipeline?

    Have a go hero — combining color and texture coordinates

    Interpolating color values

    Time for action — using colors to see interpolation

    What just happened?

    Replacing the quad with a model

    Time for action — replacing the quad with a model

    What just happened?

    Making the model pulse on the x-axis

    Time for action — adding a pulse

    What just happened?

    Summary

    8. The Compositor Framework

    Preparing a scene

    Time for action — preparing the scene

    What just happened?

    Adding the first compositor

    Time for action — adding a compositor

    What just happened?

    How the compositor works

    Modifying the texture

    Time for action — modifying the texture

    What just happened?

    Inverting the image

    Time for action — inverting the image

    What just happened?

    Combining compositors

    Time for action — combining two compositor effects

    What just happened?

    Decreasing the texture count

    Time for action — decreasing the texture count

    What just happened?

    Combining compositors in code

    Time for action — combing two compositors in code

    What just happened?

    Have a go hero — swapping the green and blue color channels

    Something more complex

    Time for action — complex compositor

    What just happened?

    Changing the number of pixels

    Time for action — putting the number of pixels in the material

    What just happened?

    Have a go hero — trying different numbers of pixels

    Setting the variable in code

    Time for action — setting the variable from the application

    What just happened?

    Changing the number of pixels while running the application

    Time for action — modifying the number of pixels with user input

    What just happened?

    Have a go hero — reducing parameter changes

    Adding a split screen

    Time for action — adding a split screen

    What just happened?

    Have a go hero — doing more with viewports

    Putting it all together

    Time for action — selecting a color channel

    What just happened?

    Summary

    9. The Ogre 3D Startup Sequence

    Starting Ogre 3D

    Time for action — starting Ogre 3D

    What just happened?

    Adding resources

    Time for action — loading the Sinbad mesh

    What just happened?

    Using resources.cfg

    Time for action — using resources.cfg to load our models

    What just happened?

    Structure of a configuration file

    Creating an application class

    Time for action — creating a class

    What just happened?

    Adding a FrameListener

    Time for action — adding a FrameListener

    What just happened?

    Investigating the FrameListener functionality

    Time for action — experimenting with the FrameListener implementation

    What just happened?

    Time for action — returning true in the frameStarted function

    What just happened?

    Double buffering

    Time for action — returning true in the frameRenderingQueued function

    What just happened?

    Time for action — returning true in the frameEnded function

    What just happened?

    Adding input

    Time for action — adding input

    What just happened?

    Pop quiz — the three event handlers

    Our own main loop

    Time for action — using our own rendering loop

    What just happened?

    Adding a camera (again)

    Time for action — adding a frame listener

    What just happened?

    Adding compositors

    Time for action — adding compositors

    What just happened?

    Adding a plane

    Time for action — adding a plane and a light

    What just happened?

    Adding user control

    Time for action — controlling the model with the arrow keys

    What just happened?

    Adding animation

    Time for action — adding animation

    What just happened?

    Have a go hero — looking up what we used

    Summary

    10. Particle Systems and Extending Ogre 3D

    Adding a particle system

    Time for action — adding a particle system

    What just happened?

    What is a particle system?

    Creating a simple particle system

    Time for action — creating a particle system

    What just happened?

    Some more parameters

    Time for action — some new parameters

    What just happened?

    Pop quiz — what makes a particle system

    Other parameters

    Time for action — time to live and color range

    What just happened?

    Pop quiz — time to live

    Turning it on and off again

    Time for action — adding intervals to a particle system

    What just happened?

    Pop quiz — emitter parameters

    Adding affectors

    Time for action — adding a scaler affector

    What just happened?

    Changing colors

    Time for action — changing the color

    What just happened?

    Have a go hero — change the color to red

    Two-way changing

    Time for action — change depending on the lifetime of a particle

    What just happened?

    Even more complex color manipulations

    Time for action — using complex color manipulation

    What just happened?

    Adding randomness

    Time for action — adding randomness

    What just happened?

    Deflector

    Time for action — using the deflector plane

    What just happened?

    Have a go hero — doing more with the thing

    Other emitter types

    Time for action — using a box emitter

    What just happened?

    Emitting with a ring

    Time for action — using a ring to emit particles

    What just happened?

    At the end, we would like some fireworks

    Time for action — adding fireworks

    What just happened?

    Pop quiz — different types of emitter

    Extending Ogre 3D

    Speedtree

    Hydrax

    Caelum

    Particle Universe

    GUIs

    CEGUI

    BetaGUI

    QuickGUI

    Berkelium

    Summary

    The end

    11. Pop quiz — Answers

    Chapter 1

    Installing Ogre 3D

    Chapter 2

    Setting up the Environment

    Chapter 3

    Felix Gogo

    Chapter 4

    Felix Gogo

    Chapter 5

    The Book Inventory Bundle

    Chapter 7

    The Bookshelf: First Stab

    Chapter 9

    The Ogre 3D Startup Sequence

    Chapter 10

    How About a Graphical Interface?

    Index

    Ogre 3D 1.7

    Beginner's Guide


    Ogre 3D 1.7

    Beginner's Guide

    Copyright © 2010 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    First published: November 2010

    Production Reference: 1191110

    Published by Packt Publishing Ltd.

    32 Lincoln Road

    Olton

    Birmingham, B27 6PA, UK.

    ISBN: 978-1-849512-48-0

    www.packtpub.com

    Cover Image by John M. Quick (<john.m.quick@gmail.com>)

    Credits

    Author

    Felix Kerger

    Reviewers

    Manuel Bua

    Gregory Junker

    Acquisition Editor

    Usha Iyer

    Development Editors

    Hyacintha D'Souza

    Mayuri Kokate

    Technical Editor

    Prashant Macha

    Copy Editor

    Leonard D'Silva

    Indexers

    Hemangini Bari

    Monica Ajmera Mehta

    Editorial Team Leader

    Mithun Sehgal

    Project Team Leader

    Ashwin Shetty

    Project Coordinator

    Poorvi Nair

    Proofreader

    Sandra Hopper

    Graphics

    Nilesh Mohite

    Production Coordinator

    Adline Swetha Jesuthas

    Cover Work

    Adline Swetha Jesuthas

    About the Author

    Felix Kerger is a Computer Science student at the Technical University of Darmstadt and has been developing 3D real-time applications using Ogre 3D for more than five years. He has given several talks on software development and 3D real-time applications at different conferences and has been working for three years as an assistant researcher at the Fraunhofer Institute for Computer Graphics Research. He also works as a freelance journalist and reports yearly from the Game Developer Conference Europe.

    I would like to thank the following persons, without whom this book wouldn't have been possible: Steve Streeting for devoting so much time to Ogre 3D and creating one of the best pieces of software I have had the pleasure to work with; my former teachers Ms. Oppel and Ms. Michel, who helped me write a report on which this book's idea is based ; my parents, who were a constant source of inspiration and motivation; Gregory Junker and Manuel Bua, my technical reviewers– their comments helped me no end and improved this book a lot; and, of course, the team at Packt for their constant help and advice.

    About the Reviewers

    Manuel Bua is a software and solutions architect from Trento, Italy. He has over 17 years' experience and has been involved in many small and large-scale software projects, at both the design and implementation levels.

    His background and experience range from software development to reverse engineering, embracing both the desktop and the mobile platform; multithreading, parallel, and massively-parallel computing architectures also pique his interest greatly, as well as computational photography and games development.

    In 2007, he joined Jooce's Research and Development division in Paris, France, holding the position of Chief Architect, engineering and optimizing their in-house, Actionscript-based virtual desktop platform connecting millions of people worldwide; during his staying, he also designed and implemented the compositing window manager governing windows transitions and effects, such as the well-known Wobbly Windows, first introduced by Compiz on the (rocking!) Linux desktop.

    He loves open standards and the open source culture. His desire to learn and to share his knowledge has led him to contribute to various projects, such as Ogre itself; he designed and programmed the original out-of-core implementation of what is known today as the Compositor Framework,

    Enjoying the preview?
    Page 1 of 1