PDA

View Full Version : Changing a 3d scene from daytime to nighttime?


JohnSenior
04-28-2017, 07:51 AM
Dear forum members,

I tried my best on my own, but i got to admit I am lost right now. I am trying to change a 3d scene (e.g. the "piazza") from daytime to nighttime. Is there a way to change the lighting accordingly just using Vizard? My basic idea was to turn off all existing lights an place a few new point lights in the locations of the streetlamps of "piazza". I tried to edit the lighting directly in the osgb.-file using Vizard inspector, but I was not able to turn off the light simulating the sunlight. Is it possible to make these changes within Vizard/Vizard Inspector, or do I have to use 3ds Max for this? Apologies, if these question are basic knowledge, but I couldnt find solutions online either.

Best,
John

Jeff
04-29-2017, 02:05 AM
The piazza was created in 3ds Max with lighting baked into the model. One way to create a scene that has both day and night is to have two versions of the same model, each with it's own baked lighting.

To darken the piazza in Vizard you could try blending in a black texture as described here (http://forum.worldviz.com/showpost.php?p=11608&postcount=8) or use a post process effect:

import viz
viz.go()

piazza = viz.addChild('piazza.osgb')

import vizfx.postprocess
from vizfx.postprocess.color import ExposureEffect
effect = ExposureEffect(-2)
vizfx.postprocess.addEffect(effect)

There's a night version of the sky you could swap in as well:

piazza.visible(viz.OFF,node='pz_skydome-GEODE')
viz.addChild('sky_night.osgb')

Veleno
05-08-2017, 02:23 PM
Hi John,

The lighting & shadows in the Piazza scene is baked into static maps, so it's not possible to relight it the way you're intending unless the lightmaps are removed. I checked the file in Inspector, and they're all on texture unit 1.

To get rid of them, you'd loop through all the objects in the scene with python and clear the texture unit. Jeff may be able to advise on that part.

Veleno
05-09-2017, 12:20 PM
Hi again John,
I exported a version with all the lightmaps stripped out with realtime shadows coming from a directional light instead.

You can get that here: piazza_20170509_nolightmaps.zip (https://mega.nz/#!6sc2CIaK!xkomKSHpaFzgJgvY3RDmPwQcP3FplOEi_FPE2Gs qoE0) (34mb)

Feel free to play around with it as you like!

http://i.imgur.com/2qSLKL7.jpg

JohnSenior
05-19-2017, 04:06 AM
Wow, thats awesome, thanks so much, Veleno!