Not sure if I’m running into maxscript issues or discrepancies between frost and krak loading text files, or my custom header setup is wrong. I am making my own CSV/TXT/PTS files to be loaded in to krakatoa, my header is as such:
float16 Position[0], float16 Position[1], float16 Position[2], float16 otherstuff1, float16 otherstuff2
If I load this as a .txt into a PRTLoader or as a ParticleFile into Frost, it evaluates properly. However I am attempting to convert it to a PRT via the FrostUtils.ConvertParticleFile ptsFile prtFile, and that parser errors with:
– Runtime error: FrostUtils.ConvertParticleFile() - Error converting file ‘C:\WithHeader.txt’: channel_map.get_accessor: The type requested is not a valid type for the channel “Position”.The requested type is float32[3], the expected type is float16[3]. <<
Am I doing something wrong here? While it all works if I just read from the TXT, obviously performance is better if I go binary so that’s why I am looking to get the data into a PRT. I suppose if I really need to I can try to reconfigure my source data into a [x,y,z], stuff1, stuff2, but it was easier to keep all the channels separate based on how i’m getting the source data currently.
In Krakatoa and Frost, the “Position” channel is hard-coded to 32 bit and is expected in that format from PRT and CSV files.
You are requesting that the loader accepts float16 components for Position, and you are denied with an error because you would not have enough precision to express large floating point numbers.
The Header does not only tell the application which column is what data, but it also tells it to allocate channels with that data width, so it affects what representation the text data will have once loaded.
In the latter case, the channels will be automatically set to 32 bit unless Krakatoa or Frost has a different default for the specific channel name (e.g. Color tends to be 16 bit internally unless specified otherwise).
As always, exactly what I needed Bobo, thank you, all up and running with converted PRTs now.
If I can redirect the thread to a second unrelated question now: I’m using Curve nodes in magma a lot to do linear transforms of arbitrary data values into 0-1 range and wondering if there is a way to expose the min/max X values on that node? A few years ago when I started I was manually doing all the math for the linear transform, before I realized there was the curve node that makes it much simpler to setup, but the only thing I’m lacking is being able to easily input into those min/max values.
No, there is no way to expose the Min. and Max. values right now. I will add it to my ToDo list.
However, wiring together a simple BLOP operator that does that and saving it for future use would be all you need. If all you want is normalizing the value between 0.0 and 1.0 with linear slope, a Curve node is an overkill. You can even get an exponential curve using a Power operator.
The basic workflow would be:
Create an InputValue for the Min. value.
Create another InputValue for the Max. value.
Subtract the Min. value from the input value - this will shift the range to start at the Min. E.g. if the Min. is 50.0 and the input is 60.0, you get 10.0 which is the distance of 60.0 from the Minimum 50.0.
Subtract the Min.Value from the Max. Value. This will give you the width of the range.
Divide the result of the first subtraction by the second subtraction - this will normalize the value in the range between Min. and Max. Again, with input value of 60.0, Min of 50.0 and Max of 100.0, you get (60.0-50.0)/(100.0-50.0) = 10.0/50.0 = 0.2 which is exactly where 60.0 would sit in a range between 50.0 and 100.0.
Add a Function>Clamp right after that division to ensure that any input value less than the Min. will produce 0.0, and any value above the Max. will produce 1.0.
Select all these nodes except for the input value, right-click and create a BLOP.
In v2.4.4 and higher, you can expose the InputValues for Min. and Max. from inside the BLOP into its UI. Otherwise, you can expose them into the Modifier’s UI in the 3ds Max Command Panel.
Save the BLOP to disk in a sub-folder of your choice (this defines the Category in the BLOP node menu).
If you want to interpolate non-linearly, you can add a Power operator after the Clamp. A value of 1.0 will produce the Linear function. Setting it to values above 1.0 will shift the curve one way, setting it to values between 0.0 and 1.0 will bend the curve the other way.