IVOCK icon indicating copy to clipboard operation
IVOCK copied to clipboard

particle render issue

Open lwkobe opened this issue 7 years ago • 7 comments

Hi, i want use your particle render to render my simulation result. But i find something confused. What "temp_data" means?(temperature field) And could you explain that why you arrange the particles in a different size that is not your solver field size? Thank you!

lwkobe avatar Apr 20 '17 13:04 lwkobe

Temp data if provided from a fire simulation, renders particle with temperatures,giving a rendering result like a burning fire and burnt dusts. I used to scale all particle data to 0~1 so that it's easy for me to navigate in another previewed, please comment the corresponding codes so that scaling doesn't happen.

Thank you!

Sent from my iPhone

On Apr 20, 2017, at 6:16 AM, lwkobe [email protected] wrote:

Hi, i want use your particle render to render my simulation result. But i find something confused. What "temp_data" means?(temperature field) And could you explain that why you arrange the particles in a different size that is not your solver field size? Thank you!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

zhxx1987 avatar Apr 20 '17 15:04 zhxx1987

`void setEmitter(Vec3f & pos, float r, uint n) { emitter_pos = pos; emitter_r = r; emitter_n = n; } void emit_tracers() { //cout<<"emitting tracers:"<<endl; vector<Vec4f> tracers_temp; tracers_temp.resize(0); for (uint i=0;i<tracers.size();i++) { if (tracers[i][0]>2*_hx && tracers[i][1]>2*_hx && tracers[i][2]>2*_hx && tracers[i][0]<_lx-2*_hx && tracers[i][1]<0.86*_ly-_hx && tracers[i][2]<_lz-2*_hx && tracers[i][3]>0.01) { tracers_temp.push_back(tracers[i]); } } tracers.swap(tracers_temp); uint num = 0; while(num<emitter_n) { float r = emitter_r; float x = frand(-r-_hx, r+_hx); float y = frand(-r-_hx, r+_hx); float z = frand(-r-_hx, r+_hx);

		if (x*x + y*y + z*z <= r*r)
		{
			tracers.push_back(Vec4f(emitter_pos[0]+x,
								    emitter_pos[1]+y,
									emitter_pos[2]+z,
									1.0)
							 );
			num++;
		}
	}
	//cout<<"emitting tracers done:"<<tracers.size()<<" tracers"<<endl;
}`

Hi,thanks for your answer. (1) In the emit_tracers() function,When you judge whether the particle is in the solver domain,you use the if (tracers[i][0]>2*_hx && tracers[i][1]>2*_hx && tracers[i][2]>2*_hx && tracers[i][0]<_lx-2*_hx && tracers[i][1]<0.86*_ly-_hx && tracers[i][2]<_lz-2*_hx && tracers[i][3]>0.01)condition. But i read your initial code for _hx,_hy,_hz. _nx=nx; _ny=ny; _nz=nz; _hx = L/(float)_nx; _hz = _hy = _hx; Could you explain what '_hx,_hy,_hz' mean? And why you choose a vec4 vector to save particles? What does the fourth dimesion of vec4 means? (2) In the particle_render project' read_particles() function ,you have somethings like for(int i=0; i<x.n; ++i){ // read x y z for particle i std::fread(&x[i], sizeof(float), 3, in); // skip 0.f x[i][0] = -x[i][0]; //float z = x[i][2]; x[i][2] = -x[i][2]; //x[i][0] = -z; //std::fread(&zero, sizeof(float), 1, in); std::fread(&d[i],sizeof(float), 1, in); } x[i][0] = -x[i][0]; x[i][2] = -x[i][2]; make me confused. Could you explain it ? Thank you!

lwkobe avatar Apr 20 '17 17:04 lwkobe

The forth component is to store density value which is a time evolving ode so that particles fade out smoothly. And for those axis it's just rotating or mirroring the particles which can be done in arbitrary way, without particular purpose.

Sent from my iPhone

On Apr 20, 2017, at 10:03 AM, lwkobe [email protected] wrote:

`void setEmitter(Vec3f & pos, float r, uint n) { emitter_pos = pos; emitter_r = r; emitter_n = n; } void emit_tracers() { //cout<<"emitting tracers:"<<endl; vector tracers_temp; tracers_temp.resize(0); for (uint i=0;i<tracers.size();i++) { if (tracers[i][0]>2*_hx && tracers[i][1]>2*_hx && tracers[i][2]>2*_hx && tracers[i][0]<_lx-2*_hx && tracers[i][1]<0.86*_ly-_hx && tracers[i][2]<_lz-2*_hx && tracers[i][3]>0.01) { tracers_temp.push_back(tracers[i]); } } tracers.swap(tracers_temp); uint num = 0; while(num<emitter_n) { float r = emitter_r; float x = frand(-r-_hx, r+_hx); float y = frand(-r-_hx, r+_hx); float z = frand(-r-_hx, r+_hx);

  if (x*x + y*y + z*z <= r*r)
  {
  	tracers.push_back(Vec4f(emitter_pos[0]+x,
  						    emitter_pos[1]+y,
  							emitter_pos[2]+z,
  							1.0)
  					 );
  	num++;
  }

} //cout<<"emitting tracers done:"<<tracers.size()<<" tracers"<<endl; }` Hi,thanks for your answer. (1) In the emit_tracers() function,When you judge whether the particle is in the solver domain,you use the if (tracers[i][0]>2*_hx && tracers[i][1]>2*_hx && tracers[i][2]>2*_hx && tracers[i][0]<_lx-2*_hx && tracers[i][1]<0.86*_ly-_hx && tracers[i][2]<_lz-2*_hx && tracers[i][3]>0.01)condition. But i read your initial code for _hx,_hy,_hz. _nx=nx; _ny=ny; _nz=nz; _hx = L/(float)_nx; _hz = _hy = _hx; Could you explain what '_hx,_hy,_hz' mean? And why you choose a vec4 vector to save particles? What does the fourth dimesion of vec4 means? (2) In the particle_render project' read_particles() function ,you have somethings like for(int i=0; i<x.n; ++i){ // read x y z for particle i std::fread(&x[i], sizeof(float), 3, in); // skip 0.f x[i][0] = -x[i][0]; //float z = x[i][2]; x[i][2] = -x[i][2]; //x[i][0] = -z; //std::fread(&zero, sizeof(float), 1, in); std::fread(&d[i],sizeof(float), 1, in); } x[i][0] = -x[i][0]; x[i][2] = -x[i][2]; make me confused. Could you explain it ? Thank you!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

zhxx1987 avatar Apr 20 '17 17:04 zhxx1987

Thank you very much!

lwkobe avatar Apr 20 '17 17:04 lwkobe

Hi in your particle_render project <radius> <density_scale> <opacity> <light_x> <light_y> <light_z> [quality], how to set the paramater? Thank you!

lwkobe avatar Apr 21 '17 11:04 lwkobe

here is the an example The parameters could be: file folder where particledata0000.bin is stored. 0.008(particle size) 1(density scale) 0.006(particle transparency) 3 10 -5(light position) 10(shadow map quality) 0(start frame) 100(end frame)

Sent from my iPhone

On Apr 21, 2017, at 4:29 AM, lwkobe [email protected] wrote:

Hi in your particle_render project <density_scale> <light_x> <light_y> <light_z> [quality], how to set the paramater? Thank you!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

zhxx1987 avatar Apr 21 '17 15:04 zhxx1987

Hi, when i see your simulator code, i find that you add 12288 particles every times. Could you get high rate of computations? Or Do I get your code understood wrong?

lwkobe avatar Apr 22 '17 15:04 lwkobe