View Single Post
Old 01-13-2017, 12:49 PM
Veleno Veleno is offline
WorldViz Team Member
Join Date: Sep 2005
Posts: 148
Post Exposure Sample Script

Nothing wrong with your setup - your scene is just over exposed. The default exposure looks something like Diffuse * (Lightmap * 2), where lightmap values are interpreted on a 0 to 1 scale (e.g. 255 in photoshop reads as 1.0 to Vizard). This means that a neutral exposure is 50% gray.

As long as none of your brights are clipped in your lightmap you shouldn't need to rebake - exposure can be adjusted in Vizard by using a post process shader, like this:

import viz
import vizfx

vizfx.addChild('Exposure Test.OSGB')

# Disable the default light (directional light attached to user viewpoint).
# This should be done as soon as your scene has it's intended light added in.

# Import vizfx's post process functions,
# then specifically grab the ones for color adjustment.
import vizfx.postprocess 
from vizfx.postprocess.color import ExposureEffect

# Create a new Exposure effect. In this case I'm darkening by 3 f-stops.
# If you aren't familiar with camera terms, going down by one f-stop
# halves the current brightness, while going up doubles it.
effect = ExposureEffect(-3)

# Add the effect to the post process manager

# Important: set the pixel format to 32 bit. 
# This prevents banding after re-exposure and prevents bright whites from being clipped. 
# Exposure will not work as expected with overexposed scenes without this line.
That should help you out. Please also note that inspector does not currently have a way to adjust exposure or add other post effects on its own. You may also want to disable Inspector's default sun node or disable realtime lighting on your model if it's making it difficult to accurately see what's going on in your model.

On a side note, lightmaps are treated as part of the lighting model in the vizfx shader so they are compatible with realtime lights.

I've attached a sample file that adjusts the exposure on a test model, and you can learn more about Vizard's built in post-process shaders here:
Attached Files
File Type: zip Exposure PostFX Sample (8.4 KB, 758 views)

Last edited by Veleno; 01-13-2017 at 12:56 PM.
Reply With Quote