Depth of Field demo release

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
User avatar
andrea147
Deactivated User
Posts: 1
Joined: Mon Sep 26, 2011 1:31 pm

Re: Depth of Field demo release

Post by andrea147 »

Yes it would be nice if smn do this.... :roll:
User avatar
lordsme
Gremlin
Posts: 167
Joined: Sun Mar 11, 2007 1:11 pm
Location: Turin, Italy
x 10
Contact:

Re: Depth of Field demo release

Post by lordsme »

While writing code to support DoF with multiple cameras, I'm experiencing a problem when I resize my application main viewport with DoF enabled:
cameras lose their correct aspect ratio.

Here's the code line that makes this happen:

Code: Select all

m_pDepthViewport->setCamera(new_camera);
Anyone ever experienced anything like this?
My Portfolio
http://davidedigiannantonio.weebly.com

MESH - Mise-en-scene Helper
http://www.mesh-project.org/

ASALab @ Virtual Reality & Multimedia Park
http://www.vrmmp.it
User avatar
lordsme
Gremlin
Posts: 167
Joined: Sun Mar 11, 2007 1:11 pm
Location: Turin, Italy
x 10
Contact:

Re: Depth of Field demo release

Post by lordsme »

It seems that adding this line of code when resizing the main viewport solves the problem:

Code: Select all

m_pDepthViewport->setDimensions(
		m_pViewer->getViewport()->getActualLeft()
		, m_pViewer->getViewport()->getActualTop()
		, m_pViewer->getViewport()->getActualWidth()
		, m_pViewer->getViewport()->getActualHeight()
		);
My Portfolio
http://davidedigiannantonio.weebly.com

MESH - Mise-en-scene Helper
http://www.mesh-project.org/

ASALab @ Virtual Reality & Multimedia Park
http://www.vrmmp.it
User avatar
Tubulii
Gnoblar
Posts: 5
Joined: Tue Jul 19, 2011 11:52 am

Re: Depth of Field demo release

Post by Tubulii »

I tried to run the shader but I always get

Code: Select all

19:29:09: Attempted to load Cg program 'DoF_DepthVP_cg', but no suported profile was found. 

Code: Select all

vertex_program DoF_DepthVP_cg cg         
{
	source Dof.cg
	entry_point DoF_DepthVP_cg
	profiles vs_3_0               
   
	default_params               
	{
		param_named_auto worldViewProj worldviewproj_matrix      
	}
}
But

19:32:40: * Supported Shader Profiles: hlsl ps_1_1 ps_1_2 ps_1_3 ps_1_4 ps_2_0 ps_2_a ps_2_b ps_2_x ps_3_0 vs_1_1 vs_2_0 vs_2_a vs_2_x vs_3_0 (Ati radeon 5770)

And

Code: Select all

19:29:09: OGRE EXCEPTION(2:InvalidParametersException): Parameter called worldViewProj does not exist.  in GpuProgramParameters::_findNamedConstantDefinition at ..\src\OgreGpuProgram.cpp (line 1097)
19:29:09: Compiler error: invalid parameters in DoF.material(9): setting of constant failed
for all parameters. It doesn't matter which CG dof version in this thread i use. It's always the same.

I have read something that parameters are "kicked out" if they seem not to be used. How ever I have no idea how to fix this.

Has anybody an idea? Thanks!
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Re: Depth of Field demo release

Post by Mind Calamity »

This works for me, it's a different material, but still contains the world view projection matrix parameter, try it like this:

Code: Select all

			vertex_program_ref outline_vs_cg
			{
				param_named_auto worldViewProjMatrix worldviewproj_matrix
				param_named size_value float 0.2
			}
Just remove the default_params.
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
User avatar
Tubulii
Gnoblar
Posts: 5
Joined: Tue Jul 19, 2011 11:52 am

Re: Depth of Field demo release

Post by Tubulii »

Mm, interesting, removing default_params worked but I am still geting this:

Code: Select all

Attempted to load Cg program 'DoF_DepthOfFieldFP_cg', but no suported profile was found. 
I think this means that,
profile vs_3_0 is not supported by my graphics card but why the log says:

Code: Select all

Supported Shader Profiles: hlsl (...) ps_3_0 (...) vs_3_0
Does this mean only hlsl shader vs_3_0 is supported by my ati 5770? The manual says "Cg (3.1.5 Cg programs) (an API- and card-independent, high-level language which lets you write programs for both OpenGL and DirectX for lots of cards)"

Now i am confused...

Edit: I did a fresh restart and with version 1.7.3 it seems to run fine, out of the box. I will now compare the working example with my other project. I hope it is only a typo or a missing file... nevertheless thank you!
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Re: Depth of Field demo release

Post by Mind Calamity »

Check your plugins.cfg file, see if it contains this line: Plugin=Plugin_CgProgramManager, I think that's what fixed it for me last time...
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
User avatar
Tubulii
Gnoblar
Posts: 5
Joined: Tue Jul 19, 2011 11:52 am

Re: Depth of Field demo release

Post by Tubulii »

Mind Calamity wrote:Check your plugins.cfg file, see if it contains this line: Plugin=Plugin_CgProgramManager, I think that's what fixed it for me last time...
And if cg.dll is copied into the right folder: i think that was my mistake. Thanks again.
User avatar
Mind Calamity
Ogre Magi
Posts: 1255
Joined: Sat Dec 25, 2010 2:55 pm
Location: Macedonia
x 81

Re: Depth of Field demo release

Post by Mind Calamity »

