Jump to content

Changes for Blender exporters


JCPalmer
 Share

Recommended Posts

I think I have enough to do a small update to the Blender exporters.  Am thinking about dropping a couple of kind of obsolete features.  Both of these are used in the very "involved" loop of reading a meshes geometry.  Pulling these out would simplify this area.  They are gone for sure in the source code generator, but input with regard to the JSON generator would be good.

  1. Remove the checking for, and splitting up of meshes with more than 64k vertices.  This seems like an option which is becoming irrelevant.  The code complexity involved actually spills into the caller too.
  2. Flat shading both for the mesh and the entire scene.  It seems this can be replaced with SplitEdges modifier.  This causes exports of fewer vertices.  It is documented.  Using as many features that Blender already has sounds advisable.

As far as new stuff:

  • Separate scene level control of # of decimals of scalable (positions)  & non-scalable(everything else) geometry.  Currently 4 decimals for all, but do you really need 4 decimals if your model is scaled in inches (micro-inches)?  Hundredths of inches are probably not even going to be visible with an extremely close camera. 9999 possibilities in each dimension for a normal seems like overkill.  My calculation blew out with 99993.  Default for each would still be 4.
  • ES3 / ES6 switch for source code generation.
  • Better checking for un-applied transforms when using an armature.

Thoughts?

 

Link to comment
Share on other sites

May I suggest an option to add? Be able to disable automatic baking!

  • on Blender Render: on huge scene, you just have to make a mistake and assign on the same materials two textures sharing the same influence, and you're ready to overflow your CPU and try to kill Blender process.
  • on Cycles: if no automatic baking, then how to "translate" the materials? I think this could be a great feature to using Cycles as a PBR exporter instead of Standard, and to "force" the user to use the Principled BSDF shader for that (in the same way of GLTF exporter, but by using directly the default Cycles shader)

It seems that for the Blender Render part this could be done without difficulties? But maybe my suggestion for Cycles lead to a huge code rewrite :ph34r:

Link to comment
Share on other sites

On precision, it is going to be even more flexible, not just positions & others.  The values will range from 1 to 5 (0 to 5 for positions).  As before, this is the max value, trailing 0's are removed.  In ToB, even leading 0's are removed (JSON does not allow this).  Here is UI for ToB (with defaults set).  JSON exporter will be similar.  This part is implemented & in debug.

tobScene.jpg.3601b61a047a08d74e7f70cf069a3647.jpg

As far as not baking, I will look into shutting off, and exporting without material.  You could then hand write any material on the BJS side.  Kind of doubt there will be time to add PBR via cycles.  I need to move on by next week.  If you post an example .blend & maybe what , I will at least load it.  I do not have 4 days just to study what to do.  I screen capture of Blender UI mapping to BJS values would definitely help as well.

Link to comment
Share on other sites

If you want, here a scene using Principled Cycles shader: https://github.com/Vinc3r/cornellBox/tree/master/3D (cornellBox-Cycles.blend)

I don't know if you have already play with nodes and python, as for me not too much but maybe this snippet can help you.

As for exporting without material I don't think this will be convienient. At least having a default PBRMaterial with default options but named as in the 3D scene could be a nice step :)

As for the expecting result, it can probably tend to this playground.

[edit] of course you need last version of Blender (2.79) to get Principled sharder

 

 

 

Edited by V!nc3r
Link to comment
Share on other sites

@JCPalmer & @V!nc3r - if you add this:

        write_string(file_handler, 'customType', 'BABYLON.PBRMaterial')

to this file (I put in between lines 325 & 326),  it exports all the materials as PBR albeit a basic ones (when using Blender Internal, not tried with Cycles).

This is a post more for my benefit than anyone else, but would be good to have a checkbox on the materials tab on Blender along the lines of 'Export as PBR (simple)'' so we can chose which are PBR and which not.

Link to comment
Share on other sites

On 3/2/2018 at 3:44 PM, babbleon said:

@JCPalmer & @V!nc3r - if you add this:


        write_string(file_handler, 'customType', 'BABYLON.PBRMaterial')

to this file (I put in between lines 325 & 326),  it exports all the materials as PBR albeit a basic ones (when using Blender Internal, not tried with Cycles).

This is a post more for my benefit than anyone else, but would be good to have a checkbox on the materials tab on Blender along the lines of 'Export as PBR (simple)'' so we can chose which are PBR and which not.

This solution is fine as a work around.  Think as a "supported" option, better to leave it as it is & let people add the line themselves.  I am not willing to do anymore work on the exporter until Blender 2.80 beta is out.  There is supposed to be a new render & lots of changes.  I also do not know what I'll do then, just that I am not going to waste my time now.

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