Depth of Field demo release
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
Hm, it worked for me moments ago. I can e-mail it to you if you want.
I'm working to integrate yours and raflegan's changes. I can confirm that your changes also work on nVidia. I start hating compilers that silently compile errorneus code, it would be a lot easier to spot bugs if it would just 'not work' on errors.
I'm working to integrate yours and raflegan's changes. I can confirm that your changes also work on nVidia. I start hating compilers that silently compile errorneus code, it would be a lot easier to spot bugs if it would just 'not work' on errors.
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
I integrated your changes and added the missing test programs for D3D. Now it runs exactly the same on D3D and GL. Thanks for compatibility testing and fixing.
Please let me know if it runs on ATI now, too.
Binary Windows demo: dof-0.1.3-bin-win32.zip
Source for Linux and Windows (VS.NET 7.1): dof-0.1.3-src.tar.bz2
Edit: Btw, on performance, in Windows D3D runs twice as fast as GL on my machine, however running GL in Linux is just as fast D3D is in Windows.

Binary Windows demo: dof-0.1.3-bin-win32.zip
Source for Linux and Windows (VS.NET 7.1): dof-0.1.3-src.tar.bz2
Edit: Btw, on performance, in Windows D3D runs twice as fast as GL on my machine, however running GL in Linux is just as fast D3D is in Windows.

-
- Bugbear
- Posts: 863
- Joined: Tue Apr 19, 2005 6:10 am
- Location: Melbourne, Aus
-
- Bugbear
- Posts: 863
- Joined: Tue Apr 19, 2005 6:10 am
- Location: Melbourne, Aus
Afraid not. I'm using Win2K, so...
[edit]
Hmm, that's odd. I do notice that DX9 runs at a higher frame rate than OpenGL on my computer, but the DX9 version also seems to be blurrier.
The following two screenshots were taken on consecutive runs of the program, one using DX, the other OpenGL. The camera was not moved and no other settings were changed:
DX9:

OpenGL:

Seems a bit strange.
[/edit]
[edit]
Hmm, that's odd. I do notice that DX9 runs at a higher frame rate than OpenGL on my computer, but the DX9 version also seems to be blurrier.
The following two screenshots were taken on consecutive runs of the program, one using DX, the other OpenGL. The camera was not moved and no other settings were changed:
DX9:

OpenGL:

