PDA

View Full Version : Exporting Lights in OSG File


shivanangel
11-28-2012, 08:00 PM
Dear Vizard Support,

I had a question regarding lights being exported from 3D Studio Max.

I created a simple model in 3d Studio max with a light attached and grouped the two objects together.

I exported it using your OSG/IVE exporter and enabled lights in the settings.

When I bring the object into Vizard, the object itself is lit, however nothing else appears to be lit in my scene.

Also, if I make copies of the object, the light is removed from the previous objects and moves to the latest one created.
I get why that is probably happening, since the specific light number in OpenGL is being replaced with new info.

However, I was more interested in why the light only appears to be affecting the objects in the group and copies rather than other objects in the scene.

Also, when exporting lights in this way, is there anything I should know about how the Max settings transfer over to Vizard? That is, what settings in the standard lights are transferable to Vizard (attenuation distance, color, intensity, scaling the light in max, etc...)?

I am trying to make the process of setting up lights in a scene easier by not requiring people to: 1) Code in lights themselves and 2) allow them to interactively place pre-generated lights.

Finally, if I do not want the copies to replace the light location, I am guessing I have to open up the group, grab the node names, grab the child and put that light information into my own light class that would control them internally and provide a proper light number for OpenGL. However, your documentation says you can only support the minimum number of lights required for a graphics card to support in OpenGL, 8 lights.

Is there a way of making sure certain lights only influence certain objects? I know you have light groups for more than 8 lights, but that would require me to do some sort of multiple light sorting for different objects that are under the influence in the scene. And if the light limit exceeded 8 for an area being influenced, I'd have to pull some 'light' averaging trickery to reduce the number back down to 8.

I'd rather list whether a light affects a particular object. Does Vizard have any built-in capabilities for this? Seems I half stumbled upon it with the exported light that only affecting certain models.

I attached a picture with the inspector view of the object and the object in a scene with the headlamp turned off. The model in the background has lighting enabled and was not exported with it turned off. If I turn the lamp on, the whole scene is illuminated.

Thanks,
George Lecakes
Director, VR Lab
Rowan University

P.S. I forgot to reset the XForm on the lamp which is why it is so huge! Whoops. :p

Jeff
12-04-2012, 04:20 PM
Exporting lights through Max is currently not supported and causes the type of issue you're seeing.

It is possible to disable lights on certain nodes. In the following code only light1 is disabled on the basketball:
import viz
import vizact

viz.setMultiSample(4)
viz.fov(60)
viz.go()

soccerball = viz.addChild('soccerball.osgb')
basketball = viz.addChild('basketball.osgb')
volleyball = viz.addChild('volleyball.osgb')

soccerball.setPosition([-0.5,2,1.5])
basketball.setPosition([0,2,1.5])
volleyball.setPosition([0.5,2,1.5])

headLight = viz.MainView.getHeadLight().disable()
light1 = viz.addLight()
light2 = viz.addLight()
light2.setEuler(0,90,0)

basketball.disable(viz.LIGHT0 + light1.getNumber())

shivanangel
12-06-2012, 08:02 AM
Thank you Jeff. Are there any plans to support lighting in the future (within the next year or so), or do you think I should just go ahead with my own system for handling importing lights from 3D Studio Max in the meantime?

Jeff
12-07-2012, 09:49 AM
There are no plans for supporting light imports. So yes, I would say go ahead with your own system for that.