Depth of field (working version)

Tubulii

27-12-2011 13:56:47

Hi,

I want to share my (from c++ to net) converted version of this dof implemention.

Note: I only converted this code. I used a modified version by polygon9

There is now a wiki page: http://www.ogre3d.org/tikiwiki/Dof+shader+in+Mogre


How to use it:

There are three classes:
DepthOfField - This is the class which controls the dof shader and the underlying compositor script.
Lens - This is a class which makes it easier to control the DeathOfField class (makes it more natural)
dofmanager - This class combines both other classes to an automatic dof shader: create a new instance and set mode=automatic and everything runs out of the box

"Install":
1. Copy the folder "dof" and its files (in dof.zip) to your media folder
2. Add a reference of the folder "dof" either in code or in the resource file
3. create a dofmanager instance (and set the values you need) or do it by hand with DeathOfField [and Lens]

These are some pictures from the original thread.
The original source is here.

Thanks to:
DWORD
polygon9






andyhebear1

29-12-2011 09:45:26

great! it's very useful

Beauty

15-01-2012 17:21:28

Nice would be to create a wiki page related your code.
So people have a better chance to find you useful work - even after month and years.

Tubulii

15-01-2012 19:52:15

Ok, it's on my todo list.

Just one question: Where should it be? In the snippet section?

Beauty

16-01-2012 02:33:05

Good question.
... And good idea.

I would suggest to add it as child to:
Libraries » Alternative Languages » MOGRE » Mogre HOWTO's and Snippets

The page you can create with easy by "add page" from here:
http://www.ogre3d.org/tikiwiki/Mogre+HO ... d+Snippets

tafkag

16-01-2012 09:31:29

Nice work! But no need to kill the poor field, as it's actually "depth of field" instead of death. :wink:

Tubulii

16-01-2012 17:51:13

Nice work! But no need to kill the poor field, as it's actually "depth of field" instead of death. :wink:
:oops:

Edit: (my first) Wiki page created: http://www.ogre3d.org/tikiwiki/Dof+shader+in+Mogre (Section: Shaders)

Beauty

17-01-2012 00:05:02

Great work - it's looking really well.
Thank you very much. :D

Additionally it's nice to see that you added both, C# and VS.

lucassazon

08-11-2016 18:17:07

Hi,

I'm trying to implement DOF with Mogre 1.7.4, but when I try to Render my Scene, I receive this error message:

"The native class that implements Ogre::Renderable isn't a subclass of CLRObject. Cannot create the CLR wrapper object."

Anyone has a sugestion?

More information:
- When I implemented DepthOfFieldEffect class, I can't declare RenderTargetListener RenderTargetListener and CompositorInstance.Listener Listener, because I have a compilation error: Cannot declare a variable of static class.
But these 2 variables are not used in this class, so I commented these 2 lines.

- I'm using DX9

- The Ogre.log does not show any error. All shaders are compiling well

Thank you