Seems a bit strange.
[/edit]
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
-
- Gnoblar
- Posts: 16
- Joined: Thu May 25, 2006 3:32 pm
- Location: Vienna, Austria
Do you get any exceptions in Ogre.log concerning the vertex or fragment shaders?
The DoF_DepthOfField_hlsl.frag shader has to be compiled to ps_3_0 in DirectX, does your card support pixel shader 3.0?
Alternatively, the shader could be compiled to ps_2_a, too, but I don't know if Ogre supports that shader model.
The DoF_DepthOfField_hlsl.frag shader has to be compiled to ps_3_0 in DirectX, does your card support pixel shader 3.0?
Alternatively, the shader could be compiled to ps_2_a, too, but I don't know if Ogre supports that shader model.
-
- OGRE Contributor
- Posts: 217
- Joined: Wed Jan 25, 2006 11:16 pm
- Location: Redmond,WA
-
- Bugbear
- Posts: 863
- Joined: Tue Apr 19, 2005 6:10 am
- Location: Melbourne, Aus
I just updated my drivers, and there's no change.DWORD wrote:Hm, the GL version is the right one. It looks like the DX version ignores the depth completely and just blurs everything.On my 6800 it looks identical on GL and DX, so I don't know what could be wrong. Updated drivers?
No exceptions in the Ogre.log, though there are a few errors reported, though I think they're "normal":raflegan wrote:Do you get any exceptions in Ogre.log concerning the vertex or fragment shaders?
Code: Select all
22:29:03: Error in material Examples/Robot at line 617 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareSkinningOneWeight has not been defined.
22:29:03: Error in material Examples/Robot at line 629 of Example.material: Invalid shadow_caster_vertex_program_ref entry - vertex program Ogre/HardwareSkinningOneWeightShadowCaster has not been defined.
22:29:03: Error at line 677 of Example.material: Error in program Examples/GrassWaverVp parameter entry_point is not valid.
22:29:03: Error at line 677 of Example.material: Error in program Examples/GrassWaverVp parameter profiles is not valid.
22:29:03: Error in material Examples/HardwareMorphAnimation at line 764 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwareMorphAnimation has not been defined.
22:29:03: Error in material Examples/HardwarePoseAnimation at line 799 of Example.material: Invalid vertex_program_ref entry - vertex program Ogre/HardwarePoseAnimation has not been defined.
My card is a 6200, so yes, it supports ps3.0raflegan wrote:The DoF_DepthOfField_hlsl.frag shader has to be compiled to ps_3_0 in DirectX, does your card support pixel shader 3.0?
My card is a bit of a weird one in some respects though. For one, it has 256MB, which seems a fair bit for a 6200. Also, I'd read in a few places (including in a couple of threads on the ogre forums) that there is little difference between the 6200 and the 6600, and you can effectively turn your 6200 into a 6600 by using some software and re-enabling some pixel pipelines. So, I decided to give that a go, and found that according to the software (RivaTuner), those said pixel pipelines are already enabled. Don't know what's going on there.
-
- Gnoblar
- Posts: 16
- Joined: Thu May 25, 2006 3:32 pm
- Location: Vienna, Austria
-
- Hobgoblin
- Posts: 523
- Joined: Fri Jan 06, 2006 6:35 pm
when I try to do this (in direct3d9)
it causes a crash that doesn't log an error. If someone can offer me advice on debuggin this i'd be glad to try and find the source of the error, but when I compile the debug version and do debug->start it has an exception that breaks to a bunch of assembly.
Code: Select all
DepthOfFieldEffect *DOFE = new DepthOfFieldEffect(viewPort);
-
- Gnoblar
- Posts: 16
- Joined: Thu May 25, 2006 3:32 pm
- Location: Vienna, Austria
I have tried the DoF Effect on computer with an ATI card today and it worked there.
To get correct debug information, you would probabely need the ogre library debug information (in VisualStudio the OgreMain.pdb or OgreMain_d.pdb file) to get a more exact location of the error.
You could also try to test very simple shaders, to see if something is wrong with the hlsl shaders, e.g. rewrite the DoF_DepthOfFiel_hlsl.frag shader to:
(You have to use pixelSizeScene and pixelSizeBlur in the output, otherwise the compiler would optimize them away)
If you get a red screen, then this shader is causing the problems, otherwise it is probabely not this shader causing the problem (or at least not only this shader).
You could also locate the error more exactly by writing outputs the Ogre.log yourself, e.g. with:
Here is a modified DepthOfFieldEffect.cpp file that outputs text in every step of the depth of field effect construction.
To get correct debug information, you would probabely need the ogre library debug information (in VisualStudio the OgreMain.pdb or OgreMain_d.pdb file) to get a more exact location of the error.
You could also try to test very simple shaders, to see if something is wrong with the hlsl shaders, e.g. rewrite the DoF_DepthOfFiel_hlsl.frag shader to:
Code: Select all
uniform float2 pixelSizeScene; // pixel size of full resolution image
uniform float2 pixelSizeBlur; // pixel size of downsampled and blurred image
float4 main(float2 tex : TEXCOORD0) : COLOR0
{
return float4(1.0,pixelSizeScene.r,pixelSizeBlur.r,1.0);
}
If you get a red screen, then this shader is causing the problems, otherwise it is probabely not this shader causing the problem (or at least not only this shader).
You could also locate the error more exactly by writing outputs the Ogre.log yourself, e.g. with:
Code: Select all
#include <OgreLogManager.h>
LogManager::getSingleton().logMessage("text");
-
- Bugbear
- Posts: 863
- Joined: Tue Apr 19, 2005 6:10 am
- Location: Melbourne, Aus
I changed the .frag file as you said, and do indeed get a red screen.raflegan wrote:You could also try to test very simple shaders, to see if something is wrong with the hlsl shaders, e.g. rewrite the DoF_DepthOfFiel_hlsl.frag shader to:
(You have to use pixelSizeScene and pixelSizeBlur in the output, otherwise the compiler would optimize them away)Code: Select all
uniform float2 pixelSizeScene; // pixel size of full resolution image uniform float2 pixelSizeBlur; // pixel size of downsampled and blurred image float4 main(float2 tex : TEXCOORD0) : COLOR0 { return float4(1.0,pixelSizeScene.r,pixelSizeBlur.r,1.0); }
If you get a red screen, then this shader is causing the problems, otherwise it is probabely not this shader causing the problem (or at least not only this shader).
-
- Gnoblar
- Posts: 16
- Joined: Thu May 25, 2006 3:32 pm
- Location: Vienna, Austria
Sorry for the late answer.
I have found an error in the DoF_DepthOfField_hlsl.frag shader. Apparently, the global variables have to be initialized inside a function (there is no error if you initialize them somewhere else, but then they just don't get a value, or the value zero).
Here is an updated version of the shader, just replace the old one.
Please tell me if this fixed some of the errors.
I have found an error in the DoF_DepthOfField_hlsl.frag shader. Apparently, the global variables have to be initialized inside a function (there is no error if you initialize them somewhere else, but then they just don't get a value, or the value zero).
Here is an updated version of the shader, just replace the old one.
Please tell me if this fixed some of the errors.
-
- Bugbear
- Posts: 863
- Joined: Tue Apr 19, 2005 6:10 am
- Location: Melbourne, Aus
-
- OGRE Contributor
- Posts: 217
- Joined: Wed Jan 25, 2006 11:16 pm
- Location: Redmond,WA
the problem i have is not resolved yet
the problem is in this code
mCompositor is null after calling addCompositor but i don't know yet why ,any idea??
i think there is files missing
the problem is in this code
Code: Select all
void DepthOfFieldEffect::addCompositor()
{
// Add the compositor to the viewport
mCompositor = CompositorManager::getSingleton().addCompositor(
mViewport, "DoF_Compositor");
// Register 'this' as a listener
mCompositor->addListener(this);
}
i think there is files missing
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
@raflegan, SuprChikn: Thanks, I'll add the new file.
@ahmedismaiel: addCompositor() does indeed return 0 on error, but as I don't get that problem, would it be possible that you could step into the Ogre code and see where it goes wrong, maybe find out which file is missing if that is the case?
Thinking about it, do you run Linux? Because then the problem might be case of the filenames, if you have copied them in manually. Make sure the case matches, or try the new release I'll post in a moment from scratch...
@ahmedismaiel: addCompositor() does indeed return 0 on error, but as I don't get that problem, would it be possible that you could step into the Ogre code and see where it goes wrong, maybe find out which file is missing if that is the case?
Thinking about it, do you run Linux? Because then the problem might be case of the filenames, if you have copied them in manually. Make sure the case matches, or try the new release I'll post in a moment from scratch...
-
- OGRE Retired Moderator
- Posts: 1365
- Joined: Tue Sep 07, 2004 12:43 pm
- Location: Aalborg, Denmark
-
- OGRE Contributor
- Posts: 217
- Joined: Wed Jan 25, 2006 11:16 pm
- Location: Redmond,WA
-
- OGRE Contributor
- Posts: 217
- Joined: Wed Jan 25, 2006 11:16 pm
- Location: Redmond,WA
found it
the minimum version that compiles the fragment_program DoF_DepthOfFieldFP_HLSL is ps_2_b
so in the DOF.program file the declaration should be
now it works fine on ATI x700,thanks DWORD ,thanks OGRE 
the minimum version that compiles the fragment_program DoF_DepthOfFieldFP_HLSL is ps_2_b
so in the DOF.program file the declaration should be
Code: Select all
fragment_program DoF_DepthOfFieldFP_HLSL hlsl
{
source DoF_DepthOfField_HLSL.frag
entry_point main
target ps_2_b
}

-
- OGRE Expert User
- Posts: 1067
- Joined: Mon Mar 29, 2004 8:49 pm
- Location: the Netherlands
- x 43
You are doing some manual things to get to the depth-buffer, but the GPU has one anyway. Is there not some way to get a copy of the depth buffer as it is from the GPU?
My dev blog
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/X1/PS3/PS4)
Blightbound: coop online dungeon crawler (PC)
Swords & Soldiers: side-scrolling RTS (Switch/PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance
The Ageless Gate: cello album
Awesomenauts: platforming MOBA (PC/Mac/Linux/XBox360/X1/PS3/PS4)
Blightbound: coop online dungeon crawler (PC)
Swords & Soldiers: side-scrolling RTS (Switch/PS3/Wii/PC/Mac/Linux/iPhone/iPad/Android)
Proun: abstract racing game (PC)
Cello Fortress: mixing game and live cello performance
The Ageless Gate: cello album
-
- Kobold
- Posts: 37
- Joined: Sun Sep 24, 2006 9:32 am
Help
Hello
I just downloaded the DOF project. Both the windows exe and the compiled version crash.
It seems the mDepthMaterial comes back null
mDepthMaterial = MaterialManager::getSingleton().getByName("DoF_Depth");
because when I step through the code
mDepthMaterial->load()
shows me
- Ogre::SharedPtr<Ogre::Material> {pRep=0x00000000 {mTechniques={first=??? last=???} mSupportedTechniques={first=??? last=???} mBestTechniquesBySchemeList={size=???} ...} pUseCount=0x00000000 } Ogre::SharedPtr<Ogre::Material>
I would appreciate any kind of help.
I have the OGRE SDK 1.2.2, DOF 0.1.4 and NET7.1
Thanks
Best Regards
I just downloaded the DOF project. Both the windows exe and the compiled version crash.
It seems the mDepthMaterial comes back null
mDepthMaterial = MaterialManager::getSingleton().getByName("DoF_Depth");
because when I step through the code
mDepthMaterial->load()
shows me
- Ogre::SharedPtr<Ogre::Material> {pRep=0x00000000 {mTechniques={first=??? last=???} mSupportedTechniques={first=??? last=???} mBestTechniquesBySchemeList={size=???} ...} pUseCount=0x00000000 } Ogre::SharedPtr<Ogre::Material>
I would appreciate any kind of help.
I have the OGRE SDK 1.2.2, DOF 0.1.4 and NET7.1
Thanks
Best Regards
-
- Orc
- Posts: 468
- Joined: Sun Jul 10, 2005 11:44 am
- Location: Kiev, Ukraine