Jump to content

[Solved] Object color not like expected


mirco
 Share

Recommended Posts

Hi, i am new to BabylonJs. I have Imported a Mesh with BABYLON.SceneLoader.ImportMesh. Thats all works fine and super easy to learn.
But now I have a problem with the color of the imported Mesh. 
Its a tree and should be (surprise) green. But it is Black, and only the top of the tree has a little pice of green. 

As test I created some other objects around it and checked if the other objects get the expected color ( pink ). To avoid problems with light or something like that.

Maybe you have a short hint for me what I doing wrong.


http://www.babylonjs-playground.com/#16XKTO#27

 
Thanks for your help
Mirco
Link to comment
Share on other sites

Hi thank you for your first informations. Because I have problems with seeing colors it`s not so easy for me. 

Before I submitted this post I have tested the tree with the same material like the other objects. 

Here are a playground:

http://www.babylonjs-playground.com/#16XKTO#28

in this example it looks like it have the same problem. So maybe there are some more things I make wrong ? 

Attached I have a sample how it looks like in Blender. 

 

Mirco

Bildschirmfoto 2017-03-16 um 19.39.22.png

Link to comment
Share on other sites

@Deltakosh and @mirco: Nothing to do with Blender DK ;)  The camera and Directional Light are on opposite sides of the tree to each other.

The light is illuminating the tree mesh on the side away from the camera. The side closest to the camera  is essentially in shadow.

I moved the camera to the same side of the tree as the light - see attached image. The tree has green branches :)

cheers, gryff :)

light1.png

Link to comment
Share on other sites

Thanks for the support you give me, but maybe I am thinking in a wrong direction but I already looked from the other side on the object ( like the shadows fall ) by moving the camera around. 

But only the top of the tree has the "green" or "pink" color like I expect. 

I have updated the playground for faster review.

- override the green material with the pink one from the object near of it

- move the camera on the right position

- move the cane near the tree - thats what I expect to get - in the shape of a tree

http://www.babylonjs-playground.com/#16XKTO#30

 

 

 

Bildschirmfoto 2017-03-17 um 09.38.55.png

Edited by mirco
change the picture to the new playground demo
Link to comment
Share on other sites

I got it : smooth shading issue http://www.babylonjs-playground.com/#16XKTO#32

l. 62 object.convertToFlatShadedMesh()

If you want control of your smooth shading : on Blender, apply a smooth shading on your object (3DView > Tool shelf > Tools tab > Shading Smooth button). Then, apply an edge split modifier, and adjust it.

If you want to set flat shaded mesh directly from Blender, check "Use Flat Shading" on Mesh BJS panel.

Link to comment
Share on other sites

perfect, thats what I looking for :)

so there are two ways to get the result I "expected":

first export it correct in blender (see file attached)

or convert it in babylon with 

myMesh.convertToFlatShadedMesh();

 

Thank you all for your help 

Bildschirmfoto 2017-03-17 um 11.48.35.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...