Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

particle render issue #1

Open
lwkobe opened this issue Apr 20, 2017 · 7 comments
Open

particle render issue #1

lwkobe opened this issue Apr 20, 2017 · 7 comments

Comments

@lwkobe
Copy link

lwkobe commented Apr 20, 2017

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!

@zhxx1987
Copy link
Owner

zhxx1987 commented Apr 20, 2017 via email

@lwkobe
Copy link
Author

lwkobe commented Apr 20, 2017

`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!

@zhxx1987
Copy link
Owner

zhxx1987 commented Apr 20, 2017 via email

@lwkobe
Copy link
Author

lwkobe commented Apr 20, 2017

Thank you very much!

@lwkobe
Copy link
Author

lwkobe commented Apr 21, 2017

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

@zhxx1987
Copy link
Owner

zhxx1987 commented Apr 21, 2017 via email

@lwkobe
Copy link
Author

lwkobe commented Apr 22, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants