Thread: Depth of Field
View Single Post
Old 08-15-2016, 04:59 PM
Vaquero Vaquero is offline
Join Date: Nov 2015
Posts: 62
Smile Depth of Field giveaway

Well, this answer may come too late for Erik, but it might still be useful for somebody. I took the depth of field GLSL code from Martins Upitis and ported it to Vizard. I left out the part for blurring the depth buffer, since it just introduced undesirable effects.
Attached is the file containing the DoFEffect ShaderEffect class ( I would have liked to just post the code, but it has 10.000 characters too many for the allowed limit.
There's also a screenshot attached showing the effect in action. It may not be perfect, but it's a start.

You can utilize the effect by saving the file somewhere where Vizard can find it and removing the .txt, and then importing it to your python scene file. Here's an example:
Post-Processing Demo: Depth of Field.

import viz
import vizconfig
import vizfx.postprocess

# Import the script that contains the DoFEffect post-processing class.
import ppDOF as dofFX

import vizinfo
# Setup info panel
info = vizinfo.InfoPanel()


import vizcam

# Setup Scene

# clipping planes in meters
nearClip = 0.1
farClip = 200.0

# Create the DoF effect
effect = dofFX.DoFEffect(nearClip,farClip)

# Make effect config window visible
The effect has a lot of settings you can customize.
Attached Thumbnails
Click image for larger version

Name:	DoF-post-processing.jpg
Views:	203
Size:	185.7 KB
ID:	807  
Attached Files
File Type: txt (19.3 KB, 782 views)
Reply With Quote