Custom BIN file exporter

Post Reply
kaistudio
Posts: 16
Joined: Mon Dec 06, 2010 1:31 pm

Custom BIN file exporter

Post by kaistudio » Thu Jan 06, 2011 9:50 am

Although the problem is not directly related to the Realflow.exe,
I want to ask about the bin particle file format in realflow system.

Now, I'm trying to make BIN file exporter to transfer the particle informations from my simulator to Krakatoa.
According to the document 'bin_particles_file_format.pdf' in the document folder.
I've filled up the Begin of file section as follows

Code: Select all

_header.verification_code = 0xFABADA;
	strcpy( _header.fluidName, "BlueNile" );
	_header.version = 11;

	_header.scaleScene = 1; //0.00041;
	_header.fluidType = 1;
	_header.elapsedSimulationTime = pNile->g_frame;
	_header.frameNumber = g_SimEnd;
	_header.framePerSecond = 24;
	_header.numberOfParticles = pNile->getActiveParticleNumber();

	_header.radius = pNile->getParticleRadius();
	
	FillFloat3( _header.pressure, 1,1,1 );
	FillFloat3( _header.speed , 1,1,1 );
	FillFloat3( _header.temperature, 1,1,1 );

	FillFloat3( _header.emitterPos, 0,0,0 );
	FillFloat3( _header.emitterRot, 0,0,0 );
	FillFloat3( _header.emitterScale, 0,0,0 );

	fwrite( &_header, sizeof(sBINHeader), 1 ,fp );
And for particles,

Code: Select all

sBINParticle* particleArr = new sBINParticle[activeParticles];

	for( int i = 0; i < activeParticles; i++ )
	{
		sBINParticle& cp = particleArr[i];
		FillFloat3( cp.position, h_pos[i*4+0], h_pos[i*4+1], h_pos[i*4+2] );
		FillFloat3( cp.velocity, h_vel[i*4+0], h_vel[i*4+1], h_vel[i*4+2] );
		FillFloat3( cp.force, h_force[i*4+0], h_force[i*4+1], h_force[i*4+2] );
		FillFloat3( cp.vorticity, 0,0,0 );
		FillFloat3( cp.normalVector, 0,0,0 );
		cp.numberOfNeighbors = 0;
		FillFloat3( cp.textureVector, 0,0,0 );
		cp.infoBits = 0;
		cp.elapsedParticleTime = 1;
		cp.isolationTime = 0;
		cp.viscosity = 0;
		cp.density = h_density[i];
		cp.pressure = h_pressure[i];
		cp.mass = 0.002;
		cp.temperature = 4.0;
		cp.particleID = i;
	}
Actually, the original scene is something like water stream on slope as in sim.jpg.
However, when I load the exported xxxx.bin files into the Krakatoa at 3DSMax(max.jpg), the result look
messed up. Could you tell me which parts can be problematic?
You do not have the required permissions to view the files attached to this post.

Post Reply