Jump to content

Lighting changes and Blender exporter.


gryff
 Share

Recommended Posts

On several threads DK has mentioned changes to the parameters that can be applied to lights - range and attenuation in particular.

 

I am using the latest version of the Blender babylon exporter (the one that addresses animation issues and file size here) but I am getting a very limited output for point light no matter how I tweak the lights properties in Blender:

{"name":"Point","id":"Point","type":0.0000,"position":[7.1701,1.6286,7.2894],"intensity":0.2400,"diffuse":[1.0000,1.0000,1.0000],"specular":[0.0000,0.0000,0.0000]}

Are changes to lighting properties reflected in the Blender exporter?

 

cheers, gryff :)

Link to comment
Share on other sites

Hmm. The images below show my settings and the result.

 

Image1: Shows an overhead view of a set of rooms (all one mesh) with a Point light in top right corner. The radius of the light is set to 2 metres that shows up in the Distance box. Falloff is set to Inverse Square just as in your image above. There is a dim Hemi providing some overall scence lighting- trying to create a spooky atmosphere, so I am varying the intensity value of the Point light. Here is the code for both the lights in the exported babylon file:

"lights":[{"name":"Point","id":"Point","type":0.0000,"position":[7.7560,1.6286,7.8753],"intensity":1.0000,"diffuse":[1.0000,1.0000,1.0000],"specular":[0.0000,0.0000,0.0000]},{"name":"hemi","id":"hemi","type":3.0000,"direction":[-0.0000,1.0000,-0.0000],"groundColor":[0.0000,0.0000,0.0000],"intensity":0.1000,"diffuse":[1.0000,1.0000,1.0000],"specular":[1.0000,1.0000,1.0000]}]

I have tried exporting using all the settings available in the "Falloff" dropdown box - get the same result as above in my babylon code. I figured it would just be a matter of getting the right settings - but my lack of success made me post this thread.

 

Image 2: The result I am getting - the point light is reaching as far as the other end of the rooms.

 

Maybe I should redownload the exporter and set it up in Blender again as there seems to be no mention of range/attenuation in the Point light code above.

 

Edit: I just noticed that it must be the new exporter as it saves a camera rotation not target like my original exporter did.

 

cheers, gryff :)

post-7026-0-89687600-1400011572.jpg

post-7026-0-76182700-1400012872.jpg

Link to comment
Share on other sites

This should work now

 

Well ...  in a limited way :(

 

I get this in the babylon file on export:

{"name":"Point","id":"Point","type":0.0000,"position":[7.7560,1.6286,7.8753],"range":2.000,"intensity":1.0000,"diffuse":[1.0000,1.0000,1.0000],"specular":[0.0000,0.0000,0.0000]}

So I now have a parameter/property called "range" in my babylon file.

 

I've posted three images below to show the results I'm getting with the same blender set of rooms I posted above. The camera is in the room at lower left looking at the bookcase near the cursor symbol (crosshair with red and white circle).

 

Image1: The point light is turned off -just a dim Hemi.

 

Image2: Point light on with dim Hemi - Range set to 2. The bookcase is 10+ units away from the light. Note the left wall, the bookcase and the books.

 

Image3: Point light on with dim Hemi - Range set to 20

 

I can subtract image2 from image1 - the result is a complete black image i.e. - there is no difference.

 

Why is the bookcase in image2 receiving light from the point light  - not to mention the books and the left wall?

 

I thought perhaps that as all the walls are a single mesh and that if part of the mesh was in the range then the whole mesh was affected, but the books and bookcase are two additional seperate meshes and are still affected at Range = 2.

 

I tried this with babylon 1.11.js and the beta babylon 1.12.js - same results.

 

So yes the exporter now gives a range parameter - but it seems to have no impact, unless I am totally missing something.

 

cheers, gryff :)

post-7026-0-54549000-1400048314.jpg

post-7026-0-57543400-1400048362.jpg

post-7026-0-14210600-1400048396.jpg

Link to comment
Share on other sites

After analysis I think this is normal :) The normal of your wall implies that the wall cannot receive light from your point light.

 

Hmm. If you look at the two images above (Range=2 and Range=20) the wall on the left side is receiving light, as are certain faces on the books and bookcase. Really don't understand what you are trying to say.

 

But I will use a simpler example. Try it  here:

 

Cubes and lights

 

The scene was built in Blender 2.69. It contains three standard cubes, a standard plane, and a standard cone. There are two lights - a dim Hemi and a Pointlight at position 30,30,30.

 

I used strictly standard Blender objects from the "Add" menu - no messing with geometry or normals.

 

The cone represents the X,Z position of the light (babylon axis) but the light is 30 units above it.

 

The three cubes are at these positions (babylon axis)

 

Green : 0,0,0

Red: -10,0,-10

Blue: -20,0,-20

 

The "range" of the Pointlight is set to 1.

 

So why is the blue Cube receiving light - it is way outside the " range" of the Pointlight - 70+ units from the light? In fact why do any of the objects in the scene receive light from the Pointlight.?

 

What exactly is this "range" parameter influencing?

 

The zip file for this demo is here: cubes.zip. So anyone can try it and experiment.

 

cheers, gryff :)

Link to comment
Share on other sites

In your first example I was talking about the fact that back faces of the wall cannot receive lighting from your light

 

Ahh OK - I expected that as the normals are pointing a different way. I had assumed that by limiting the "range" I could stop light reaching the left inside wall as well. I assumed that "range" meant that light could reach only objects/faces inside that range - an easy exclude meshes for a scene created in blender with many objects.

 

Sorry if this is taking up a lot of your time.

 

cheers, gryff :)

Link to comment
Share on other sites

Okay it looks fine now.

 

I had babylon.1.12-beta.js  dated 10/5/2014 on my local webserver :angry:

 

Works like a charm with the 13/05/2014 version. See attached images range =2.

 

TY DK - you have made my day. Apologies for any grief I may have caused.

 

cheers, gryff :)

post-7026-0-62976100-1400191325.jpg

post-7026-0-12217600-1400191344.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...