GLSL depth of field with bokeh v2.4 (update)

Nice but whats the diff between the pics?

Hi, I am a little busy right now, but I will try to finish the shader and make a new thread about it. I will add also a support for spot lights. The shader is actually simple enough to be hardcoded in Blender itself. It would be nice to make the lamp make a halo when you enable it in lamp settings.
Tony - casting the glow from textures is much more complicated task and could be done with simpler method. Also casting shadows from the glow is GPU intensive task and requires much more code, but it is not impossible.

here is a new update on the depth of field shader.
changes:
• again totally redone the depth of field calculation with 2 possible options:

  • Physically accurate DoF simulation calculated from “focalDepth” ,“focalLength”, “f-stop” and “CoC” parameters.
  • Manual - artist controlled DoF simulation calculated only from “focalDepth” and individual controls for near and far blur planes.

• added “circe of confusion” (CoC) parameter in mm to accurately simulate DoF with different camera sensor or film sizes.
• optical lens vignetting factor based on f-stop value and user defined properties.
• cleaned up the code
• some optimization

Shader is HERE
and new blend HERE

Hey hey Bro! Thanks for gettin back to me. ah i see so it would be complex to cast light from a texture, would you be able to point me in the right direction to where i can find out how to do the simpler method of casting a glow from a texture, does it have something to do with the emitting option for the textures?, if so then i see where ur coming from n it’d no problem to get that workin’. Lookin forward to seein the new improvements on the light casting, this is a feature that greatly impressed me when you first posted itm hahahaha had fevered dreams of using that shader in my game some how hahahahahahaha the spotlight idea would be pretty awesome addition to it as well, thanks so much for all your work bro, and for your speed in which you get it workin! you the man!!

Tony - the best and most efficient way to cast glow from textures ing games would be using emissive maps, like this:

there is also tutorial on this here:
http://salvador.mata.com.mx/blog/2011/10/emissive-maps/

Haha cool beans bro thanks for you help! ill be lookin into this real soon!

Hey martinsh,

Sorry im writing you here but your PM mailbox appears to be full and not accepting any messages…

I have question for you: Can you think of any reasonable way to do the reflections in BGE (2.49 or 2.5-2.6 dont matter) that would be relatively accurate yet would not hog too many resources.

Its for my project (see BGE works in progress thread) and I wanted to do the mutiple reflections (infinity mirror style).

I tried videotexture method (rather slow and inacurate) so I was thinking that maybe some kind of static method would work?

But it there any other method that I have not considered maybe ?!?

I know you did some impressive work in this area so can you suggest anything?

Thank you for your time.

Hi aleksig6,
For real and efficient reflecting and refracting surfaces we will have to wait for rendering improvements from Harmony branch. Infinity mirror can be achieved right now only with Videotexture and yeah it is quite slow.

hahahahaha its kinda funny how this thread went from talkin bout dof to talkin bout all these other non related features i def take some blame on that hahahahahahaha! martinsh ya legend bro!!

Thanks, martinsh. Thats what I thought.

One more question though: If I were to pre-bake textures with all reflections and shadows (very static and inaccurate scene :wink: is there any way I can somehow fix paralax effect so I can at least move camera around? Maybe some switching texture method or some script correction for the camera.

Any suggestion will be really appreciated.

P.S. The only other method that I’m considereing for now is the static scene with prerendered textures+shadows and relfections + static camera ( a static 360 panorama basically) but like i said it would’ve been nice to be able to at least move a camera around the static scene)

Can you please upload the files to say, media fire or the forum download widget? Because all my macbook pro gets is a text file with a whole heap of special characters.

is it dropping the file extension? or perhaps not recognising it?

ws

I just got the 2.4 version and its sooo beautiful, I m really amazed with it, thanks a lot martinsh, thanks a lot!

With those files just go right mouse button -> save as, they’re direct .blend files and not links :smiley:

mine works but it blurry up close and clear far off…mines working backwards :smiley: what am i doing wrong?

2.5/2.6 update?

The shader is working on Blender 2.5x and Blender 2.6x.

Yeah, like HG1 said, it works. You have to press 1 to enable the shader, then left-click to place the focus point around the environment.

@martinsh - By the way, this is awesome!

Works beautifully, Nvidia gtx560. Yes, press 1, then left click. The red dot is the focal point. You can drive around the scene with “wasd” and keep the left mouse pressed.

I tried to use this shader on my new project, but I got a problem, it looks like that a stripe appears over bright areas, its weird and I dont know how to fix it, anyone have an idea about how to fix it?

Attachments