Dams Posted August 12, 2016 Share Posted August 12, 2016 Hello guys, I am experiencing a weird behavior with Blender and Babylon on the color of my object. I created a simple Mesh in Blender: a plate with Subdivision Surface then I extruded one side and use Crease parameter on edge to get a nice roundish. When playing with it in Babylon.js, the rendering is really weird: color is not the same aspect on all the surface and on the bottom face as well. My code is pretty simple: BABYLON.SceneLoader.ImportMesh(…) pbr_material = new BABYLON.PBRMaterial("pbr_material", scene); pbr_material.microSurface = 0.96; pbr_material.albedoColor = new BABYLON.Color3(0.206, 0.94, 1); pbr_material.reflectivityColor = new BABYLON.Color3(0.05, 0.05, 0.05); pbr_material.cameraExposure = 0.66; pbr_material.cameraContrast = 1.66; Even in SandBox, my object looks not homogenous. I tried many many ways (change mesh/vertice in Blender, play with light, colors…) to understand this behavior unfortunately without success… Do you have any ideas to solve that? Thank you very much ! TestSubSurf02.babylon Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 13, 2016 Share Posted August 13, 2016 Hi @Dams, welcome to the BabylonJS forum. Sorry to hear you are having problems. It's probably inverted normals or something like that. Who knows what evil those darned Blender crease-benders... do. I noticed you said "plate" and not "plane". That's interesting in itself. A plate being somewhat like a box? *shrug* No matter. I published your .babylon file to my github nest, and kindly escorted it into our cool BabylonJS online playground. Take a look, if ya please: http://playground.babylonjs.com/#WMW8#1 Yep, it looks kind of strange. I'm not sure what's wrong, but I'll stare at it and think about it. Maybe others will jump-in and have some good ideas. I still suspect normals. Got a re- computeNormals choice in Blender? Maybe there's one here. Something is not normal about your normals. Talk more soon. Nabroski 1 Quote Link to comment Share on other sites More sharing options...
gryff Posted August 13, 2016 Share Posted August 13, 2016 18 hours ago, Dams said: I created a simple Mesh in Blender: a plate with Subdivision Surface then I extruded one side Hi @Dams : welcome to the forum.:) My experience is that with Blender and the "Extrude" functionality - always recalculate normals afterwards. cheers, gryff Wingnut 1 Quote Link to comment Share on other sites More sharing options...
Dams Posted August 14, 2016 Author Share Posted August 14, 2016 Hi @Wingnut and @gryff !! Thanks a lot for your replies ! I recalculated Normals under Blender (edit mode > A (to select all faces) > Recalculate ("Inside" checked and uncheked). But unfortunately, it does not change anything ! :-( I need you to give me some advice to solve this problem. Any other idea ? Thank you very much ! Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 14, 2016 Share Posted August 14, 2016 http://www.html5gamedevs.com/topic/24438-edit-material-of-importmesh-obj/ Quote Link to comment Share on other sites More sharing options...
JCPalmer Posted August 15, 2016 Share Posted August 15, 2016 If it were I, the tests I would do are: See if the Blender geometry looks "OK" without all this PBR post import stuff. Try your PBR code on a plane or cube created right from BJS. Divide an conquerer, should be in everyones toolkit. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted August 15, 2016 Share Posted August 15, 2016 Hi, @Dams i'll jump in with a quick note, the colour's you see on any object with curves/bends will vary slightly, due to lightning not being able to reach all areas with the same "strength" / intensity. and as others already mentioned it, also seemed like you had a slight issue with your normals in your pictures. I didn't quite understand what you were after, but using @Wingnut's PG as a base, this is what i got. Note that i reduced the light intensity slightly for better contrast between the edges & sides of the mesh, aswell as disabled backFaceCulling. Take a look at this PG: http://playground.babylonjs.com/#WMW8#4 Wingnut and gryff 2 Quote Link to comment Share on other sites More sharing options...
gryff Posted August 15, 2016 Share Posted August 15, 2016 2 hours ago, aWeirdo said: I didn't quite understand what you were after, but using @Wingnut's PG as a base, this is what i got. Note that i reduced the light intensity slightly for better contrast between the edges & sides of the mesh, aswell as disabled backFaceCulling. Nicely done @aWeirdo ! If disabling backFaceCulling is producing the correct results then it seems to me again that it is a problem with the normals. 21 hours ago, Dams said: I recalculated Normals under Blender (edit mode > A (to select all faces) > Recalculate ("Inside" checked and uncheked). But unfortunately, it does not change anything ! :-( I'm not sure what @Dams means by ""Inside" checked and uncheked" but I would Select all the faces ->Normals-> "Recalculate Normals Outside". Clicking on the "Inside" option just recalculates them on the inside, and it does not toggle them by clicking a second time cheers, gryff Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 15, 2016 Share Posted August 15, 2016 https://www.blender.org/manual/modeling/meshes/editing/normals.htmlhttps://www.reddit.com/r/blender/comments/1lkijw/shading_options_multitexture_vs_singletexture_vs/ Quote Link to comment Share on other sites More sharing options...
Dams Posted August 16, 2016 Author Share Posted August 16, 2016 Thanks to aWeirdo, the result is better but still weird with an object bigger... I need to investigate much more to solve this behavior. For the normals, I found the good way on Blender but still not expecting an acceptable result... I even tried to flip the top face to understand the way it works but nothing helps... On Blender, Normals seem OK for all faces :-( Maybe it comes from my object in Blender with the way I draw it... I will try other shapes. If you still have ideas, I will take it :-) Quote Link to comment Share on other sites More sharing options...
Dams Posted August 17, 2016 Author Share Posted August 17, 2016 I am back to you as unfortunately I am still in the mess :-( My Normals seem OK (see image enclosed) ; and I recalculated them under Blender and by code (as suggested by Pryme8) but the result is still not acceptable… (see image enclosed). I did several tests on Blender side and the behaviour occur when I create rounding (with Subdivision Surface). The problem is the same with PBR material and Standard one… aWeirdo, you found a quite nice equation on my first drawing. Are you able to do the same with this bigger drawing? I need you. It will be very nice! Maybe I should use another technique on Blender to do a rounding. If someone has any idea ? TestSubSurf04.babylon TestSubSurf04.blend Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 17, 2016 Share Posted August 17, 2016 Your not happy with the Phong angles? or the normals are still not coming into calculation? Im confused on whats really the problem now. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 18, 2016 Share Posted August 18, 2016 Hello i'm sorry i have no time to look at your files, but i think this is just a light reflection. When you see this white plane, this is the light hitting the surface from below. Quote Link to comment Share on other sites More sharing options...
Dams Posted August 18, 2016 Author Share Posted August 18, 2016 Unfortunately i tried to play with different lights and different orientation without success. Do you have any advice on lighting ? Thank you ! Quote Link to comment Share on other sites More sharing options...
gryff Posted August 18, 2016 Share Posted August 18, 2016 @Dams : I took a look at your .blend file and added a Hemi lamp directly above the "table" then rendered it in Blender - both the "Cycles" and "Blender" renderer see top part of image below. I exported the from Blender to a .babylon file and viewed that in the Babylon sandbox - lower part of image. To me a Hemi lamp emits light as shown in the attached pic with light coming from all directions : yet the ends of the table look like they are not receiving light in this manner - rather the light is coming straight down. And just so you know, I applied the Subsurf Modifier first and then checked the normals cheers, gryff Nabroski 1 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 19, 2016 Share Posted August 19, 2016 9 hours ago, Dams said: Unfortunately i tried to play with different lights and different orientation without success. Do you have any advice on lighting ? Thank you ! Hello long story short, you can give a picture depth by just adding shadows somewhere, this is art history. All of the provisos achievements have been also applied to the present. That you can draw a simple line on your screen, goes back to a crazy math formula in the 19th century if you want a crash course in lightning go on youtube an watch a tutorial how to set up a lighting for studio shooting. The digital emulation of reality is pretty accurate those days Best Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Dams Posted August 19, 2016 Author Share Posted August 19, 2016 Hi Gryff, Thanks a lot for your experimentation but i certainly missed something : - the model is fine under Blender (all surface look the same) - the model is NOT looking fine with Babylon.js even when using a Hemi light. And that is the problem ! And I am sorry but i still do not understand how to solve that... ? @Nabroski : i will Google lighting for studio shooting. Thanks. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 20, 2016 Share Posted August 20, 2016 It's your normals then. please send me a link to the model in question lets get this taken care of today. Quote Link to comment Share on other sites More sharing options...
Dams Posted August 20, 2016 Author Share Posted August 20, 2016 Hi. I posted my .blend file in my post of wednesday. Here it is: http://www.html5gamedevs.com/applications/core/interface/file/attachment.php?id=9077 It will be so nice if you are able to solve it !! :-) Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 20, 2016 Share Posted August 20, 2016 Once I finish my morning routine here I'll give it a look. Can you send me a link to the object you made the blend file with preferabley and obj. Quote Link to comment Share on other sites More sharing options...
Nabroski Posted August 20, 2016 Share Posted August 20, 2016 interessting, i just want to share some code, sorry, a bit offtopichttp://babylonjs-playground.com/#1AYM1C#4 or you just set up your lighting from two opposite directions Quote Link to comment Share on other sites More sharing options...
Dams Posted August 20, 2016 Author Share Posted August 20, 2016 Hi Pryme8, Please find files here : https://dl.dropboxusercontent.com/u/75748606/MyFiles.zip Thanks ! Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted August 20, 2016 Share Posted August 20, 2016 My girlfriend is telling me I stink so Im gonna go take a shower then Ill handle this after. Talk to you soon. Quote Link to comment Share on other sites More sharing options...
Dams Posted August 20, 2016 Author Share Posted August 20, 2016 OK :-) I will wait a little ;-) Quote Link to comment Share on other sites More sharing options...
Dams Posted August 20, 2016 Author Share Posted August 20, 2016 @Nabroski Interesting ! It may help me. Thanks ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.