WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Old 12-06-2013, 05:40 AM
Erikvdb Erikvdb is offline
Join Date: May 2013
Posts: 63
Depth of Field

Hi all,
Recently I've played around with the viz.postprocess module a bit, the effects of which are applied to entire screen. However, I am now looking to exclude some foreground objects from the getting blurred. Is that possible? You could describe it as a sort of depth of field, although I don't really need an accurate gradual blurring effect; just blur or no blur (per object).

I guess I should be looking into writing shaders, but for now that seems absolute wizardry to me
Reply With Quote
Old 08-15-2016, 05: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:	495
Size:	185.7 KB
ID:	807  
Attached Files
File Type: txt (19.3 KB, 1113 views)
Reply With Quote
Old 08-16-2016, 09:27 AM
Erikvdb Erikvdb is offline
Join Date: May 2013
Posts: 63
That's awesome, thanks for sharing!
Reply With Quote

depth of field, postprocess

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Depth buffer andrewjworz Vizard 5 03-22-2013 03:54 PM
3D grass shader to mimic large grass field Zhi Vizard 9 04-22-2011 03:43 PM
question about field extention cyclonseye Vizard 1 07-19-2010 04:38 PM
Is an object in the user's field of view? 4711 Vizard 2 06-09-2010 03:16 AM
depth perception for a DTI 3D monitor timbo Vizard 5 07-16-2008 01:23 PM

All times are GMT -7. The time now is 10:35 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC