Sign in to follow this  
Bman84

Blender to babylonJS lighting issues

Recommended Posts

So, I am trying to make a room, lit up with some lights.

I use blender v2.77a on GNU/linux, blenderexporter 4.4.4 and I am testing the result in the babylonJS sandbox online.

l the walls have the same purple material, the floor has a gray material and the two boxes have a red solid material.
The light is a spot light, under a certain angle, and a larger size, the light values are otherwise unchanged from default.
You can see the the issue in the attached files, the babylonresult.jpg looks crazy compared to what blender "previews". The middle wall is lit on both sides, even though the light is on one side only, there are no shadows, the rightmost wall is not lit at all and the light on the floor seems constant, regardless of distance from source.

Can someone please point me into a direction where I can learn of my wrongdoings?


The .blend, .babylon and the log are also attached.

Thank you in advance!

Borut

babylonresult.jpg

belndermaterial.jpg

blendersolid.jpg

ctest.blend

ctest.babylon

ctest.log

Share this post


Link to post
Share on other sites

Sorry not a lot of time today.  Best guess looking the pictures (did not read the text), you have a normals / culling problem.  The inside of the cube is the backside.  If you are never going to see both the inside & outside of a mesh, flip your normals in Blender.

  • switch to edit mode
  • select all (A)
  • menu: Mesh->Normals->Flip Normals

If you do need to see both, turn off culling. 

gameRenderSettings.png

For entire manual, see

Share this post


Link to post
Share on other sites

Hi guys.  Welcome to the forum, @Bman84!  

http://www.babylonjs-playground.com/#2FNT2E#4

Tested our spotlight range settings (lines 47-50)... working fine for spotlight falloff.

Checking bottom of bman's .babylon file...


"lights":[{"name":"Spot","id":"Spot","type":2,"position":[-2.7973,3.4862,-5.8656],"direction":[0.433,-0.5,0.75],"angle":1.3963,"exponent":0.3,"intensity":1,"diffuse":[1,1,1],"specular":[0,0,0]}],
"shadowGenerators":[]
}

ShadowGenerator array is empty, and no mention of any "range" for that light.  So... yep... we got trouble... right here in River City.  :)  Bman, please look for reasons why Blender might not include those things... in its exports.  I'm sure JC and other pros on this subject... will comment more soon.  Again, welcome, Bman... and thanks for finding this issue... well done.  (Wingnut tries waving a magic wand to make it all better, but it has no affect.)  :o

Share this post


Link to post
Share on other sites

Hi Bman84, welcome to the forum:)

The reason there are no shadows is, as Wingy points out, you have not created a shadow generator and not set the properties of objects that cast and receive shadows . (See image below.)

1. Objects that cast/receive shadows - Select each object then in the object properties (little blue triangle) you will find the exporter (4.5 in my case) check the appropriate boxes (A in image below). Do that for all the objects that will be involved. So floor and wall objects will "receive shadows", middle wall/boxes will "cast shadows".

2. The Light - This is the cause of the shadows and you need to create a shadow map. Select the light then chose the type of shadow map from the drop down box in the exporter properties for the light.. (B in the image below)

Will look at it more later today.

cheers, gryff :)

shadows.png

Share this post


Link to post
Share on other sites
On 5/11/2016 at 8:06 PM, Wingnut said:

Hi guys.  Welcome to the forum, @Bman84!  

http://www.babylonjs-playground.com/#2FNT2E#4

Tested our spotlight range settings (lines 47-50)... working fine for spotlight falloff.

Checking bottom of bman's .babylon file...



"lights":[{"name":"Spot","id":"Spot","type":2,"position":[-2.7973,3.4862,-5.8656],"direction":[0.433,-0.5,0.75],"angle":1.3963,"exponent":0.3,"intensity":1,"diffuse":[1,1,1],"specular":[0,0,0]}],
"shadowGenerators":[]
}

ShadowGenerator array is empty, and no mention of any "range" for that light.  So... yep... we got trouble... right here in River City.  :)  Bman, please look for reasons why Blender might not include those things... in its exports.  I'm sure JC and other pros on this subject... will comment more soon.  Again, welcome, Bman... and thanks for finding this issue... well done.  (Wingnut tries waving a magic wand to make it all better, but it has no affect.)  :o

is it possible that we have a realistic light...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.