AWS Thinkbox Discussion Forums

newbie: Krakatoa Particle Channels and Frost

Hello friends, my first question in this forum, thanks very much for your time.

I’m experiencing an unexplainable issue with Frost not seeing channels that I export from Krakatoa.

What really gets me is: if I run this test on the PRT files it says the channels are there.

In the listener, I type
FranticParticles.GetFileParticleChannels @"\dirpath\PRT\prtname_000.prt"

and it returns a list of channels embedded in those PRT files. It clearly shows #(“Orientation”, “float16”, 4) in the list.

But Frost isn’t seeing it. Any idea what I’m doing wrong? I appreciate any and all advice.

My first thought is that the Orientation channel may be all zero, perhaps because that channel doesn’t exist in the original particle source. To check this:

  1. Create a new Krakatoa -> PRT Loader.
  2. In the PRT Loader, add the PRT file that you saved earlier.
  3. With the PRT Loader selected, use the Krakatoa -> “Launch the Particle Data Viewer utility…” menu item.
  4. In the Particle Data Viewer dialog that appears, press the UPDATE button.

In the Particle Data Viewer dialog, you should see a table with an “Orientation” column. Are the values in this column all zero?

Wow what a quick response! Thanks Paul.

Particle Data Viewer…I’m learning more already. There is sooooooo much more to learn…

There is no orientation column. So clearly the PRT files didn’t get an orientation channel when they saved.

So now I have to wonder why that bit of maxscript returned those values…might be the wrong syntax. I’m still researching that.

Hey Paul while I have you here I am looking for the code to control these particle channels in a scripted tool that shoots the ‘Save Particles To Disk’ job off to Deadline.

I’ve got it working but it doesn’t seem to respect the save channels I see in the list (the list on the right side that says Save Channels).

I’m looking for the syntax/code that would let me set that in the script but no luck so far. If you or anybody else can point me in the right direction I’d be ever so grateful. Thanks again for your time.

Hi!

First of all, I would like to point out that the Particle Data Viewer is 100% MAXScript, so it uses similar functions to the ones you are calling to check what channels exist, and to read their data. The main difference is that PDV is asking the PRT object itself, not the file.

It looks like this:

[code]a = FranticParticles.GetPRTObjectIStream $KrakatoaPRTLoader001 false false
–> MixinInterface:KrakatoaParticleIStream

showInterface a
–>
Interface: KrakatoaParticleIStream
Properties:
Methods:
GetCount()
GetChannels()
Close()
ReadParticle()
SkipParticles NumToSkip
Actions:
OK

c = a.GetChannels()
–> #(“Position float32[3]”, “ID int32[1]”, “Velocity float16[3]”, “Color float32[3]”)[/code]

While asking one file from the PRT Loader does this:

b = FranticParticles.GetFileParticleChannels $KrakatoaPRTLoader001.fileList[1] #(#("Position", "float32", 3), #("ID", "int32", 1), #("Velocity", "float16", 3))

As you can see, the Color channel is not on that list. That is because the PRT Loader makes its own Color channel when there is no such data in the file, based on the Wirecolor of the object, or the Material assigned to the object. You will notice that there is a >> sign next to “Color” in PDV - that’s because PDV actually checks BOTH lists and marks any channels not appearing in the file but appearing in the PRT object as “not from file”!
For example, if you add a Magma Modifier to the stack of a PRT Loader and create an Output node “TextureCoord” and set it to [1,0,0] for all particles, the TextureCoord channel will not be in the PRT file, but will be on top of the stack in the object, and PDV will mark it with >> like the Color to let you know it was not “native”.

So if the PDV says there is no Orientation in the object, but MAXScript says there is, you might be looking at different files…

Regarding the setting of the Krakatoa Render Dialog channels list - nearly all settings of Krakatoa are defined and set via string methods, also exposed by the FranticParticles interface. If you look in the KrakatoaGUI.ms, you might find out that we store these in the property named “ActiveParticleChannels”. We store a single string with all values (name, type, arity) delimited by commas:

FranticParticles.getProperty "ActiveParticleChannels" --> "Position,float32,3,Velocity,float16,3,Density,float16,1,Color,float16,3,Normal,float16,3,ID,int32,1"

As you can see, there is a function called

fn storeActiveChannels = ( local thePropValue = "" for i in activeChannels do thePropValue += i[1] + "," + i[2] + "," + i[3] as string + "," if activeChannels.count > 0 do thePropValue = substring thePropValue 1 (thePropValue.count-1) FranticParticles.setProperty "ActiveParticleChannels" thePropValue )

It takes the content of the variable activeChannels which is an array of arrays like you get from the file access above, and flattens it out as a string.

Also look at the function setChannelsFromSelectedNodes() - it is exposed in the [>>] button between the two lists in the UI, and lets you pick any PRT object in the scene, and set the output list to the same channels. Another function, appendChannelsFromSelectedNodes(), lets you add the PRT object’s channels to the list of channels to save. The code there will show you how you can convert the return results of the methods discussed earlier above to the list you need to set your channels list.

But in general, you can just hard code it if you want, like this for example:

FranticParticles.setProperty "ParticleMode" "Save Particles To File Sequence" --force save mode
--then set some channels:
FranticParticles.setProperty "ActiveParticleChannels" "Position,float32,3,Velocity,float16,3,Color,float16,3,ID,int32,1,Orientation,float16,4"
--refresh the rollout if the Krakatoa GUI is open and you want to see them listed:
Krakatoa_GUI_SaveParticles.Refresh_GUI()

Hope this helps!

Bobo, even before I tackle this I want to thank you for the response; I am honored.

I will devour this info. Thank you so much. I’ll be back.

Well, it’s working. And I haven’t even digested all the information you gave me, Bobo.

I found that the render would fail if I included the asterisk in the Radius listing. Other than that, adding the hard coding you indicated worked beautifully. Thanks a million for the knowledge.

I have thought about incorporating some ways of choosing the channels in my rollout, but I haven’t wrapped my brain around that one quite yet. It sounds like another interesting problem.

Thanks again, Bobo. You rule.

Yeah, the asterisk should not be added.

In earlier versions of Krakatoa (prior to 2.4 I think), the Radius channel was not on the factory list of channels, so the user had to add it manually via the UI. Any channel created that way is stored in an external INI file, and is loaded when Krakatoa is initialized. Such channels get the asterisk in the UI to let you know they were user-made, and might not be known to Krakatoa. E.g. if you made a channel named “KenTanker0us”, it would show the asterisk on the list, but that would not be saved in the renderer’s property of active channels, just the name would.

I have much to learn about channels. Thank you for your help and insights, Bobo.

 [b]"I'll be back."[/b] :slight_smile:
Privacy | Site terms | Cookie preferences