AWS Thinkbox Discussion Forums

PDV 100k Display Limit

How do you use the PDV to analyze more than 100K particles at a time?

I recognize that this limit for the Count spinner is likely set “since filling a ListView with more than 100K records can take a really long time” posted in the docs here thinkboxsoftware.com/krak-part-data-viewer/ however this isn’t the number of records being displayed when Nth >1, moreso when PDV is in Stats mode no records are being displayed in the listview at all, I just want to see that values at the bottom of the window.

Use Case: I have several datasets of 4-5million particles with a variety of different types of data in them, and I need to determine the proper min/max range for a few channels. Even if I only sample every 1,000th particle, it seems that I cannot scan more than 100K at a time? I have to leave count at the 100,000 and then just do incremental steps on the First: spinner to see each set and then compare the values with each update. What am I missing?

PDV is a MAXScript, so the answer is “Just edit it”. :nerd:

  1. Locate the file
    “C:\Program Files\Thinkbox\Krakatoa MX\Scripts\Krakatoa_ParticleDataViewer.ms”

  2. Open the file in MAXScript Editor

  3. Locate the line

spinner spn_count "Count" fieldwidth:50 type:#integer range:[1,100000,1000] pos:[340,4] scale:100

  1. Change the value to whatever you want, e.g. range:[1,100000000,1000] to allow 100 million.

  2. Save the file. This might be tricky since the saving of files under Program Files is generally forbidden. So you might have to edit the Permissions of the file to allow full access to your user.

  3. Open PDV (you don’t even need to restart Max, since PDV is run from the MS file each time you select the option from the menu. See if it does what you want without taking forever.

Hope this helps.

Well that was easy. I always forget how much of this is MaxScript. Thanks Bobo!

Btw, you can also script your own tool to find out only the Min/Max ranges of specific channels.
I just tested and the pure loop over 1 million particles in a PRT stream takes about 10 seconds.
However, reading the same 1 million particles into the Stats panel of the PDV takes 237 seconds, because there are a lot of additional logical tests and array collections within a nested loop going through all channels.
But if you know the specific channels you need to explore, you could remove a lot of this general purpose logic and hard-code something that would be significantly faster.

For example, the following function will find the Min. and Max. X, Y and Z Positions of 1 million points of the currently selected PRT object in 15 seconds:

(
	local st = timestamp()
	local currentStream = FranticParticles.GetPRTObjectIStream $ false false
	local theChannelToScan = "Position"	
	local theChannels = currentStream.getChannels()
	local theIndex = 0	
	for c = 1 to theChannels.count where matchPattern theChannels[c] pattern:(theChannelToScan+" *") do theIndex = c
	if theIndex > 0 do
	(	
		local theMinValue = [10e10,10e10,10e10]
		local theMaxValue = [-10e10,-10e10,-10e10]
		local theData	= #()
		for i = 1 to 1000000 while theData != undefined do 
		(
			theData = currentStream.readParticle()
			if theData[theIndex].x > theMaxValue.x then theMaxValue.x = theData[theIndex].x
				else if theData[theIndex].x < theMinValue.x do theMinValue.x = theData[theIndex].x
			if theData[theIndex].y > theMaxValue.y then theMaxValue.y = theData[theIndex].y
				else if theData[theIndex].y < theMinValue.y do theMinValue.y = theData[theIndex].y
			if theData[theIndex].z > theMaxValue.z then theMaxValue.z = theData[theIndex].z
				else if theData[theIndex].z < theMinValue.z do theMinValue.z = theData[theIndex].z
		)
		currentStream.close()
		format "Min. % = %\n" theChannelToScan theMinValue
		format "Max. % = %\n" theChannelToScan theMaxValue
		format "% ms\n" (timestamp()-st)
	)
)

However, it will not look for any other channels, and the code was not written to support any other arity but 3, so it only works for vectors. You can change “Position” to “Velocity” or “Normal” and it will give you the Min/Max values for that channel, too, again in about 15 seconds.
Note that it does not return the specific Min or Max value, but the Min and Max components of the channel. So in the case of Normal the Min. might look like [-1,-1,-1], but there is no such Normal, it just means that the min. X value of all possible Normals was -1, and the same was the case for Y and Z…

So this case is about 15 times faster than the Stats of PDV, but in my case it collected 8x less data (only one channel out of 8 in a PRT Volume), and it did not collect the min/max length of the vector or the average values of the various components. So it simply does less work. But if you just want to know what the minimum and maximum extent of some value is, it might help you get there faster…

I will log a wish against a C++ function in FranticParticles that could do this faster and return the min/max/average of all channels found in a stream without running MAXScript loops. It would be nice to have access to that inside of Magma, too…

Privacy | Site terms | Cookie preferences