Jump to content

Difference between Blender and Babylon renders


Zino54220
 Share

Recommended Posts

Hi gentlemen!

 

I have a big problem and I can't resolve it alone...

 

I created a scene in Blender v2.71 and I have this render :

 

post-6162-0-70220400-1413040988_thumb.gi

 

 

But unfortunately, I have this render in my browser with Babylon 1.12, 1.13 and 1.14-beta.js :

 

 post-6162-0-57122200-1413041149_thumb.gi

 

 

I think I forgot a parameter or anything before export...

 

I need help  :(

 

Thanks.

 

Zino

Link to comment
Share on other sites

Zino, It looks like you may have issues with the normals.in your Blender file.

 

Try this:

 

1. Select an object

2. Then go into Edit Mode ->Select All Vertices (tap the A key until all verts are selected)

3. Now, still in Edit Mode, go to Mesh-> Normals->Recalculate Outside.

 

Repeat steps 2 and 3 for each object in the scene.

 

Hope that helps.

 

cheers, gryff :)

Link to comment
Share on other sites

Thank you for your answer Gryff.

 

I made your corrections but it's the same result... 

 

I tried to apply "Mesh" -> "Normal" -> "Recalculate Inside" and "Flip Normals" to see differents... but always the same result.

 

Maybe there is a thing link to the texture ???

 

 

Zino

 

PS :

 

Thanks you for your comment Joshcamas, but if I don't resolve this problem, my projet will go to the trash... :(

Link to comment
Share on other sites

Zino, I have taken a look at your.blend file. And there is one issue I can see and one possible issue.(See pic below)

 

Possible Issue

The image below is just the "GradinA.001" object viewed in Edit Mode. I have labelled some faces with an "N". These faces are NGONS - I have no idea how the BJS exporter handles such faces.

 

One Issue.

The "GradinA.001" object has 3 materials - MaterialGradin, MaterialGradinVitre (coloured blue in the image) and MaterialGradinArmatureVitre (coloured red in the image)

 

The materials MaterialGradinVitre and MaterialGradinArmatureVitre  are applied to surfaces that are flat - they do not have "depth" - like a plane but not a box.

 

MaterialGradin has a mixture - some box-like surfaces and some plane-like surfaces. I have coloured the plane-like surfaces green.

 

For plane-like surfaces BJS defaults to drawing one side only which is happening with your model. This default behaviour can be changed for example by changing the "backFaceCulling" parameter for materials like MaterialGradinVitre to false - either using a script or by opening the .babylon file, finding your material and changing "backFaceCulling":true to "backFaceCulling":false .

 

That is where I am so far. I will try an experiment later today to investigate NGONS.

 

cheers, gryff :)

 

post-7026-0-36321900-1413135790.jpg

Link to comment
Share on other sites

@Gryff: Is it possible to specify backFaceCulling per material inside Blender?

 

Not that I know of DK. I tend to stay away from geometry/meshes that are not closed  But I will explore a little more.

 

Also added a comment about the "Backface Culling in the Blender shading panel on the other thread

 

cheers, gryff :)

Link to comment
Share on other sites

Ok Zino - I did a little experiment with one of the stands - removed all other objects.

 

I created new objects from the parts I had previously identified as being problem surfaces because of backFaceCulling. - the red, green and blue areas in the picture above.

 

I adjusted the position of the stand so it was at the centre of the scene. Added  a camera and a hemi light.

 

Exported the scene to babylon. Opened the babylon file and set backFaceCulling to false for the red, green and blue materials.

 

Here is the result: A Stand

 

I missed a few surfaces that are in the concrete area - but they are fixable. The red, green and blue materials - are now showing both sides. And the areas that are NGONS are fine in the exporter.

 

So it is fixable.

 

cheers, gryff :)

Link to comment
Share on other sites

On NGONS: FYI, There is a line in the exporter right before the recording of vertices starts:

Mesh.mesh_triangulate(mesh)

