PDA

View Full Version : Vizard 2.0x lighting


FlyingWren
08-10-2003, 07:33 PM
As I mentioned in another thread, we aim for "WYSIWYG" lighting; that was, we need to precompute the RGBs on our textures and then just have them appear identically when viewed within Vizard.

One of the first things I noticed with Viz 2.07 is that something is clearly different with the default texture filtering (which I must say I really like). However, is it safe to say that the default lighting has changed too?

I bring this up because some of the textures in our world exhibit different behavior when I view them with v1.98 and v2.07 respectively. For instance, we have a transparent "grate" texture on the floor in one of our virtual worlds, covering up a virtual "pit." In v2.07, when you view the grate orthogonally, the grays that make up the grate are clearly much brighter than when you view the grate at a sharper angle. In v1.98, the pixels that make up the grate appear to be constant, regardless of view angle.

There wasn't any mention of possible lighting changes in the documentation that I saw; can I get the scoop here?

farshizzo
08-10-2003, 08:35 PM
Hi,

There is one significant lighting change in the newer version that you should be aware of. In the old version the default lighting was pointed in a fixed direction. In the newer version the default light is fixed to the head, so it is always pointing in the direction of the view. Since transparent textures are modulated, the color depends on the angle at which the light is hitting it, hence the change in color at the different viewing angles. If you want the grate to always be the same color simply disable lighting on it.


grate = viz.add('grate.wrl')
grate.disable(viz.LIGHTING)


In the code above I'm assuming grate is the name of your grate object. Hope this helps

FlyingWren
08-11-2003, 12:16 PM
Ah. Yep, that does the trick. As always, thanks for your quick and helpful response.

If I could pester you with one more question re: the depth-of-field effect that is in Vizard 2.07... It appears that textures beyond certain distance thresholds appear 'blurred' to various amounts. I assume this is done through mipmapping. Anyway, if we should want to disable it, what's the command?

I tried
room = viz.add('room.wrl')
room.appearance(viz.DECAL)

...and some derivations thereof, but didn't get what I was looking for :)

farshizzo
08-11-2003, 12:53 PM
Hi,

In the latest version you can control the filter mode of textures. So in your case you would do something like this:


tex = viz.add('texture.jpg')
tex.filter(viz.MIN_FILTER,viz.NEAREST)
tex.filter(viz.MAG_FILTER,viz.NEAREST)
object.texture(tex)


However, this method seems like it would be very inefficient if you have a lot of textures that you want to change. So, I'm going to add a new appearance mode, viz.TEXMIPMAP and viz.TEXNEAREST. We are planning on creating an installer for the latest version today, so you can test it out tomorrow morning.

FlyingWren
08-11-2003, 01:20 PM
Oh, wow. Thanks a bunch.

Edit: Just tried it out and it is working just fine. Thanks again.