AWS Thinkbox Discussion Forums

Gamma Settings

Are gamma settings considered when Frost is converting a .xyz file to .prt?

No, Frost simply copies the colour. Were you hoping for something else?

Still having the same issues as i’ve had before as far as the colours being displayed by frost after the conversion. Our scanner data comes out with six columns, position coordinates and then rgb values…but when its converted to .prt it doesn’t look like it should unless i run my script on the .xyz file first to convert the rgb to float values. This works well…on small files…but for large ones it typically crashes because of a memory leak…so i’ve been told.

Here is an example my script:

(
	theOrigFilename = @"C:\test.xyz"
	theNewFilename = @"C:\converted_test.xyz"
	theOrigFile = openFile theOrigFilename
	theNewFile = createFile theNewFilename
	
	while not eof theOrigFile do
	(
		theText = ""
		for i = 1 to 6 do
		(
			theVal = readvalue theOrigFile
			if i > 3 do theVal = theVal/255.0
			theText += theVal as string + " "
		)
		format "%\n"theText to:theNewFile
	)
	close theOrigFile
	close theNewFile
)

Someone was kind enough to improve upon my script, but theirs is crashing on large files as well. Here is theirs:

global CloudsAssembly
fn CreateCloudsAssembly forceRecompile:on =
(
	if forceRecompile or not iskindof ::CloudsAssembly dotnetobject or (::CloudsAssembly.GetType()).name != "Assembly" do
	(

source = ""
source += "using System;\n"
source += "using System.Text;\n"
source += "using System.IO;\n"
source += "public class Clouds\n"
source += "{\n"
source += "	public delegate void ProgressHandler(object sender, ProgressEventArgs e);\n"
source += "	public event ProgressHandler ProgressChanged;\n"
source += "	private bool _reportProgress = false;\n"
source += "	public bool ReportProgress \n"
source += "	{\n"
source += "		get { return _reportProgress; }\n"
source += "		set { _reportProgress = value; } \n"
source += "	}\n"
source += "	private int _reportRate = 1;\n"
source += "	public int ReportRate \n"
source += "	{\n"
source += "		get { return _reportRate;  } \n"
source += "		set { _reportRate = value; } \n"
source += "	}\n"
source += "	private void onUpdateProgress(string file, float progress, int size)\n"
source += "	{\n"
source += "		if (ProgressChanged == null) return;\n"
source += "		ProgressEventArgs args = new ProgressEventArgs(file, progress, size);\n"
source += "		ProgressChanged(this, args);\n"
source += "	}\n"
source += "	public int MakeTestCloud(string sourceFile, string line, int count)\n"
source += "	{\n"
source += "		string[] data = new string[count];\n"
source += "		for (int k = 0; k < count; k++) data[k] = line;\n"
source += "		File.WriteAllLines(sourceFile, data); \n"
source += "		return count;\n"
source += "	}\n"
source += "	public int ConvertCloud(string sourceFile, string targetFile)\n"
source += "	{\n"
source += "		string[] data = File.ReadAllLines(targetFile);\n"
source += "		if (data != null)\n"
source += "		{\n"
source += "			char[] sp = new char[] { ' ' };\n"
source += "			string fmt = \"F3\";\n"
source += "			for (int k = 0; k < data.Length; k++)\n"
source += "			{\n"
source += "				string[] str = data[k].Split(sp, StringSplitOptions.RemoveEmptyEntries);\n"
source += "				if (str.Length == 6)\n"
source += "				{\n"
source += "					str[3] = (Single.Parse(str[3]) / 255f).ToString(fmt);\n"
source += "					str[4] = (Single.Parse(str[4]) / 255f).ToString(fmt);\n"
source += "					str[5] = (Single.Parse(str[5]) / 255f).ToString(fmt);\n"
source += "					data[k] = String.Join(\" \", str);\n"
source += "				}\n"
source += "				if ((ReportProgress) && ((k+1) % ReportRate == 0))\n"
source += "				{\n"
source += "					onUpdateProgress(targetFile, 100f * (k+1) / data.Length, data.Length);\n"
source += "				}\n"
source += "			}\n"
source += "			File.WriteAllLines(sourceFile, data);\n"
source += "			if (ReportProgress) onUpdateProgress(targetFile, 100f, data.Length);\n"
source += "			return data.Length;\n"
source += "		}\n"
source += "		else return -1;\n"
source += "	}\n"
source += "	public class ProgressEventArgs : EventArgs\n"
source += "	{\n"
source += "		private string _file;\n"
source += "		public string File\n"
source += "		{\n"
source += "			get { return _file; }\n"
source += "			private set { _file = value; }\n"
source += "		}\n"
source += "		private float _progress;\n"
source += "		public float Progress\n"
source += "		{\n"
source += "			get { return _progress; }\n"
source += "			private set { _progress = value; }\n"
source += "		}\n"
source += "		private int _size;\n"
source += "		public int Size\n"
source += "		{\n"
source += "			get { return _size; }\n"
source += "			private set { _size = value; }\n"
source += "		}\n"
source += "		public ProgressEventArgs(string file, float progress, int size)\n"
source += "		{\n"
source += "			File = file;\n"
source += "			Progress = progress;\n"
source += "			Size = size;\n"
source += "		}\n"
source += "	}\n"
source += "}\n"

		csharpProvider = dotnetobject "Microsoft.CSharp.CSharpCodeProvider"
		compilerParams = dotnetobject "System.CodeDom.Compiler.CompilerParameters"

		compilerParams.ReferencedAssemblies.AddRange #("System.dll")

		compilerParams.GenerateInMemory = on
		compilerResults = csharpProvider.CompileAssemblyFromSource compilerParams #(source)
		
		if (compilerResults.Errors.Count > 0 ) then
		(
			errs = stringstream ""
			for i = 0 to (compilerResults.Errors.Count-1) do
			(
				err = compilerResults.Errors.Item[i]
				format "Error:% Line:% Column:% %\n" err.ErrorNumber err.Line err.Column err.ErrorText to:errs 
			)
			MessageBox (errs as string) title: "Errors encountered while compiling C# code"
			format "%\n" errs
			undefined
		)
		else
		(
			assembly = compilerResults.CompiledAssembly
		)
	)
)
CloudsAssembly = CreateCloudsAssembly()

