Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLYLoader: BufferGeometry and Blender style #9796

Merged
merged 1 commit into from Sep 29, 2016
Merged

PLYLoader: BufferGeometry and Blender style #9796

merged 1 commit into from Sep 29, 2016

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Sep 28, 2016

I've used this version of PLYLoader in my last project. Features:

  • It creates an indexed BufferGeometry instead of Geometry
  • It can import geometries with vertices, vertex normals, vertex uvs, vertex colors and faces. The expected file format conforms to the Blender PLY implementation. So a simple plane geometry looks like this:
ply
format ascii 1.0
comment Created by Blender 2.74 (sub 0) - www.blender.org, source file: 'threejs_PLY_test.blend'
element vertex 4
property float x
property float y
property float z
property float nx
property float ny
property float nz
property float s
property float t
property uchar red
property uchar green
property uchar blue
element face 1
property list uchar uint vertex_indices
end_header
-4.281084 -4.281084 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 90 70 255
4.281084 -4.281084 0.000000 0.000000 0.000000 1.000000 1.000000 0.000000 90 70 255
4.281084 4.281084 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000 90 70 255
-4.281084 4.281084 0.000000 0.000000 0.000000 1.000000 0.000000 1.000000 90 70 255
4 0 1 2 3

@mrdoob
Copy link
Owner

mrdoob commented Sep 29, 2016

Sweeeet! 😀

@mrdoob mrdoob merged commit 99ae5a1 into mrdoob:dev Sep 29, 2016
@mrdoob
Copy link
Owner

mrdoob commented Sep 29, 2016

Thanks!

@makc
Copy link
Contributor

makc commented Sep 30, 2016

It's very tricky to convert a geometry with face UVs in an indexed geometry object.

wait, what?

@mrdoob
Copy link
Owner

mrdoob commented Sep 30, 2016

It's very tricky to convert a geometry with face UVs in an indexed geometry object.

How about we produce non-indexed geometry instead?

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Sep 30, 2016

Because BufferGeometry.computeVertexNormals() provides better results with an indexed geometry, I always try to create this type of geometry if possible.

Many PLY files just contain vertices and faces. Users will benefit from better normal data via computeVertexNormals if PLYLoader produces an indexed geometry.

@makc
Copy link
Contributor

makc commented Sep 30, 2016

ok, I did not check r80+ but r79 has classic Geometry that can be converted to BufferGeometry, and classic Geometry is indexed and has UVs. where did the code go that does this black magic? removed from 3js entirely?

@mrdoob
Copy link
Owner

mrdoob commented Sep 30, 2016

@makc we're trying to move everything to BufferGeometry so stuff loads faster and uses less memory. Unfortunately we have to lose some things while we transition.

aardgoose pushed a commit to aardgoose/three.js that referenced this pull request Oct 7, 2016
@WestLangley WestLangley mentioned this pull request Aug 28, 2018
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants