Advanced camera settings

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1141
Joined: Tue Jul 06, 2004 5:57 am
x 149
Contact:

Advanced camera settings

Post by spookyboo »

In the forum you find some discussion about Depth of Field and that it is a kind of effect that shouldn't be part of Ogre. I was wondering whether you shouldn't think about it as part of a camera setting. I have limited knowledge of camera's, but settings like aperture and focusing distance contribute to the way how a scene is visualized (these are 2 important settings that produce the DOF effect). Shouldn't the Camera class be extended with 'real' camera settings, so it becomes possible to play with these camera settings as if it was a real camera (just as FOV). This means that effects like depth of field become part of Ogre, but in a more natural way. This also makes other camera tricks possible without the feeling of being an addon. Just a thought.
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: Advanced camera settings

Post by xadhoom »

I think there are several problems with many settings regarding a
"realistic camera". There are several ways how you can implement
a depth of field look and many of them have quality drawbacks (besides performance).
How would you determine which one should be implemented?

Some lens effects can only achieved with a raytracing approach (e.g. fish eye view).
Such effects maybe could be faked with post processing to some degree but it would
be very disappointing.

Though there are some simple setting like lens presets for fov and zoom which could
be implemented...
User avatar
Kencho
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4011
Joined: Fri Sep 19, 2003 6:28 pm
Location: Burgos, Spain
x 2
Contact:

Re: Advanced camera settings

Post by Kencho »

Interesting question... It's true that such attributes belong to cameras themselves, though they're "meaningless" when talking about real-time graphics. They can be only useful in the context of a shader that uses them, but again, that should be decoupled from the Ogre core (it would be nice to have demos that show a way to achieve these effects though).

In any case, it's similar to the light power factor that is used mostly by HDR shaders but belongs to the Ogre core (Light class). That was allowed, so this should probably too (at the expense of sacrificing some performance and making the camera class "heavier")
Image
User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1141
Joined: Tue Jul 06, 2004 5:57 am
x 149
Contact:

Re: Advanced camera settings

Post by spookyboo »

I understand that there are multiple implementations possible, but if you compare it to a real world situation, Ogres' implementation would be that of the Minolta Dynax camera, but if you want to use your own algorithm/implementation you can always subclass it and implement you Canon EOS 300 camera :wink:
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 6
Contact:

Re: Advanced camera settings

Post by haffax »

I'd prefer a more generic approach. Lots of ways to implement DoF and other effects and combining them in a shader.
Rather than having a number of fixed parameters, Camera and Light could have an equivalent to Renderable's custom parameters which can be accessed through auto params, maybe as in param_named_auto focalLength camera_custom 0.
With camera_custom and light_custom there is no need to hardcode specific values, instead the Ogre users can set them as needed.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1141
Joined: Tue Jul 06, 2004 5:57 am
x 149
Contact:

Re: Advanced camera settings

Post by spookyboo »

Thats from a developers point of view, but as a concept, a Light and a Camera do have fixed attributes.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Advanced camera settings

Post by jacmoe »

Abstractcoder was working on a camera system plugin, but - sadly - he didn't post any code.
-> http://www.ogre3d.org/forums/viewtopic. ... 71&start=0
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Advanced camera settings

Post by jacmoe »

Here it is:
http://www.ogre3d.org/forums/viewtopic.php?f=11&t=19542
Except that he lost the code.. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
haffax
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 4823
Joined: Fri Jun 18, 2004 1:40 pm
Location: Berlin, Germany
x 6
Contact:

Re: Advanced camera settings

Post by haffax »

Thats from a developers point of view, but as a concept, a Light and a Camera do have fixed attributes.
A nearly infinite amount of attributes. Chromatic aberration, polarisation, phase coherence, and lots more I don't know about. Only a subset of these are needed at a time and new effects, not yet described might even need others too. So in my opinion a fixed set of attributes is too inflexible and doesn't fit into Ogre. There can be the odd exception that a specific attribute is added, but when the need arises to add another and yet another, then the system should be generalized.
team-pantheon programmer
creators of Rastullahs Lockenpracht
User avatar
spookyboo
Silver Sponsor
Silver Sponsor
Posts: 1141
Joined: Tue Jul 06, 2004 5:57 am
x 149
Contact:

Re: Advanced camera settings

Post by spookyboo »

Yes, that is correct, but almost every camera has a fixed subset of them for decades now. I think you can have both (fixed and custom parameters). You need to find some kind of optimum, because you also can carry away with flexibility; why even have fixed attributes in your classes at all? :wink:
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7154
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 525

Re: Advanced camera settings

Post by Kojack »

The Ogre camera is basically a pinhole camera, they don't have depth of field.

If Ogre's camera was going to start adding features which require heavy shader use, I'd prefer it to model the human eye rather than a camera.
It's like all those games that have lens flare, but aren't looking through a camera lens! The human eye has different properties.

Unless the player's view of a game is through the viewfinder of an SLR camera, a complete simulation of a camera shouldn't be the goal for the default ogre camera.
Otherwise imagine trying to play a dark game like Thief, but you have to set the Ogre camera to have a 10 second exposure time per frame because the aperture is too small for low light levels.

It would make a cool addon, but I don't think stuff like that belongs in the default camera.
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Advanced camera settings

Post by Klaim »

It's like all those games that have lens flare, but aren't looking through a camera lens! The human eye has different properties.
That's right.
I think lens flare is popular because it have been used for great narrative and eye-candy effects in movies and most people feel like they know the sensation.
User avatar
madmarx
OGRE Expert User
OGRE Expert User
Posts: 1671
Joined: Mon Jan 21, 2008 10:26 pm
x 50

Re: Advanced camera settings

Post by madmarx »

If you don't use stereo, you can use the focal of the camera ( that is available directly in ogre) to use with depth of field.

But anyway, IMO custom attributes are already available. :D

Code: Select all

virtual void  setUserObject (UserDefinedObject *obj) 
  Call this to associate your own custom user object instance with this MovableObject. 
 
virtual 
UserDefinedObject *  getUserObject (void) 
  Retrieves a pointer to a custom application object associated with this movable by an earlier call to setUserObject. 
 
virtual void  setUserAny (const Any &anything) 
  Sets any kind of user value on this object. 
 
virtual void  setUserAny (const Any &anything) 
  Sets any kind of user value on this object. 
 
virtual const Any &  getUserAny (void) const  
  Retrieves the custom user value associated with this object. 
 
virtual const Any &  getUserAny (void) const  
  Retrieves the custom user value associated with this object. 
 
That is ogre extensivity power. :twisted:

Of course you have to tweak a little your userObject class.
I have a userobjectclass that can accept different parameters/ value, and I can use it to do.
In the end I have only 1 userObjectClass that encapuslate
-> pointer for physics
-> makers for augmented reality
-> sounds info
-> it just :
std::map<string,std::vector<float> > mFloat;
std::map<string,std::vector<int> > mInt;
std::map<string,std::vector<std::string> > mString;

It could contains some values for shaders, then automatisation must be possible (renderablelistener, or materiallistener).
Tutorials + Ogre searchable API + more for Ogre1.7 : http://sourceforge.net/projects/so3dtools/
Corresponding thread : http://www.ogre3d.org/forums/viewtopic. ... 93&start=0
Post Reply