(
	Clouds = CloudsAssembly.CreateInstance "Clouds"
	Clouds.ReportProgress = on
	Clouds.ReportRate = 1000
	
	fn updateProgress s e =
	(
		format "% %\n" e.Progress e.Size e.File
	)
	dotnet.removeAllEventHandlers Clouds
	dotnet.addEventHandler Clouds "ProgressChanged" updateProgress

	--Clouds.MakeTestCloud @"c:\temp\cloud.txt" "0 0 0 -20 100 255" 100000  --this created a test file for them to work with.
	
	Clouds.ConvertCloud @"c:\Temp\ColourTestForDwayne_cc.txt" @"c:\Temp\ColourTestForDwayne.txt"  --replace the file to be converted and rename the file that it is writing out to.
)

I’ve sent along examples about this before…just wasn’t sure if had been addressed. Let me know if you want me to post them here so you can see…or i can email some screen caps.

Here are two screen caps that may help.

Before

After

Dwayne,

Can you post the version number of your Frost installation?

Frost 1.2 has a built-in XYZ to PRT converter. It includes an option to convert the color to float:

frost_convert_color_byte_to_float.png

Could you please try updating to Frost 1.2, and see if the built-in converter works for you?

Yeah i’m using version 1.1.2.44769.

I’ll install the new version and test it again.

New version converts it properly! My fault for not staying on top of the current version. Thanks for the help.

Great, thank you for letting us know!

Does the file have to be in xyz or will it import the color if the import points are .pts?

Thanks,
David

.PTS should work too. Please let us know if you encounter any problems.

Paul,
The file I have imported (pts) does not have color (even though it had it upon export) and I checked the color box.
Is there a different shader I need to apply to the mesh?

At some point it would be useful to have the ability to not fully encapsulate the particle.
For example, say our file is a scan of a roadway. We don’t need the mesh on the underside of the road. All it does is double the polygon count.

Gap filling would be another big feature…

Thanks!
David

In the viewport:
Right-click the Frost node in the viewport. Select Object Properties from the pop-up menu. In the Object Properties dialog, enable “Vertex Channel Display” in the Display Properties group. Make sure the drop-down box below it is set to “Vertex Color”.

In the render:
Create a Standard material, and assign a Vertex Color map to its Diffuse slot. Assign this material to the Frost node.

If it still doesn’t work after you make these changes, could you please send me your .PTS file? (Or the first 30 or so lines from it, if it’s really big.) You can send us files using our ticket system. I think you’ll need to ZIP the file first.

Thank you! These are on our wish list for future development.

Privacy | Site terms | Cookie preferences