PDA

View Full Version : Problems with lighting in 2.0


murm
04-14-2004, 09:47 AM
Hello-

I am still having a couple problems with lighting in Vizard 2.0. First, my objects are very dark and difficult to see. I have tried using .disable(viz.LIGHTING) but that does not fix the problem.

Second, I have added fog to my environment and it looks like a black hole rather than bright white fog. I suspect this problem is related to the general lighting problem...

Does anyone know how to fix these two problems? Thank you for your help!

-Matt

farshizzo
04-14-2004, 10:35 AM
Hi Matt,

I believe the default fog color is black. Have you tried changing it to some other color? For example to change the fog color to a light gray you would do the following:viz.fogcolor(0.7,0.7,0.7)
Do your objects that appear dark have textures on them? If they have textures try doing the following:object.appearance(viz.DECAL)
If your objects don't have textures then disabling lighting on them should fix it. You might want to try increasing the intensity of the head light:headlight = viz.get(viz.HEAD_LIGHT)
headlight.intensity(2)
Let me know if you are still experiencing this problem and I'll try to take a look at the model.

mspusch
04-15-2004, 04:53 PM
Just two more thoughts:

a) are you using an ATI graphics card? Which?
b) can you try loading untextured models (like Start - Programs - Vizard20 - 3D Models - 3D Text) into Vizard to see if this is a problem about textures or about lighting?

Thanks,

Matthias

david
04-20-2004, 03:03 PM
As a follow up, I have lighting pbs when I switch textures on an object. Basically, when I switch textures on a self-illuminated object, the object stays as bright as originally, as long as all the textures are non-transparent.
However if I use a transparent texture it seems to mess up the flag for .appearance. As a result if I go back to a non-transparent texture, and if the object is on the side (not in the head light range), it appears darker than originally. So I need to set the flag for .appearance to viz.DECAL. And then if I try to reapply a transparent texture, the transparency is not rendered anymore so I need to set the flag to viz.MODULATE to get the transparency back. It is a little bit of a hassle, but in my case I could track easily the transparency of the texture.

farshizzo
04-20-2004, 03:28 PM
Hi David,

On a side note, you could disable lighting on your object and it should be as bright as possible no matter which texture is applied. The reason your object becomes dim when you apply the transparent texture is because the MODULATE flag must be set in order for transparent textures to appear transparent. However, vizard does not automatically set the DECAL flag when you apply a non-transparent texture, that is why you must do it manually.

david
04-20-2004, 10:01 PM
I tried disabling the lighting for the object but it did not work... The wall was still dim.

farshizzo
04-21-2004, 10:59 AM
Hi David,

Could you try the following script? Replace tree.png with any of your transparent textures. When you run the script it should display the texture spinning in front of you. Press the spacebar to toggle between enabling/disabling lighting. At first the texture should be dim, but when you disable lighting it should always be lit. Let me know if this is not the case.
import viz
viz.go()
quad = viz.add(viz.TEXQUAD)
quad.translate(0,1.6,3)
quad.spin(0,1,0,90)
quad.texture(viz.add('tree.png'))
quad.lit = 1
def mykey(key):
if key == ' ':
quad.lit = not quad.lit
if quad.lit:
quad.enable(viz.LIGHTING)
else:
quad.disable(viz.LIGHTING)
viz.callback(viz.KEYBOARD_EVENT,mykey)Thanks!