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

original position lost? #23

Open
ua4192 opened this issue Feb 1, 2023 · 2 comments
Open

original position lost? #23

ua4192 opened this issue Feb 1, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@ua4192
Copy link

ua4192 commented Feb 1, 2023

Hi

I am using CloudCompare and Potree.exe in order to load multiple ply files into one LAS file and then convert it to potree format.

I have made a small modification on the fragment shader in order to be able to gpu pick the positions using vPosition that in the github files is only on the fragment shader and not in the vertex

basicallyI set in the vertexShader vPosition = position and gl_FragColor = vPosition on the fragmentShader.

I get the coordinates but they are displaced. I guess it is related to point organization?

The script I am using to convert files is this:

rem set OPENSSL_CONF=
set PATH=E:\AIRMOV3D\Sotfware\devel\CloudCompare_v2.12.alpha_bin_x64;E:\AIRMOV3D\Sotfware\Devel\PotreeConverter_2.0_windows_x64;%PATH%
rem echo *********************************************************************************
rem echo * start of ply2nxz.bat
rem echo * start of %0 %1 %2 %3 %4
rem echo *********************************************************************************
set cmdFolder=E:\AIRMOV3D\Code\Devel\cmd\
set inFolder=%1
set outFolder=%2
set format=%3
set format2=LAS
set base=%~n2
echo infile: %inFile%
echo outFolder: %outFolder%
echo base: %base%
echo format: %format%

echo "Step 1 --> convert to LAS"
rem call CloudCompare.exe -SILENT -O %inFolder%\%inFile% -AUTO_SAVE OFF -C_EXPORT_FMT %format2% -SAVE_CLOUDS FILE %outFolder%\%base%.%format%

rem SETLOCAL EnableDelayedExpansion
cd /D %inFolder%
set _filelist=
for /f "delims=|" %%f in ('dir /b "*.ply"') do (
	set "_filelist=!_filelist! -O %%f"
)
set _filelist=%_filelist:,,=%
echo %_filelist% > filelist.txt
call CloudCompare.exe -silent %_filelist% -LOG_FILE .\log.txt -AUTO_SAVE off -MERGE_CLOUDS -C_EXPORT_FMT %format2% -SAVE_CLOUDS FILE %outFolder%\A400M.%format%

cd /D %cmdFolder%


rem PotreeConverter.exe %outFolder%\%base%.%format% -o %outFolder% --overwrite --output-format %format%

echo "Step 2 --> convert to POTREE"
:wait
if not exist "%outFolder%\A400M.%format%" (
	echo "waiting..."
	timeout /t 1 /nobreak > nul
	goto wait
)

rem DIR "%outFolder%\%base%.%format%"
echo PotreeConverter.exe %outFolder%\A400M.%format% -o %outFolder% --overwrite -p myHomePage
call E:\AIRMOV3D\Sotfware\Devel\PotreeConverter_2.0_windows_x64\PotreeConverter.exe %outFolder%\A400M.%format% -o %outFolder% 

echo "End"

Is there any way to get the original coordinates when gpu picking?

Here the function I use to gpupick

function readMousePixels() {
					renderer.render( scene, camera)
					var fb = gl.createFramebuffer();
					renderer.setRenderTarget(null);
					if (mouseRenderTarget === undefined) {
						mouseRenderTarget = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { autoClear: true, minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat, type: THREE.FloatType } );
					}
					if (read === undefined) {
						read = new Float32Array(4);
					}
					
					renderer.setRenderTarget(mouseRenderTarget);
					renderer.render( scene, camera);
					renderer.setRenderTarget(null);
					renderer.readRenderTargetPixels( mouseRenderTarget, mouse.x, mouseRenderTarget.height - mouse.y, 1, 1, read );
					console.log("pick: ", read);
					renderer.setRenderTarget(null);
					
					
					if (read[0] + read[1] + read[2] + read[3] !== 0 && read[0] * read[1] * read[2] * read[3] !== 0) {
						console.log(read);
						controls.target.set(read[0]  , read[1], read[2] )
						controls.update();
					}
					
					renderer.render( scene, camera)
					return read;
				}

Best regards

@ua4192
Copy link
Author

ua4192 commented Feb 13, 2023

Hi.

Is there anybody who has faced this problem with potree?

I need to get the original coordinates when reading from pixels.

Best regards

@tentone
Copy link
Owner

tentone commented Feb 14, 2023

Hello

You want the original coordinates before any transformation correct?

What you can do is to raycast the scene and you will get both the position in world coordinates as well as the geometry data containing the raw point data.

Mind that after conversion point data might suffer some changes (rounding & quantization).

@tentone tentone added the help wanted Extra attention is needed label Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants