unitycoder / UnityPointCloudViewer

Point Cloud Viewer and Tools for Unity
https://assetstore.unity.com/packages/tools/utilities/point-cloud-viewer-and-tools-16019?aid=1101lGti
128 stars 15 forks source link

Placement of Point cloud in scene #127

Open bjornsyse opened 2 years ago

bjornsyse commented 2 years ago

Hi

It seems the rendering of my pointcloud is not honoring the transform values, and I can't control where in the scene it's renderered. Is this expected behaviour?

image

unitycoder commented 2 years ago

yes thats the default way (for v1/v2 (.bin, .ucpc) viewer there are shaders with offset variable to translate cloud, and in next version there is shader that enables transform follow (pos, rot, scale), but for v1/v2 formats.

V3 tiles format is bit different, as its tile based, cannot move points, unless update all tile culling positions also.. i can check if that gets complicated/slow.. ill reply here.

current "workaround" could be adding manual -offset to cloud during conversion.. but of course not very useful.

Rickmc3280 commented 2 years ago

another workaround could be a script that changes all of those variables in the tiles and the root file. Seems like it would be pretty easy since the root file contains the locations of all files yes?

Ex. NewOffset = xyz. `for(int i = 0; i < tile.count; i++) {

byte[] = file.readAllBytes(path); byte[pos+t] = x; byte[pos+t+sizeof] = y; byte[pos+t+sizeof] = z;
file.delete(path). file.OpenWrite(path). }` etc

unitycoder commented 2 years ago

yes, that would be possible (maybe faster than converting again, at least for large clouds).. but then again, iterating hundreds of files wouldnt be too fast either.. (at least if need to move transform many times)

so at that point, easier to add method that offsets loaded point data, re-inits cloud.

v3 data formats are described here, its just raw point data: https://github.com/unitycoder/UnityPointCloudViewer/wiki/Binary-File-Format-Structure#custom-v3-tiles-pcroot-and-pct-rgb

Rickmc3280 commented 2 years ago

Well If you ever make a binary version Can it look like this? xD It would make it very easy to manipulate the data if the files were in binary vs ascii. the conversion takes more time than its worth. Would be easier just to create a viewer for people who want to read the files. image

bjornsyse commented 2 years ago

Ah ok. I was not aware at all. It seems this makes it quite not so usefull at all for my purposes then. But you're saying there are offset values in the V2 version. Perhaps I'll go that route for now, then but I'd have to completely decimate my pointcloud in that case. Or perhaps re-convert LAS-file with offset values, that could possibly work aswell. Thanks for info! Hoping for the next version then.

bjornsyse commented 2 years ago

On a side note, is this something that could be of interest for this plugin?

https://docs.unity3d.com/Packages/com.unity.visualeffectgraph@12.0/manual/whats-new-12.html

image

unitycoder commented 2 years ago

if you send me an email, i can attach the v2 translation shader version for testing.

for v3 tiles: Is it enough to move it during Start() to match transform pos, or you'd like to move it dynamically during playing also?

VFX, noticed that feature but haven't tested yet.. i'll put it big higher on the test list, to see if its useful. (not sure how it would play with tiles version & culling system though. but for single cloud(s) should certainly work)

bjornsyse commented 2 years ago

Thanks! I sent you an email.

about the v3 tiles question, I really think for most cases Start() adjustment would be sufficient. At least for the use cases I imagine for my own projects.

unitycoder commented 8 months ago

made initial tests for this issue, works if manually loop & offset loaded points, but that would be slow.. so it needs custom shader that offsets points too.

this should work, so i expect it to come in the next update.

unitycoder commented 8 months ago

ok, it works for the basic v3 viewer, not packed version yet.. offset is applied on start and then possibly can be edited later from script too. image