Jump to content

Lightning not working on lowered terrain for blender scene


usoban
 Share

Recommended Posts

Hello

I've modeled a simple terrain in Blender:

- ground is a mesh which has been "lowered" in certain areas with Proportional editing tool
- water is a simple plane

I also have a "sun" light placed in the scene in Blender. I've checked "check collisions" and "freeze world matrix" in the Babylon properties for both ground and water.

Now in Blender, all is good. But when I load the scene in BJS, I get the result attached in image (lowered ground areas get no lightning apparently).

Can anybody point me towards the problem? Don't know whether its connected to lightning in BJS or is it Blender related.
Thanks.

lightning.png

Link to comment
Share on other sites

@usoban Welcome to the forum :)

Iit is hard to say where the problem lies from your pictures. Below is a simple scene I created, exported from Blender and viewed in the sandbox.

I created it using the description you give - it seems fine (no ugly black areas).

Only difference is I had no texture for the water - so it is just a simple "blue" material.

When replying to people having problems with Blender export, I always suggest though that they post the .blend file.

Much easier to figure out issues.

cheers, gryff

terrain1.png

Link to comment
Share on other sites

@gryff thank you for checking out!

I was able to get better result with hemispheric light.  I've also tried with directional light in BJS, but got the same result as with "Sun" light in Blender (I guess the exporter converts "Sun" light into directional light anyway).

So for now I've sticked with hemi light, however I still get a little bit darker areas in the lower parts of the terrain (which does not happen in your example image).

Why would hemi and directional light produce such a different result?

I've attached the Blender file and both textures in the attachment below if you find the time to check it out.

Thanks!

map_w_bridge.blend

sand.jpg

water.jpg

Link to comment
Share on other sites

When you share a .blend, pack your textures (file > external data > pack).

Also, don't forget to apply transform on meshes (3dview > object > apply > scale is the most important).

Are you under Cycles when you export ? 'cause it looks like you have a baked texture on your ground on your BJS scene, with dark areas due to precalculated lighting.

When I export directly from your .blend, no issue.

Link to comment
Share on other sites

@usoban TY for your .blend file :)

The first image below is a close up of part of your "river" in the Solid and Edit mode with "Face Select" activated (*the faces have black dots where the normals are).

I have coloured some of the quads red, green and blue. Notice the red and green quads have no black dots and that some of the quads around them are darker grey.

This suggests problems with the normals. A closer look at these red, green and blue quads indicate that they are "bent" - no longer flat - and the green ones are stretched.

I noticed that you used "Proportional Editing" to produce the "river" - you might want to try "Sculpting" the river bed instead - which is what I actually did - as described below:

 

Step 1. Create a plane mesh and subdivide it - I ended up with ~ 3000 quads.

Step 2. Go into "Sculpt" mode and use the settings in the second image below. Star with the "Draw" brush (A) , Use Subtract (B), turn off any "Symmetry Lock" (C). and "Lock" the X and Y coordinates of the mesh (D). This last step will prevent quad "stretching" which is seen in your method.

Step 3. Export your mesh and see what it looks like.

If there are all those ugly black patches - go back into "Sculpt", Switch to the "Smooth" brush and apply it to areas which should not be black. Re-export and check your mesh again.

If this does not fix the issue - try triangulating the quads and re-export.

And as a final step you might have to flip the way some quads have been triangulated.

 

Now about black areas you should expect to see with a Directional Light. The third image below which uses the above Sculpt methods, your textures, and a single Directional Light at the top right corner of the scene. 

I have included a simple sphere(A) to show the impact of that light. Note the side of the sphere closest to the light is illuminated - the other side is dark. With the terrain, the mesh faces pointing towards the light are illuminated (B), while those faces not facing directly towards the light are dark (C). You should expect some of this type of "shadowing" with this type of light. If you add a Hemispherical light you can reduce the impact - a photographer's "Fill" light 

Hope this helps. I was going to post this last Thursday - but The forum had a DDoS attack and then moved to a new server.

cheers, gryff :)

 

 

 

aterrain1.png

sculpt1.png

sculpt2.png

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...