Camera Control System plugin

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Camera Control System plugin

Post by alberts »

Hi all,

As part of my project I have developed a plugin which implements some basic camera control modes. It is still in an early development stage but if someone is interested in the project he or she can found more info, the source code of the plugin and a demo application at http://ogre-ccs.sourceforge.net.

I know I probably don’t need the Sourceforge infrastructure to share this so “simple” project but I have taken the opportunity to evaluate the SF features for future projects. :)

01-27-2011 - Update: I have added to the sourceforge files repository (https://sourceforge.net/projects/ogre-ccs/files/0.4/) a standalone demo version that includes the Ogre demo browser.

Regards,
Alberto
Last edited by alberts on Thu Jan 27, 2011 2:29 pm, edited 1 time in total.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: Camera Control System plugin

Post by jacmoe »

Really awesome - I like the idea of this! :D

That reminds me of Abstractcoder and the tale of the lost camera system:

http://www.ogre3d.org/forums/viewtopic. ... ra#p322741

http://www.ogre3d.org/forums/viewtopic. ... ra#p151165
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
tuan kuranes
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 2653
Joined: Wed Sep 24, 2003 8:07 am
Location: Haute Garonne, France
x 4

Re: Camera Control System plugin

Post by tuan kuranes »

Very nice system !
Very polished code and website, thanks for sharing !

Is there some camera collision aware demos, just using Ogre Queries as example so that use can easily plugs it physic/collision engine for instance (moc, bullet, ode, nx, etc.)) ?
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Camera Control System plugin

Post by alberts »

Many thanks Jacmoe and Tuan for your feedbacks.
jacmoe wrote:Really awesome - I like the idea of this! :D
That reminds me of Abstractcoder and the tale of the lost camera system:
That’s one of the reasons for which I decided to use Sourceforge to host the project. This way I won’t lose the code! I lost my undergraduate thesis project some years ago so I know the situation :) . It would have been interesting to take a look to his code.
tuan kuranes wrote:Very nice system !
Very polished code and website, thanks for sharing !

Is there some camera collision aware demos, just using Ogre Queries as example so that use can easily plugs it physic/collision engine for instance (moc, bullet, ode, nx, etc.)) ?
I’m using OgreNewt in my main project so I’ll have to take care that soon or later. I’ll keep you informed! :D
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Camera Control System plugin

Post by al2950 »

This is a very nice little system :D

Can I suggest that you move this to the showcase forum, you will certainly get some more feedback there!
Leadwerks
Gnoblar
Posts: 24
Joined: Tue Nov 21, 2006 10:06 pm

Re: Camera Control System plugin

Post by Leadwerks »

Nice work!
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Camera Control System plugin

Post by alberts »

Thanks al2950 and Leadwerks for your comments.
al2950 wrote:Can I suggest that you move this to the showcase forum, you will certainly get some more feedback there!
I was doubting about putting it here or in the showcase forum but I decided to put it here because I think the showcase forum is for more ellaborated projects. If moderators consider this should be in the showcase forum I don't mind if they move it.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179

Re: Camera Control System plugin

Post by jacmoe »

Nah - not showcase.
But a link to it in the Ogre Wiki would be really nice! :)

And maybe later you can make a screenshot or two for the ShowCase forum, if you must.
It's just difficult to take screenshots of a camera system.. :wink:
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Camera Control System plugin

Post by alberts »

jacmoe wrote:But a link to it in the Ogre Wiki would be really nice! :)
Link added in the code snippets section. :)

By the way, Mukik182 has spent some time fixing some errors he have found when using the library on Linux. I've just applied the patches he have sent to me. They also includes the CMake configuration files. It should be platform independent now. Many, many thanks Mukik182! :D
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Camera Control System plugin

Post by al2950 »

Nah - not showcase.
But a link to it in the Ogre Wiki would be really nice! :)