This was in there before I did anything, though for TOB the call is slightly different.  mesh_triangulate is:

    @staticmethod    def mesh_triangulate(mesh):        try:            import bmesh            bm = bmesh.new()            bm.from_mesh(mesh)            bmesh.ops.triangulate(bm, faces = bm.faces)            bm.to_mesh(mesh)            mesh.calc_tessface()            bm.free()        except:            pass

This I believe this turns everything into triangles.  For .blends defined with all triangles, there is nothing to do.  Does not answer the questions, just filling in background as to why I think that part works.

Link to comment
Share on other sites

@Gryff: Is it possible to specify backFaceCulling per material inside Blender?

Yes, I did it with the multi_group.blend, in the Blender-test directory.  When the drop down at the top says "Blender Game", not Blender Render" you select the mesh with multi materials.  In the Material Properties, there is now a sub-division called "Game Settings".  There is a check box for culling.  Click a material, check it.  Switch materials & it is un-checked.  Change back and it is checked.

 

I do not know what I am doing when I run Blender, but sometimes I guess that just does not matter.

Link to comment
Share on other sites

To me the difference seems to be a lack of lighting (though the dithered greyscale adds to the uncertainty of what I'm looking at)

I notice you have no lights as direct children of the scene, and wonder if that might be part of the export issue?

Link to comment
Share on other sites

This I believe this turns everything into triangles.

 

Jeff, I figured that as the piece I used from Zino's file with NGONS worked - but of course had no idea how ;-)

 

I do not know what I am doing when I run Blender, but sometimes I guess that just does not matter.

 

Blender has so many "nooks and crannies" - you never know what you can find ... or where. :o

 

I've never experimented with the games engine and only since 2.71 with the cycles renderer (as now it is possible to bake out materials created with it to a texture).

 

Each day I learn something more about Blender. - and with each new feature added with each new version - the learning process does not stop ;)

 

cheers gryff :)

Link to comment
Share on other sites

chg : 

 

I use 8 spots lights parenting to an object above the arena in center of the scene so I don't think the problem comes from that...

 

Initially, I used an area lamp in more but when I exported the scene, I had an error on the area lamp : "not attribute use sphere" or anything like this, so I deleted it to make my export...

 

I will try tonight to add an hemi or an area lamp without link it to a mesh to see differences... 

 

 

Zino.

Link to comment
Share on other sites

A little point...

 

Althought I tried many parameters in Blender with the advices of Gryff, I always found the same result... I simply remade a scene and, element by element, I checked the export in the browser to get that I want.

 

I add an hemi lamp and I have this render  :

 

post-6162-0-94782400-1413231947_thumb.gi

 

 

So, chek often your result in the browser gentlemen!   :)  

 

 

I take this opportunity to report an error in Blender with the exporter and a area lamp.

 

post-6162-0-64211200-1413231696.png

 

 

Maybe because I forgot a parameter or anything...

 

Zino

Link to comment
Share on other sites

Tricky question.  Tower of Babel no-longer exists, at least in name, in the main Babylon repository.  The only exporter there now, updated late Sunday night even for New York time, is a version of Tower of Babel, with only the .babylon & .log file outputs.  The only change to the content is that this version does not output shape keys.

 

Unfortunately, there are multiple ways we could both be "right".  First, the version Blender uses seems to be the one present when Blender is launched.  The second is how you installed it.  Before  2.71, you could either just put the file into the addons directory, then go to file->User Preferences Addons tab & enable it.  This method did not work in 2.71 without throwing in some other directory as well.

 

The other way is to go to file->User Preferences, and click the "Install from file..." button at the bottom.  If it is a replacement, you still need to stop / start Blender for it to use it, but it is the only file you need.  If you have done it the copy file way, then delete it.  This way puts it somewhere in your home directory tree.  If you leave it, then when you go to Addons tab, you will see a warning about a conflict, and I think unpredictable results.  Deleting the addons dir version makes it go away.

 

The syntax of the function export_...(), in your error message & lack of log file means regardless of what you did, the older code was run.  So yes, use what is there now, installed using the button.

Link to comment
Share on other sites

  • 2 months later...

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