Blender 6.0 exporter for Blender 2.80

blender
#1

The fully functional, reasonably tested, exporter for the new major release of Blender has been published. Right now, the exporter shows being Beta 6.

Located: Exporters/Blender at master · BabylonJS/Exporters · GitHub

When blender 2.80 goes into production, a minor update will occur to change the version to production & move Blender2Babylon-5.6.zip to the deprecated directory. The Blender 2.80 version is increasingly more production worthy by the day. Think you would be advised to start looking at it, since the learning curve for all the changes will take some time.

In addition to the changes below, some other topics got written which also highlight how things are now different:


Blender Exporter Version 6.0.0

24 January 2019

  • Supports Blender 2.80 redesign
  • Removed Internal render materials support
  • Relocated Game Engine render properties used
  • Moved all exporter level custom properties from scene tab to world tab
  • Changes to world tab:
    • Added properties from scene tab
    • Added Sky Box / Environment Textures section
    • Added Use PBR checkbox
  • Changes to mesh tab / proccesing:
    • Relocated Billboard Mode from Game Engine to here
    • Relocated most of material section to new panel in Materials tab
    • Remaining materials stuff now in ‘Baking Settings’ section. Added Force Baking checkbox to avoid multi-materials.
    • Blender’s mixed flat / smooth shading now supported, or custom split normals if used.
    • Custom properties Picking & Disabled are now using Outliner Icons instead.
    • Alpha now supported in vertex colors
  • Changes for lights tab / proccessing:
    • Added PBR intensity mode custom property. When Automatic or not PBR, intensity scaled 0-1 from Blender’s Energy, where 10 is 1. Otherwise Energy passed, unmodified.
    • Range property now supported using Blender property Radius
    • Hemi light type is no longer supported. To get a BJS hemi light use area type, & specify Size X for range.
  • Added new custom properties panel for Materials:
    • Relocated Back Face Culling checkbox from Game Engine to here
    • Relocated Check Ready Only Once checkbox from Mesh tab to here
    • Relocated Max Simultaneous Lights from Mesh tab to here
    • Relocated Name Space from Mesh tab to here (might be in TOB only, since JSON files cannot share materials)
  • Mesh baking can be reduced to only the texture channels required, keeping other image texture based channels (not for multi-material meshes)
  • Nodes based renders (Cycles & eevee) not always just baked. See chart for properties / textures & where values are from. Properties are only assigned when no texture input to socket.
STD Property / Tex PBR Property / Tex From Nodes-Socket
diffuseColor / diffuseTexture albedoColor / albedoTexture Diffuse BSDF - Color, Principled BSDF - Base Color
ambientColor / ambientTexture ambientColor / useAmbientOcclusionFromMetallicTextureRed Ambient Occlusion - Color
emissiveColor / emissiveTexture emissiveColor / emissiveTexture Emission - Color
specularColor / specularTexture reflectivityColor / reflectivityTexture Glossy BSDF - Color, Principled BSDF - Specular
specularPower (inverted & 0 - 128) roughness / useRoughnessFromMetallicTextureGreen Glossy BSDF - Roughness, Principled BSDF - Roughness
indexOfRefraction / refractionTexture indexOfRefraction / refractionTexture Refraction BSDF - IOR, Frensel - IOR, Principled BSDF - IOR / Refraction BSDF - Color, Principled BSDF - IOR
metallic / metallicTexture Principled - Specular
emissiveIntensity Emission - Strength
alpha / opacityTexture alpha / opacityTexture Diffuse BSDF - Color, Transparency BSDF - Color, Principled BSDF - Base Color
bumpTexture bumpTexture Normal Map - Color, Principled BSDF - Normal
  • Certain nodes are allowed, and are either ignored or just passed thru
    • Mix Shader, used mostly for non-principled trees
    • Separate RGB, for metallic textures wt roughness / AO
    • Frensel, when not PBR
  • glTF legacy nodes (glTF Metallic Roughness or glTF Specular Glossiness) produce an error saying to switch to standard Blender nodes or use glTF exporter
  • Texture / UV parameters are optional Nodes, when input to a texture node (ignored when must be baked, baking uses them though)
    • Mapping node for (translation to offset), (rotation to ang), (scale to scale)
    • Texture Coordinate & UVMap nodes for coordinatesIndex
  • When a material channel cannot really be represented by mapping, then it will be baked. Examples:
    • A Noise or other procedureal texture to Principled BSDF - Normal, then a bump texture will be baked
    • Any node which is not explicitly supported or ignored
14 Likes

Blender EEVEE / cycles testing
Trying to load a Bezier Curve in the BabylonJS viewer from a glTF file (from Blender)
#2

Congrats mate!!!

0 Likes

#3

Great, thanks a lot.

0 Likes

#4

Huge! Thanks @JCPalmer

0 Likes

#5

excellent !

0 Likes

#6

Ho sounds really great,
I need to test with the gltf export, if it’s now possible to bake shadows in blender for an already existing babylon scene and reexport them to babylon after.

0 Likes

#7

I do not know if baking shadows is possible. I can say dynamic shadows for mesh that move are supported by the exporter.

To do that, assign the casting & receiving custom properties to the appropriate meshes. This is on the mesh custom properties:

Then in the light custom properties, you have to set the shadow generator custom properties:

I do not really know a lot about how Blender generates shadows, but there is a new ESM shadow capability using the EEVEE engine:

Problem is that EEVEE does NOT support baking. When the exporter does have to bake materials (hopefully not often, though you can do some really cool stuff putting Magic Texture on the diffuse channel), it temporarily switches to the Cycles engine.

If there was a way to cast a shadow using Cycles (probably), you could bake the shadows into the materials yourself, or you can force the materials of a mesh which receive a shadow to be baked during export, using properties highlighted above in Blue.