And maybe later you can make a screenshot or two for the ShowCase forum, if you must.
It's just difficult to take screenshots of a camera system.. :wink:
Good point! :oops:
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Camera Control System plugin

Post by al2950 »

Hi,

Was going to intergrate this into my project but i ran into a small problem. The camera system takes in an Ogre::Camera as an input, however i want to be able to have a multiple camera setup (multi head).

I have not looked at your code but would it take much to abstract away from the Ogre::Camera and instead pass it a sceneNode where you can have multiple cameras attached??

*EDIT* Have had a quick look, (Your code is very neat! :)) and it seems it would be very easy to do. Could you add another constructor that takes a sceneNode instead of a camera?

*EDIT Again!!* This is also a good idea (I think!!) because then you not restricted to using the system for cameras, you can use it for lights.. etc...
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Camera Control System plugin

Post by alberts »

Err... Yes. I think I could do that. You mean something like

Code: Select all

CameraControlSystem::CameraControlSystem(Ogre::SceneManager* sm, Ogre::String name, Ogre::SceneNode* customCameraSceneNode
	, bool recalculateOnTargetMoving)
	: mName(name)
	, mSceneMgr(sm)
	, mCurrentCameraMode(NULL)
	, mTargetNode(NULL)
	, mTargetNodeListener(NULL)
	, mRecalculateOnTargetMoving(recalculateOnTargetMoving)
{
	mCameraNode = mSceneMgr->getRootSceneNode ()->createChildSceneNode (mName+"SceneNode");
	mOwnCamera = false;	    
	mCameraNode->addChild(customCameraSceneNode);
}
If not you'll have to explain it a bit more :)
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Camera Control System plugin

Post by al2950 »

Yes... exactly :D
Defade
Gnoblar
Posts: 3
Joined: Fri Nov 20, 2009 7:45 am

Re: Camera Control System plugin

Post by Defade »

I'm unable to run any program created with CSS including the demo without it crashing with a runtime error. The last entry in the log is "*** Initializing OIS ***".
mukik182
Halfling
Posts: 68
Joined: Mon Nov 09, 2009 10:30 pm
Location: Barcelona, Spain
x 1

Re: Camera Control System plugin

Post by mukik182 »

Which version and OS? SDK?
Defade
Gnoblar
Posts: 3
Joined: Fri Nov 20, 2009 7:45 am

Re: Camera Control System plugin

Post by Defade »

CCS compiled on Win XP from lastest SVN with VC++ 2008 Express & Ogre 1.6.4.
mukik182
Halfling
Posts: 68
Joined: Mon Nov 09, 2009 10:30 pm
Location: Barcelona, Spain
x 1

Re: Camera Control System plugin

Post by mukik182 »

I've downloaded latest CCS from SVN and it works fine for me on linux. Could you post more information on your issue? Could it be related to your OIS?
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Camera Control System plugin

Post by alberts »

Defade wrote:CCS compiled on Win XP from lastest SVN with VC++ 2008 Express & Ogre 1.6.4.
Release or debug mode? I have experienced some problems in debug mode.
Defade
Gnoblar
Posts: 3
Joined: Fri Nov 20, 2009 7:45 am

Re: Camera Control System plugin

Post by Defade »

Release mode runs fine.
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Camera Control System plugin

Post by alberts »

@al2950
Commited

@Defade
I opened a thread for that problem some time ago but I didn’t find any solution. I ended up thinking it was a problem with my compiler. I’ll take a look to it again.


By the way, if you have recently downloaded the code you probably have notice the CameraControlSystem constructor now includes a new parameter called “recalculateOnTargetMoving”. If true, the camera position and orientation are recalculated when the target node changes its state (the CCS update method is called twice). This solves the jittering problem with tightness values but I don’t like the solution very much. It is not very efficient so if you are worried about the speed you should set it to false.

