[x3d-public] lights in switch nodes

Andreas Plesch andreasplesch at gmail.com
Fri May 11 18:01:06 PDT 2018


Thank you, Leonard and Doug, for your insightful responses.

The simple background is that there is a github issue with a request
for Lights in non-traversed Switch children being off.

https://github.com/x3dom/x3dom/issues/838

This seems reasonable but I wanted to look into the behavior of other
browsers as well. It may be time for another simple test scene before
I implement the solution I have in mind for x3dom. It does involve
rechecking at each frame which light is traversed so there is little
bit of a performance penalty. [Presumably it would be possible to
update a list of active lights only when events occur].

x3dom does not have local scoping of lights to within their local
grouping, eg. all lights are global which is not the default in x3d:

https://www.web3d.org/files/specifications/19775-1/V3.3/Part01/components/lighting.html#Scopingoflights

Local scoping would require more in depth changes in x3dom and so will
not be a priority [Presumably each drawable would keep its own list of
lights to be passed on to the shader].

So lights in switch nodes will be global in x3dom but could be turned
off when the switch choice changes.

I am not sure if this is super useful since there is also the 'on'
field dedicated to turning lights off and on. In fact, the workaround
in the issue was parallel the change of the switch choice by also
changing the on field.

If most other browsers respect how global lights get traversed in
switches, it is probably beneficial to have x3dom follow.

What would be a good use case for global light nodes in switches which
cannot be accomplished otherwise, eg. by using 'on' field ? A traffic
light as an important source of light in a night scene ? A desk light
with multiple bulbs controlled by a single switch illuminating the
desk ?

-Andreas



> Date: Fri, 11 May 2018 13:01:13 -0700
> From: Leonard Daly <Leonard.Daly at realism.com>
> To: x3d-public at web3d.org
> Subject: Re: [x3d-public] lights in switch nodes
> Message-ID: <721c5ff6-6e41-ebe2-9575-d55102fa6846 at realism.com>
> Content-Type: text/plain; charset="utf-8"; Format="flowed"
>
> Andreas,
>
> The spec text that only the selected child of a Switch is traversed. It
> doesn't explicitly state it, but I presume that means is rendered (or at
> least considered for rendering). All children of a Switch participate in
> event handling (sending and receiving, including state changes).
>
> At one time (~20 years ago), lighting was expensive and limited to 8
> lights. Light scoping was limited so the scene could be rendered. I have
> not really seen scoped lights in quite a while. I think it is possible,
> but you need to go to extra work to make it happen. Unfortunately, X3D
> (spec) has not kept pace with the rest of the graphics community on
> lighting, while many of the applications have.
>
> I would not consider it good practice to include lights as an indirect
> child because they can have an impact beyond the limit of the node.
>
>
> Leonard Daly
>
>
> Date: Fri, 11 May 2018 14:25:35 -0600
> From: GPU Group <gpugroup at gmail.com>
> To: X3D Graphics public mailing list <x3d-public at web3d.org>
> Subject: Re: [x3d-public] lights in switch nodes
> Message-ID:
>         <CAM2ogRdbMxisDHY6bkEL7BkpHbinjotykWOG0mgjknkeCkhtUw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I found Blender wraps DirectionalLight in a Transform when exporting X3D..
> In freewrl DirectionalLight applies to siblings and lower. So the blender
> light doesn't show. But I found that was handy for Inlining a blender
> scene, and applying the lights I wanted in the parent scene.
> http://dug9.users.sourceforge.net/web3d/sunpath/SunPath.x3d
> Also seens to work in X_ITE.
> http://dug9.users.sourceforge.net/web3d/sunpath/SunPath.html
> -Doug
>
> On Fri, May 11, 2018 at 2:01 PM, Leonard Daly <Leonard.Daly at realism.com>
> wrote:
>
>> Andreas,
>>
>> The spec text that only the selected child of a Switch is traversed. It
>> doesn't explicitly state it, but I presume that means is rendered (or at
>> least considered for rendering). All children of a Switch participate in
>> event handling (sending and receiving, including state changes).
>>
>> At one time (~20 years ago), lighting was expensive and limited to 8
>> lights. Light scoping was limited so the scene could be rendered. I have
>> not really seen scoped lights in quite a while. I think it is possible, but
>> you need to go to extra work to make it happen. Unfortunately, X3D (spec)
>> has not kept pace with the rest of the graphics community on lighting,
>> while many of the applications have.
>>
>> I would not consider it good practice to include lights as an indirect
>> child because they can have an impact beyond the limit of the node.
>>
>>
>> Leonard Daly
>>
>>
>>
>> Children of switch nodes still participate in all events; however the
>>
>> Since lights are child nodes, they can occur as children of switch nodes.
>>
>> Presumably that means that only light nodes which are traversed in the
>> switch are active and should be used for illumination. Others occuring
>> in the switch should be turned off. Is that the intended behaviour ?
>>
>> I am asking because switch is mostly used with Shape nodes, and x3dom
>> currently uses all lights whereever they occur.
>>
>> Thanks, Andreas
>>



More information about the x3d-public mailing list