Jump to content

Flat Shading - please


Go to solution Solved by Deltakosh,

Recommended Posts

Hi there 

 

is there any chance for Flat shading  appear soon in babylon Blender exporter as it will improve a lot of possibilities, I know is there lot of other " more important" things to focus on but I believe that flat shading is very important to people who deal with graphic not just a scripring side.
 

  • Thank you.  
Link to post
Share on other sites

Your word is my command :)

I've just checked in the draft version of this new API:

    BABYLON.Mesh.prototype.convertToFlatShadedMesh = function() {        /// <summary>Update normals and vertices to get a flat shading rendering.</summary>        /// <summary>Warning: This may imply adding vertices to the mesh in order to get exactly 3 vertices per face</summary>

forum4.png

Link to post
Share on other sites

Awesome. Thank you.

 

Deltakosh, I read your changes and I'm wondering if the following lines insure you that the normal is not flipped:

var p1p2 = p1.subtract(p2);var p3p2 = p3.subtract(p2);var normal = BABYLON.Vector3.Normalize(BABYLON.Vector3.Cross(p1p2, p3p2));

What is the order of indices? Is it

 

- counter clockwise

 

       +1

 

+2        +3

 

or clockwise

 

       +1

 

+3         +2

 

?

 

Counter clockwise should give a normal from the screen to the viewer whereas clockwise should give a normal from the viewer to the screen (back face). So I suppose it's counter clockwise:

 

       +1

 

+2        +3

 

the normal should be the cross product (in this order) between p3p2 (from p2 to p3 if I keep the convention you use: p3.subtract(p2)) and p1p2 (or p2p1 and p3p1) but NOT p1p2 and p3p2.

Link to post
Share on other sites

it is in the Edit mode 

 

that what Blender doc say :

http://wiki.blender.org/index.php/Doc:2.6/Manual/Modeling/Meshes/Smoothing

 

I found this as well , that may help , from Objects to the X-Plane exporter , I don't know python but that how they fix it :

https://github.com/der-On/XPlane2Blender/commit/b04599f7f973f77931051b8dbc4442235cacfe99

 

That someway connected to threeJS:

http://stackoverflow.com/questions/21061100/three-js-r64-blender-json-export-miss-normals-for-smooth-shading

 

hope it could be made easy and soon ;)

 

Thank you.

Link to post
Share on other sites

What about flat / smooth shading for all object/mesh , to able export from blender for example 2 meshs one flat second smooth !? , then if someone need flat just split mesh in two or more and dedicate what is what . ? 

 

Sorry to make it such a fuss about it but for me as I believe for many who want present model in best as they can accuracy is very important.

 

Thank you very much for looking in to this matter.  

Link to post
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...
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...