WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Lighting Question (https://forum.worldviz.com/showthread.php?t=3315)

new_horizon 01-11-2011 06:57 AM

Lighting Question
 
Hi All,

I will admit to being a complete Vizard novice and most of the experiments I have been programming have been very basic.

However, now I am trying to conduct an experiment in a virtual scene that has been created - it consists of a number of images of buildings and road etc to create a virtual city environment. The idea is that I will have images moving through this environment, towards the observation point.

My problem is that I wish to manipulate the level of ambient light within the scene. I have tried adjusting the HeadLight...

headlight = viz.MainView.getHeadLight()
headlight.spread(100)
headlight.intensity(100)

...but this makes no differences to how the scene appears.

Perhaps I have made an error, but can anyone point me in the right direction?

Thanks

new_horizon 01-11-2011 07:35 AM

Ammendment
 
Apologies, the information above is incorrect. The city scene has been created via the following...

import viz

#Initialize city
city = viz.add('euro_test19_opt_lite.ive')
city.disable(viz.COLLISION)
city.disable(viz.LIGHTING)
city.appearance(viz.DECAL)
city.disable(viz.DEPTH_WRITE, 'lanes')
city.disable(viz.DEPTH_TEST, 'lanes')

city.draworder(-3, 'ground')
city.draworder(-2, 'sidewalks')
city.draworder(-1, 'lanes')

How can I change the level of light within this scene? I am trying to create a spectrum that can range from night to dusk to day.

Thanks

Jeff 01-11-2011 11:23 AM

In Vizard you can add lights and adjust their color. Take a look at the Lighting a Scene example in the Vizard Teacher in a Book. That's available from our download page.

new_horizon 01-12-2011 04:27 AM

Hi Jeff,

Thanks for the advice - I am currently working through the Vizard Teacher in a Book now - really useful stuff!

However, I have come a little unstuck and have seen another post on here that was similar regarding the .IVEx files that are included as resources with the book. When using them, Vizard states that it does not recognise the file format and as you posted before, this is because they are not intended to be edited. I have tried to change the file type to .ive but receive the following error...

Loading File: vcc_male.cfg
Loading File: lantern.ive
Error reading file: DataInputStream::DataInputStream(): This file has an unreadable endian type.
Warning: Could not find plugin to read objects from file "lantern.ive".
** ERROR: Failed to load 'lantern.ive'
** ERROR: Link failed (source linkable is invalid)
** Load Time: 0.89 seconds

Can you shed any light on how to get around this issue?

Best wishes,

Jeff 01-12-2011 09:07 AM

It's not necessary to modify the file's extension. If you have the model lantern.ivex in the folder of your script you should be able to load it using:
Code:

lantern = viz.add('lantern.ive')

new_horizon 01-14-2011 03:57 AM

Fantastic Jeff! You are really helping me here - feel like I am learning a lot!

Another question if I may? The city scene that I have is now responding appropriately - the buildings are darkening as I reduce the new light that I have added - however, the road - which has shadows from the buildings - stays exactly the same despite changes to the light I added - do you have any idea why this might be? Also, is there a way of getting the sky to change colour based on the light setting?

Again, I can't thank you enough for your help

Mark

new_horizon 01-14-2011 08:31 AM

I should mention that I am trying to manipulate the 'euro_test19_opt_lite.ive' scene in case you are familiar with it?

Thanks again

Jeff 01-14-2011 05:31 PM

The ground has lighting baked into it and does not seem to respond like the rest of the model with real time lighting. You could try blending in a black texture with the ground to darken it so it matches the surroundings. I created a black texture in an image editor and used the following code and it worked ok for a night scene:
Code:

blackTexture = viz.addTexture('black.jpg')

ground = city.getChild('ground')
ground.texture(blackTexture,unit=3)
ground.texblend(0.8,unit=3)

lanes = city.getChild('lanes')
lanes.texture(blackTexture,unit=3)
lanes.texblend(0.8,unit=3)

sidewalks = city.getChild('sidewalks')
sidewalks.texture(blackTexture,unit=3)
sidewalks.texblend(0.8,unit=3)

For the sky, you could set the background to different colors instead of using the sky texture.

new_horizon 01-17-2011 07:42 AM

Hey Jeff,

That's brilliant, thanks so much! I thought that there was something a little strange about the ground lighting and that has cured it!

I feel like I have learned a lot this last week - a large part due to you - so thanks very much for your time - it's very much appreciated!

Mark

new_horizon 01-24-2011 08:46 AM

Hi again,

So texturing the road surface black was a good solution - however, I need to adjust the ambience of the scene and am moving a motorcycle with an illuminated headlight along the road - thus the road really needs to react to that light as well as the overall "sunlight" that I have inserted.

Is there a quick way of developing a ground plain that reacts in this way?

Thanks for your help again,

Mark

Jeff 01-25-2011 05:42 PM

Quote:

Is there a quick way of developing a ground plain that reacts in this way?
Not that I can think of using code since lighting is baked into the the ground objects.

It sounds like for what you need, the model would need to be exported without light maps or exported with light maps that are not so bright.

new_horizon 01-28-2011 07:19 AM

Please forgive my lack of knowledge, but how would I go about doing that?

Thanks

new_horizon 02-24-2011 08:11 AM

Creating a light reactive groundplane
 
Hi All,

Just thought I should post this tip in here with regards to how to create a light-reflective road surface...

ground = viz.addTexture('tarmac.jpg')
road = viz.addTexQuad(viz.WORLD,viz.MainScene,1000) # 100m sq quad
road.texture(ground)
road.setPosition(0,0,0) #
road.rotate(90,90,0)
road.appearance(viz.TEXGEN)
road.appearance(viz.TEXMODULATE)

Seems to work!

Mark


All times are GMT -7. The time now is 03:05 AM.

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