keijiro / Pcx

Point cloud importer & renderer for Unity
The Unlicense
1.35k stars 196 forks source link

Ply norm consideration #27

Open shayazar opened 5 years ago

shayazar commented 5 years ago

I noticed that while parsing the PLY meta data, the norm is not taken into consideration explicitly (only through a generic Data32 type). Later, after parsing the data, only the vertices and colors (rgba) are moved on to the shader.

I have a PLY with norm i need to take into consideration. How do i implement using it in the shader? (point/disk)

Thanks

keijiro commented 5 years ago

I have never seen a point cloud that has normals. How did you create it?

shayazar commented 5 years ago

Meshlab produced it for me, and i don't want to ignore / disregard them. I saw some mentions on Unity forums and such about it as well.

keijiro commented 5 years ago

Could you provide a .ply point cloud data file with normals?

shayazar commented 5 years ago

Sure, I imported an example PLY from your project, and exported it through meshlab Guanyin2.zip

Because it was created from a PLY without normals originally, the normals don't add information, but taking a PLY with normal information and disregarding it affects the lighting from different camera angles and different lightings.

keijiro commented 5 years ago

I realized that it needs some changes in the basic design of the importer. It requires some amount of time to support it.

I'd like to add this to the to-do list of the project. Unfortunately, I can't afford time for it at the moment. I'll revisit it when I get free time.

shayazar commented 5 years ago

Sure, I get it. Any chance you can give a brief explanation about how to use the norms in the shader? Maybe this can help me proceed, and perhaps contribute.

keijiro commented 5 years ago

Add float3 normal : NORMAL; to Attributes.

https://github.com/keijiro/Pcx/blob/master/Assets/Pcx/Runtime/Shaders/Point.shader#L30

Then you can use the normal in the vertex shader.

shayazar commented 5 years ago

Thanks The trouble I had was the math of how to use the values of the normals :)

djzielin commented 5 years ago

I have PLY with normals as well. Perhaps I could help get this working?

cpkcpkcpk commented 3 years ago

I would also love to use ply normals in the VFX graph, in the same way you would with a pcache file

gradeeterna commented 1 year ago

It would be great to use normals from the .ply file to set the particle direction in VFX graph. Would this require generating a normals texture, in addition to colour and position maps?