aalavandhaann / blueprint-js

The Javascript es6 version of the original furnishup/blueprint3d. Need some royalty free low poly models for the inventory. Can someone help me with this?
MIT License
504 stars 158 forks source link

Adding movable lights to the scene #15

Closed CanKavaloglu closed 5 years ago

CanKavaloglu commented 5 years ago

Hi #OK,

I would like to be able to add some different kinds of lights to the scene but I want them to be movable so that I can save the light objects to the config file and load them again on a refresh.

For that end, do you think using the Item class to create the lights as movable objects in the scene or should I follow some other logic to achieve it ?

Cheers !

aalavandhaann commented 5 years ago

That's an interesting question. The item class has the mouse move functionality but free movement doesn't exist on the original code. Also is better to extend the item class at the same time. So my suggestion would be to implement free movement in the item class and then extend the item for light

CanKavaloglu commented 5 years ago

Yeah that is the idea that I was thinking. What I have in mind is something very similar to this I managed to create an Sphere Geometry (as an Item) then I added this created item to the point light. Therefore, whenever this item is moved, I will also move the parent (the point light) but the light is not getting trough the Sphere. The example that I shared above is the same and the light is getting out of the sphere, I also tried different kinds of metarials like Lambert or Phong for the Sphere object but no luck. Any ideas why I cannot get the light when I have this geometry as the child of the light ?

P.S: The light works when this sphere object is not attached to the light as a child.

Thanks in advance !

aalavandhaann commented 5 years ago

I would rather do the inverse. Keep the light as a child to the mesh. And the material shall be transparent for the mesh for the light to pass through. This way light emits and moves along with the mesh instead of repositioning Everytime the mesh is moved. For light to pass through see this post

CanKavaloglu commented 5 years ago

Hi #OK,

I have implemented the other way around as I mentioned and set the castShadow property of the item to false. This way I was able to get the light through the mesh (the sphere). However, I had to reposition the parent (the mesh) as you mentioned. For this reason, I have just implemented your way, adding the light as the child of the item. Also, I tried shadowMap properties of the renderer as you linked but no luck so far. Any ideas on why the light still fails ?

Thanks !

aalavandhaann commented 5 years ago

Can you point me to a visual link? This way it's easy for me to get a grasp of the issue clearly

aalavandhaann commented 5 years ago

Closing the issue as it has been lying undiscussed for a long time. Feel free to reopen if this discussion needs to be activated again.