34,79 €
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.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 273
Veröffentlichungsjahr: 2010
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 (<[email protected]>)
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
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.
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," providing both the initial insight and the high-level concepts, laying the foundations for further research, work, and improvements.
He is currently employed at F4F Creative Factory, a design-inspired web and advertising agency based in Arco, Trento, in the roles of solutions architect, software engineer, and systems administrator.
Gregory Junker is the author of the APress book "Pro Ogre 3D Programming."
Creating 3D scenes and worlds is an interesting and challenging problem, but the results are hugely rewarding and the process to get there can be a lot of fun. This book is going to show you how you can create your own scenes and worlds with the help of Ogre 3D. Ogre 3D is one of the biggest open source 3D render engines and enables its users to create and interact freely with their scenes.
This book can't show all the details about Ogre 3D but rather provide a solid introduction with which you, as a reader, can start using Ogre 3D by yourself. After finishing the book, you will be able to use the documentation and the wiki to look up for the needed information and complex techniques, which aren't covered in this book.
Chapter 1, Installing Ogre 3D, shows how to get and configure Ogre 3D. We also create our first scene and start learning the internals of Ogre 3D
Chapter 2, The Ogre Scene Graph, introduces us to the concept of a scene graph and how it is used for describing 3D scenes
Chapter 3, Camera, Light, and Shadow, adds lights and shadows to our scene and also experiments with different camera settings
Chapter 4, Getting User Input and using the Frame Listener, adds interactivity to our application using user input
Chapter 5, Animating Models with Ogre 3D, will enhance our scene using animations to add more interactivity and realism
Chapter 6, Scene Managers, will introduce us to different concepts for organizing 3D scenes and what implication these choices will have
Chapter 7, Materials with Ogre 3D, will show us how to add a new level of detail and flexibility to our application using materials and shaders.
Chapter 8, The Compositor Framework, will show us how to add post processing effects to change the look of our complete scene with the knowledge about materials
Chapter 9, The Ogre 3D Startup Sequence, shows us how we can use Ogre 3D without the help of an ExampleApplication we had used previously
Chapter 10, Particle Systems and Extending Ogre 3D, gives an introduction to some more advanced techniques and perspectives that can be done with Ogre 3D
You need a solid understanding of C++ and how to create applications using C++ for this book. Of course, you need a compiler to compile the example applications. This book uses Visual Studio as a reference, but any other compiler will also do. Your computer should have a graphic card with 3D capabilities. It would be best if the graphic card supports DirectX 9.0 because Ogre 3D is an open source software and we will download it in Chapter 1. So there is no need for you to have Ogre 3D already installed on your computer.
If you ever wanted to develop 3D application 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.
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.
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "Delete all the old code in createScene(), except for the plane-related code."
A block of code is set as follows:
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Press Ok and start the Application. "
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome. Let us know what you think about this book – what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.
If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail <[email protected]>.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code for this book
You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.
Downloading the color images of this book
We also provide you a PDF file that has color images of the screenshots used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/2480_Ogre3D 1.7Beginner's Guide.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books – maybe a mistake in the text or the code – we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.
Downloading and installing a new library are the first steps of learning about and using it.
In this chapter, we shall do the following:
So let's get on with it.
The first step we need to take is to install and configure Ogre 3D.
We are going to download the Ogre 3D SDK and install it so that we can work with it later.
We just downloaded the appropriate Ogre 3D SDK for our system. Ogre 3D is a cross-platform render engine, so there are a lot of different packages for these different platforms. After downloading we extracted the Ogre 3D SDK.
Ogre supports many different platforms, and because of this, there are a lot of different packages we can download. Ogre 3D has several builds for Windows, one for MacOSX, and one Ubuntu package. There is also a package for MinGW and for the iPhone. If you like, you can download the source code and build Ogre 3D by yourself. This chapter will focus on the Windows pre-build SDK and how to configure your development environment. If you want to use another operating system, you can look at the Ogre 3D Wiki, which can be found at http://www.ogre3d.org/wiki. The wiki contains detailed tutorials on how to set up your development environment for many different platforms. The rest of the book is completely platform independent, so if you want to use another development system, feel free to do so. It won't affect the content of this book besides the configuration and conventions of your build environment.
Before we begin building the samples which come with the SDK, let's take a look at the SDK. We will look at the structure the SDK has on a Windows platform. On Linux or MacOS the structure might look different. First, we open the bin folder. There we will see two folders, namely, debug and release. The same is true for the lib directory. The reason is that the Ogre 3D SDK comes with debug and release builds of its libraries and dynamic-linked/shared libraries. This makes it possible to use the debug build during development, so that we can debug our project. When we finish the project, we link our project against the release build to get the full performance of Ogre 3D.
When we open either the debug or release folder, we will see many dll files, some cfg files, and two executables (exe). The executables are for content creators to update their content files to the new Ogre version, and therefore are not relevant for us.
The OgreMain.dll is the most important DLL. It is the compiled Ogre 3D source code we will load later. All DLLs with Plugin_ at the start of their name are Ogre 3D plugins we can use with Ogre 3D. Ogre 3D plugins are dynamic libraries, which add new functionality to Ogre 3D using the interfaces Ogre 3D offers. This can be practically anything, but often it is used to add features like better particle systems or new scene managers. What these things are will be discussed later. The Ogre 3D community has created many more plugins, most of which can be found in the wiki. The SDK simply includes the most generally used plugins. Later in this book, we will learn how to use some of them. The DLLs with RenderSystem_ at the start of their name are, surely not surprisingly, wrappers for different render systems that Ogre 3D supports. In this case, these are Direct3D9 and OpenGL. Additional to these two systems, Ogre 3D also has a Direct3D10, Direct3D11, and OpenGL ES(OpenGL for Embedded System) render system.
Besides the executables and the DLLs, we have the cfg files. cfg files are config files that Ogre 3D can load at startup. Plugins.cfg simply lists all plugins Ogre 3D should load at startup. These are typically the Direct3D and OpenGL render systems and some additional SceneManagers. quakemap.cfg is a config file needed when loading a level in the Quake3 map format. We don't need this file, but a sample does.
resources.cfg contains a list of all resources, like a 3D mesh, a texture, or an animation, which Ogre 3D should load during startup. Ogre 3D can load resources from the file system or from a ZIP file. When we look at resources.cfg, we will see the following lines:
Zip=../../media/packs/SdkTrays.zip
FileSystem=../../media/thumbnails
Ogre 3D comes with a lot of samples, which show all the kinds of different render effects and techniques Ogre 3D can do. Before we start working on our application, we will take a look at the samples to get a first impression of Ogre's capabilities.
To get a first impression of what Ogre 3D can do, we will build the samples and take a look at them.
We built the Ogre 3D samples using our own Ogre 3D SDK. After this, we are sure to have a working copy of Ogre 3D.
a. Bloom, Glass, Old TV, Black and White, and Invert
b. Bloom, Glass, Old Monitor, Black and White, and Invert
c. Boom, Glass, Old TV, Color, and Invert
In this part, we will create our first Ogre 3D application, which will simply render one 3D model.
As with any other library, we need to configure our IDE before we can use it with Ogre 3D.
