gaussian-splatting icon indicating copy to clipboard operation
gaussian-splatting copied to clipboard

How to convert color in " .ply" file??

Open lms7127 opened this issue 2 years ago • 11 comments
trafficstars

I want to convert vertex color using the result " .ply" file.

In " .ply" file, I checked "property float f_dc_0~1", "property float f_rest_0~44". But this values are -1.~ to 1.~. I want to convert this value to nomal rgb or hs value like 0~255.

  1. How can I represent this f_dc, f_rest property to rgb or sh value(ex, 0~255 number)??
  2. Is there any good way to convert color in 3DGS??

lms7127 avatar Nov 21 '23 02:11 lms7127

value=(value+1)*128

jaco001 avatar Nov 21 '23 08:11 jaco001

Thank you for your reply : ) But under -1 (like, "-1.23") value can be minus. How can i control that value??

lms7127 avatar Nov 22 '23 05:11 lms7127

Parameters f_dc_0, f_dc_1, f_dc_2 contain your R, G and B colors, You need to convert them into regular format with something like R = 0.5 + C0 * f_dc_0 where C0 is the zeroth-order spherical harmonic coefficient. After that, you will obtain colors in the [0, 1] range and it is straightforward to map them to [0, 255] integers.

The rest of the spherical harmonics don't really make much sense without viewing directions (the rasterizer handles that for you OR you have to do raycasting and compute the view-dependent color by yourself), so I would go just with the base RGB color.

antonzub99 avatar Nov 23 '23 10:11 antonzub99

Thank you for your response!! I applied this method just now(0.5 + C0 * f_dc_0, I think C0 is 0.28209479177387814). Some of the values are under 0, but most values are pretty good:)

lms7127 avatar Nov 24 '23 01:11 lms7127

@lms7127 @antonzub99 can you please tell how we can compute the final view-dependent color and not just base RGB?

pknmax avatar Nov 29 '23 14:11 pknmax

f_dc_0(is red), f_dc_1(is green), f_dc_2(is blue) convert f_dc_0, 1, 2 to 0~255 using (0.5 + C0 * f_dc_0, I think C0 is 0.28209479177387814) maybe this is final view color

lms7127 avatar Dec 11 '23 05:12 lms7127

How is this? i'm reading negative values of the splats like f_dc_0 = -2.2223 from polycam

applying the formula: 0.5 + 0.28209479177387814 * -2.2223 = -0.126899255759089390522

this makes no sense to me.

TristanMorelle avatar Dec 23 '23 03:12 TristanMorelle

I notice that there are some parameters in the .ply file called 'f_rest_nums', do you know what these parameters do?

PlyProperty('f_rest_1', 'float'), PlyProperty('f_rest_2', 'float'), PlyProperty('f_rest_3', 'float')

sugerkiller avatar Feb 20 '24 11:02 sugerkiller

Is this formula applied on the ply output after training

i-nkrumah avatar Mar 28 '24 01:03 i-nkrumah

same question

Abigcan avatar Sep 09 '24 12:09 Abigcan

how do I do this conversion if I am using blender or touchdesigner

spand17 avatar Sep 16 '24 18:09 spand17