The problem is that if the target node is modified inside a frame, the CCS doesn’t take notice of that because the position/orientation of the target node is not actually modified until the very end of the frame. Putting the CCS update method in the frameRenderingQueued method doesn’t work because, as it is said in the api, “any changes you make will only take effect from the next frame”. Do you know any other solution?
User avatar
alberts
Gremlin
Posts: 177
Joined: Fri Mar 31, 2006 8:43 am
Location: Granada-Cádiz-Jaén, Spain
x 20

Re: Camera Control System plugin

Post by alberts »

I have modified the VS configuration for the debug mode. I set the "Runtime Library" parameter to "Debug Multithreaded" instead of "Debug Multithreaded DLL". :oops: . It should works now.
lordzik
Gnoblar
Posts: 1
Joined: Tue Nov 24, 2009 9:10 am

Re: Camera Control System plugin

Post by lordzik »

How did you config your library dependencies? I have following error:
/usr/lib/ld: cannot find -lCameraControlSystem.lib
mukik182 wrote:I've downloaded latest CCS from SVN and it works fine for me on linux.
mukik182
Halfling
Posts: 68
Joined: Mon Nov 09, 2009 10:30 pm
Location: Barcelona, Spain
x 1

Re: Camera Control System plugin

Post by mukik182 »

I downloaded the sources, created a new folder outside the source tree and run cmake-gui on it. Then I put the paths for the source, where to build, where are the ExampleFramework files, where are the includes and where are the libs on my system. Then I chose to build dynamically, generated the makefiles and maked.

I don't use make install for the library. Also the name for my library is libCCS.so not CameraControlSystem.lib

I'm currently working on improving the cmake system for this project (and mine also) to be as simple and automatic as possible. If you have found a bug I'll try to fix it but I will need more information on your issue. Also this system wasn't tested on Windows, I only use Linux for coding.

Did this happen when building the demo or when building your own application? Are you using Linux or cygwin? Which distro? Is the output library from the build named differently from libCCS.so? Are you building shared or static?

I'll try to solve it but for the moment I couldn't reproduce it.
ppanger
Gnoblar
Posts: 1
Joined: Sat Nov 28, 2009 9:04 am

Re: Camera Control System plugin

Post by ppanger »

thanks for sharing !

CCS is a very cool project for OGRE newer like me.

I use it in my FPS project successfully.
I use FirstPerson and Attach camera mode,however I can't control my Ninja node freely. Ninja cannot look up or down. Should I use another cam mode suck as Free mode?

Waiting for your answer. :)
antonl
Gnoblar
Posts: 21
Joined: Fri Nov 27, 2009 7:37 pm

Re: Camera Control System plugin

Post by antonl »

This project looks really promising, but I'm having difficulties building,

My system is Ubuntu Karmic, 9.04
I'm using Ogre from trunk
I checked out the most resent version of CCS from svn at a folder on the same level as my ogre check out
/thirdparty
/ogre
/ogre-ccs

under the ogre-ccs folder I created a new folder called build,
mkdir ogre-ccs/build
cd ogre-ccs/build
cmake ..
ccmake ..

using ccmake, I have tried both my "ogre/build/include" (generated when I used ccmake for ogre) and my "ogre/OgreMain/include" for the "CCS_PATH_TO_OGRE_INCLUDE" value,

when using "ogre/OgreMain/include", I get a compiler error about a missing OgreBuildSettings.h when running make
(Thirdparty/ogre/OgreMain/include/OgreConfig.h:35:31: error: OgreBuildSettings.h: No such file or directory)
This error makes sense (kind of) since OgreBuildSettings.h resides in "ogre/build/include"

Naturally, when I supply "ogre/build/include" as the value for "CSS_PATH_TO_OGRE_INCLUDE", I get compiler errors as well:
ogre-ccs/CameraControlSystem/include/CCSPrerequisites.h:31:18: error: Ogre.h: No such file or directory

what is the correct value for "CCS_PATH_TO_OGRE_INCLUDE", when following the instructions for building Ogre using cmake?