Git Product home page Git Product logo

Comments (7)

mittpat avatar mittpat commented on May 26, 2024

I've implemented a workaround in my fork, which is ok for me but totally overkill in objective terms.
Basically, I first export to DAE using the built-in bpy DAE exporter, then using your exporter and then splice both xml together... I won't loose any sleep over it, but I might try to do something more efficient later in the week.

https://github.com/mittpat/DAEBlend/commit/305c1e5c8d9739255cb9a5311a7eed16db6e0a58

from daeblend.

gregdavisd avatar gregdavisd commented on May 26, 2024

A hard normal edge requires duplicating the position with a separate normal. In blender there is the auto smooth modifier which breaks edges based on a critical angle. I don't know if there is anything like 3ds max smoothing groups in blender. The exporter works with the vertex data it's given instead of generating geometry. I'll investigate when I get a chance later tonight if it's a configuration issue or see what's going on.

from daeblend.

gregdavisd avatar gregdavisd commented on May 26, 2024

Here's a test file with two cubes:

test file

soft and hard blender

Here's the exported DAE file rendered with FBX review

soft and hard review

The cubes appear with correct lighting from the DAE file.

To get a flat lighting the edges need to be split with the "split modifier" or "split edge" command. Here is a cube corner with a single smoothing normal:

smooth cube

And here's the cube corner showing flat shading normals from splitting edges:

flat cube

So it depends what you mean by a flat shaded cube. Using the "Shading: Smooth" button will have no effect on the export if all that button does in modify Blender's pixel shader without making changes to the geometry.

Regards,
Greg.

from daeblend.

mittpat avatar mittpat commented on May 26, 2024

Hi, thanks for the reply.

Yes custom split normals appear to work properly with DAEBlend,

However, using Blender 2.79 on Ubuntu, creating two cubes and smoothing one with the uvshading buttons with this visual result:
uvshading

Once exported with the builtin exporter:
two_cubes-builtin.dae

Once exported with DAEBlend:
two_cubes-DAEblend.dae

As you can see, all the DAEBlend normals, for both cubes are at 45 degrees (-0.5773 -0.5773 -0.5773)
While the builtin exporter (OpenCollada) has the smooth cube normals at (-0.5773 -0.5773 -0.5773) but the hard cube normals at (1 0 0).

blend file:
two_cubes.blend

Thanks for putting your exporter on the web, it'a great help with Collada 1.5.0,

Pat

from daeblend.

mittpat avatar mittpat commented on May 26, 2024

Also, this post on the web may give a hint:

https://blender.stackexchange.com/questions/71356/vertex-normals-different-from-loop-normals

Quote:

data.calc_tessface();
for f in data.tessfaces:  # indices
    polygon = data.polygons[f.index] #Load Polygon

    for vert in range(len(f.vertices)):
        norm = data.vertices[f.vertices[vert]].normal
        norm1 = data.loops[polygon.vertices[vert]].normal
        print(norm, norm1)

<Vector (-0.5773, 0.5773, -0.5773)> <Vector (-1.0000, 0.0000, 0.0000)>
<Vector (-0.5773, -0.5773, -0.5773)> <Vector (-1.0000, 0.0000, 0.0000)>
<Vector (-0.5773, -0.5773, 0.5773)> <Vector (-1.0000, 0.0000, 0.0000)>
...

from daeblend.

gregdavisd avatar gregdavisd commented on May 26, 2024

The autosmooth option wasn't working so I fixed that. For a cube mesh, turn on the autosmooth checkbox under data tab and set angle < 90 degrees. That will now export sharp edges based on the angle limit. This exporter doesn't use the 'calc_normals()' api call, that will have to be done manually using the menu 'normals->recalculate outside/inside'.

from daeblend.

mittpat avatar mittpat commented on May 26, 2024

It is now working as you describe.

Thanks!

from daeblend.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.