Yupp, cg.dll has to be in the same folder as the Cg plugin.
BitBucket username changed to iboshkov (from MindCalamity)
Do you need help? What have you tried?
- xavier
---------------------
HkOgre - a Havok Integration for OGRE | Simple SSAO | My Blog | My YouTube | My DeviantArt
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: Depth of Field demo release

Post by Beauty »

I just want to mention that Mr. Tubulii created a C# port of this code for usage with Mogre and .NET.
Details are here:
http://www.ogre3d.org/addonforums/viewt ... =8&t=15042

Thanks to all people who helped to develop and improve the DepthOfField code. :D
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
User avatar
Beauty
OGRE Community Helper
OGRE Community Helper
Posts: 767
Joined: Wed Oct 10, 2007 2:36 pm
Location: Germany
x 39
Contact:

Re: Depth of Field demo release

Post by Beauty »

On yesterday I motivated Tubulii to create a wiki page for the Mogre port.
Today he created a sweet page for Mogre DOF.
Thanks !! :D

Look here:
http://www.ogre3d.org/tikiwiki/Dof+shader+in+Mogre
Help to add information to the wiki. Also tiny edits will let it grow ... :idea:
Add your country to your profile ... it's interesting to know from where of the world you are.
rybka007
Gnoblar
Posts: 16
Joined: Sun Dec 18, 2011 11:13 pm

Re: Depth of Field demo release

Post by rybka007 »

Hi,

I have a problem with implementing DOF to my project. I have added correct Lens and DepthOfFieldEffect classes to the project and additionally created a class that is called Realistic Camera. From there i try to create an instance of both DepthOfFieldEffect and Lens, but I get:

C:\Users\Ryba\Documents\QtOgre-build\..\QtOgre\source\RealisticCamera.cpp:41: błąd:C2259: 'DepthOfFieldEffect' : cannot instantiate abstract class
due to following members:
'bool Ogre::RenderQueue::RenderableListener::renderableQueued(Ogre::Renderable *,Ogre::uint8,Ogre::ushort,Ogre::Technique **,Ogre::RenderQueue *)' : is abstract

This is akward, because every project I have seen uses this class like that. What can be the problem?
Rambus
Greenskin
Posts: 100
Joined: Tue Aug 01, 2006 6:50 am
Location: Canada
x 6
Contact:

Re: Depth of Field demo release

Post by Rambus »

C:\Users\Ryba\Documents\QtOgre-build\..\QtOgre\source\RealisticCamera.cpp:41: błąd:C2259: 'DepthOfFieldEffect' : cannot instantiate abstract class
due to following members:
'bool Ogre::RenderQueue::RenderableListener::renderableQueued(Ogre::Renderable *,Ogre::uint8,Ogre::ushort,Ogre::Technique **,Ogre::RenderQueue *)' : is abstract
This is a common programming error unrelated to the DoF release. In plain English the error means the class called DepthOfFieldEffect has not been fully defined.

This class inherits from RenderableListener and the RenderableListener class defines a set of pure virtual methods (they start with the keyword virtual and end with '= 0;' ). When ever you inherit from a class with pure virtual members you _must_ provide a definition for them- or you get this error.

I suggest reading up on C++ object oriented programming, it will make your programming life much easier :)

Edit:

To fix:

In DepthOfField.h

Code: Select all

virtual bool renderableQueued(Renderable* rend, Ogre::uint8 groupID, Ogre::ushort priority, Technique** ppTech, RenderQueue* pQueue);
In DepthOfField.cpp

Code: Select all

bool DepthOfFieldEffect::renderableQueued(Renderable* rend, Ogre::uint8 groupID, Ogre::ushort priority, Technique** ppTech, RenderQueue* pQueue)
{
	// Replace the technique of all renderables
	*ppTech = mDepthTechnique;
	return true;
}
I think the error was just a change to the renderableQueued definition between ogre versions but I can't really remember.
rybka007
Gnoblar
Posts: 16
Joined: Sun Dec 18, 2011 11:13 pm

Re: Depth of Field demo release

Post by rybka007 »

I knew what were virtual functions, I just didn't realise that the actual implemention of it changed. Thanks a lot :)

Now I have another akward problem. The whole script runs, I can succesfully modify the lenses parameters. However no matter what I choose, the image with DOF effect is always blurred. It is visible in the image below:

Image

In the log displayed on the right it is visible, that initial focus distance was 300 and it was modified using a ray cast to set it properly (all valuesa are in millimeters). However even after recalculation of dofParams, the effect stays the same.

What could cause the problem?
MarkieMoo
Gnoblar
Posts: 2
Joined: Tue Jan 22, 2013 10:54 am

Re: Depth of Field demo release

Post by MarkieMoo »

Hi all,

Im a noobie. Trying to get this to work on a dual screen system and all seems to work up until the point it calls the previewport function after I create a new DepthOfFieldEffect class.
D3D9RenderWindow* D3D9Device::getPrimaryWindow()
{
RenderWindowToResorucesIterator it = mMapRenderWindowToResoruces.begin();

while (it != mMapRenderWindowToResoruces.end() && it->second->presentParametersIndex != 0)
++it;

assert(it != mMapRenderWindowToResoruces.end());

return it->first;
}
It basically hits the assert() in the function. Can anyone help please?

Thanks
MarkieMoo
Gnoblar
Posts: 2
Joined: Tue Jan 22, 2013 10:54 am

Re: Depth of Field demo release

Post by MarkieMoo »

Is there not simple plugin that works with 1.7.4+ for GL/DX C++? I don't know that's why I'm asking; If I'm being too presumptious please let me know. I just don't know if one exists.

Many Thanks in advance.
Post Reply