I have not found dynamic shadows to be a real drain. I did one scene where at the end 94 dynamic shadows were use. The scene did not die, on a desktop, at least.

1 Like

#8

Hi JCPalmer,

maybe this tutorial can be a help to you


“When we have setup the useLightmapAsShadowmap property in our lightmapped materials,…”

1 Like

#9

Can I export Reflection probes with the Blender Exporter Version 6.0.0?

Or asked differently, how can I address a mesh (e.g.Suzanne) from a *.babylon file so I can create a reflection probe according to this scheme?

var probe = new BABYLON.ReflectionProbe(“main”, 512, scene);
probe.renderList.push(yellowSphere);
probe.renderList.push(greenSphere);
probe.renderList.push(blueSphere);
probe.renderList.push(mirror);

mainMaterial.reflectionTexture = probe.cubeTexture;

https://doc.babylonjs.com/how_to/how_to_use_reflection_probes

0 Likes

#10

A reflectionProbe can be inside a .babylon file, but unless there is some Blender object it can be associated with, it would have to be done completely with custom properties. So no, they are not exported.

ShadowGenerators are combined with a light with a few extra properties.

Once a mesh is imported, it is just like any other mesh. If you need to actually use a mesh as an argument to something, just query it by the name you gave it in Blender.

probe.renderList.push(scene.getMeshByName('blah-blah-blah'));

You can also use scene.getMeshByID(). Blender exporter always uses the same value for name & ID, but other exporters generate a unique symbol, UID.

0 Likes

#11

Many thanks for your answer JCPalmer.
I will try that.

I still have a small question.
I have a Mirror-Ground with shadow,

var helper = scene.createDefaultEnvironment({
enableGroundMirror: true,
groundmirroramount: 50,
groundMirrorFresnelWeight: 0.6,
groundShadowLevel: 0.6,
});

Offline it works perfectly, but online I don’t have a Mirror-Ground.

Do I have to add anything to the .htaccess (AddType…?)

Many greetings
Hans

0 Likes

#12

I do not know. Make a simple PG & posting to your own topic is what I would recommend, since this really has nothing to do with Blender. I rarely look at 3DS Max topics. The people who look here, may not know.

0 Likes

#13

Okay.

Many thanks for your answer.
Hans

0 Likes

#14

I hope having more time this month to be able to test your new exporter.

After quick exports, I’ve seen issue during export when dealing with cameras. Are they already supported?

About the future documentation, what do you think about renaming:

  • Blender page to Blender to .babylon (2.79 or older),
  • Blender to glTF page to Blender to .glTF (2.79 or older),
  • Blender Tips page could keep its name, and have some 2.79 & 2.8 sections inside,
  • creating a new page named Blender to .babylon (2.8 or earlier),
  • creating a new page named Blender to .gltf (2.8 or erlier) ?
0 Likes

#15

As far as keeping old docs, it is alright by me. Think you have a typo. Should probably 2.80 or later.

Yes, lights are exported. There are a number of changes highlighted by topic referenced at the top. Light exports vary by whether PBR or STD. Also, lights brought in by Append are not going to be right, especially former Hemi lights. Create a new Area light for a Hemi.

1 Like

#16

Hello,

I just tried to export a scene with a camera, a light and a bezier curve (I wanted to check if your exporter can export bezier curve); however it seems that the exporter is unhappy about the default camera.

See the error message below:

It seems that the attribute trackToBoundingCenter does not exist on the object Camera; maybe is it due to a recent change in Blender 2.8’s API?

EDIT: to delete the camera does solve the problem.

0 Likes

#17

@Nodragem,

The answer to the export of curves is no. I am not even aware of a BJS equivalent that is also serializable. Any such objects will get the followinf entry in the export log file:
WARNING: The following object (type - CURVE) is not currently exportable thus ignored: name here

On the error part, whoops. Another exporter which generates inline javascript instead of a JSON file has this as an option which is not available in the JSON exporter. Since I use the same .blend files to test both, the property was in all my .blends, even though it is ignored in the JSON exporter.

Will have a fix sometime today, basically a delete of one line & bumping the revision #.

0 Likes

#18

Thanks :smiley:

… that’s a shame concerning the curves. I am not sure what you mean by serializable, I am sorry. I think I will try to export the parameters of my bezier curves and re-create them in BabylonJS with Curve3 (Draw Curves - Babylon.js Documentation).

EDIT: I tried to convert the curve into a mesh in blender and then export the file. Unfortunately, my mesh does not get exported (the babylon file is empty, see attachment below) and I get warnings (see exporter log attached).

Babylon file:

Exporter log:

Screenshot of the blender file:

0 Likes

#19

I forgot that the math file had a BezierCurve.class. If you look there is no static parse method which FileLoader can call to get the values from the export file to an actual javascript object.

FYI, it would take a lot more than just adding a parse method, but when I see the lack of this, I know to stop. One of the strengths of the Javascript exporter is anything can be exported if it can be expressed as code from data available from the Blender side. However, I have no interest in adding this for now, and have not published it in quite a while.

As far as a curve converted to a mesh, the exporter does not actually export vertices. It exports faces, or groups of 3 vertices. When you convert the curve to a mesh, it creates some vertices, but no faces. Perhaps the “this is being ignored” message should say faces not vertices. Same problem with converting things like Hair particle systems. I have overcome this, but not without a lot of code on both sides. Not walking into this issue lightly again.

0 Likes

#20

In case that can be useful to others, here is my solution to export curves from Blender into a json file:


(I did not write the code to re-create the curves in BabylonJS yet, but it should be straighforward, hopefully :slight_smile: ).

3 Likes