Commit 84e639dc authored by Sebastian Gaida's avatar Sebastian Gaida
Browse files

Merge branch 'master' of https://gitlab.uni-koblenz.de/gaida/ba_gaida

# Conflicts:
#	ba_gaida/src/shaders/ba_gaida/normalShader.glsl
#	doku/Quellen/2014_EG_SPH_STAR.pdf
#	doku/cgBA_Latex/BA.aux
#	doku/cgBA_Latex/BA.bbl
#	doku/cgBA_Latex/BA.lof
#	doku/cgBA_Latex/BA.log
#	doku/cgBA_Latex/BA.out
#	doku/cgBA_Latex/BA.pdf
#	doku/cgBA_Latex/BA.synctex.gz
#	doku/cgBA_Latex/BA.tex
#	doku/cgBA_Latex/BA.toc
#	doku/cgBA_Latex/Bilder/StoringLable.JPG
#	doku/cgBA_Latex/lib.bib
parents 48d37bd1 1bdbe2f7
......@@ -27,3 +27,6 @@ doku/cgBA_Latex/main.synctex.gz
doku/cgBA_Latex/main.tex
doku/cgBA_Latex/main.toc
doku/Präsentation
doku/Quellen
doku
......@@ -75,7 +75,7 @@ ba_gaida::ParticleSystem::ParticleSystem(GLFWwindow *window, const int particleC
ComputeShader::createComputeShader(m_prefixSumExcludeID[0] , SHADERS_PATH "/ba_gaida/prefixSumExcludeShader.glsl");
ComputeShader::createComputeShader(m_rearrangingParticlesID[0] , SHADERS_PATH "/ba_gaida/rearrangingParticlesShader.glsl");
ComputeShader::createComputeShader(m_densityID[0] , SHADERS_PATH "/ba_gaida/densityShader.glsl");
ComputeShader::createComputeShader(m_arbitraryID[0] , SHADERS_PATH "/ba_gaida/arbitraryPositionShader.glsl");
ComputeShader::createComputeShader(m_normalID[0] , SHADERS_PATH "/ba_gaida/normalShader.glsl");
ComputeShader::createComputeShader(m_calcForcesID[0] , SHADERS_PATH "/ba_gaida/calcForcesShader.glsl");
ComputeShader::createComputeShader(m_swapParticlesID[0] , SHADERS_PATH "/ba_gaida/swapParticlesShader.glsl");
ComputeShader::createComputeShader(m_updateForceID[0] , SHADERS_PATH "/ba_gaida/updateForceShader.glsl");
......@@ -90,7 +90,7 @@ ba_gaida::ParticleSystem::ParticleSystem(GLFWwindow *window, const int particleC
setUniformPrefix(m_prefixSumExcludeID);
setUniform(m_rearrangingParticlesID);
setUniformParticles(m_densityID);
setUniformParticles(m_arbitraryID);
setUniformParticles(m_normalID);
setUniformParticles(m_calcForcesID);
setUniform(m_swapParticlesID);
setUniform(m_updateForceID);
......@@ -129,7 +129,7 @@ ba_gaida::ParticleSystem::~ParticleSystem()
Shader::deleteShader(m_prefixSumBufferID[0]);
Shader::deleteShader(m_rearrangingParticlesID[0]);;
Shader::deleteShader(m_densityID[0]);
Shader::deleteShader(m_arbitraryID[0]);
Shader::deleteShader(m_normalID[0]);
Shader::deleteShader(m_calcForcesID[0]);
Shader::deleteShader(m_swapParticlesID[0]);
Shader::deleteShader(m_updateForceID[0]);
......@@ -181,7 +181,7 @@ void ba_gaida::ParticleSystem::update(double deltaTime)
m_Forces = glm::vec4(glm::vec3(m_gravityV4.x * m_gravity,m_gravityV4.y * m_gravity,m_gravityV4.z * m_gravity)+ m_externalForce,0.f);
ComputeShader::updateComputeShaderParticle(m_densityID, deltaTime, m_particleCount, m_settings, m_Forces, m_buoyCoeff, m_heatFlow);
ComputeShader::updateComputeShaderParticle(m_arbitraryID, deltaTime, m_particleCount, m_settings , m_Forces, m_buoyCoeff, m_heatFlow);
ComputeShader::updateComputeShaderParticle(m_normalID, deltaTime, m_particleCount, m_settings , m_Forces, m_buoyCoeff, m_heatFlow);
m_fps->setTimestamp(5);
......@@ -367,6 +367,8 @@ void ba_gaida::ParticleSystem::initParticle()
m_particle[i].temperature = m_temperature;
m_particle[i].vorticity = glm::vec4(0.f);
if (i == m_particleCount - 1)
{
std::cout << "Successfully generated: \t" << m_particleCount << " Particle" << std::endl;
......@@ -408,7 +410,7 @@ void ba_gaida::ParticleSystem::initShader(){
ComputeShader::initComputeShader(m_prefixSumBufferID, m_particleCount, m_dimensions);
ComputeShader::initComputeShader(m_rearrangingParticlesID, m_particleCount, m_dimensions);
ComputeShader::initComputeShader(m_densityID, m_particleCount, m_dimensions);
ComputeShader::initComputeShader(m_arbitraryID, m_particleCount, m_dimensions);
ComputeShader::initComputeShader(m_normalID, m_particleCount, m_dimensions);
ComputeShader::initComputeShader(m_calcForcesID, m_particleCount, m_dimensions);
ComputeShader::initComputeShader(m_swapParticlesID, m_particleCount, m_dimensions);
ComputeShader::initComputeShader(m_updateForceID, m_particleCount, m_dimensions);
......
......@@ -111,7 +111,7 @@ namespace ba_gaida
GLuint m_prefixSumExcludeID[4];
GLuint m_rearrangingParticlesID[4];
GLuint m_densityID[8];
GLuint m_arbitraryID[8];
GLuint m_normalID[8];
GLuint m_calcForcesID[8];
GLuint m_swapParticlesID[4];
GLuint m_updateForceID[6];
......
......@@ -46,10 +46,7 @@ uniform ivec4 gridSize;
uniform vec4 externalForce;
uniform vec4 particleSettings;
uniform float heatFlow;
//float mass;
//float restingDensity;
//float stiffness;
//float radius;
const float kinematicViscosity = 0.25f;// uniform testen
const float PI = 3.14159265f;
......@@ -60,18 +57,19 @@ float Weight(vec3 relativePosition)
{
float relativePosition_2 = dot(relativePosition, relativePosition);
float radius_2 = particleSettings.w * particleSettings.w;
float temp = 315.0 / (64.0 * PI * pow(particleSettings.w, 9));
return temp * pow(radius_2 - relativePosition_2, 3) * float(relativePosition_2 <= radius_2);
}
vec3 gradientWeight(vec3 relativePosition)
{
float c = -45.0 / PI / pow(particleSettings.w, 6);
float temp = -45.0 /(PI * pow(particleSettings.w, 6));
float l = max(length(relativePosition), 0.0001);
float vektorlength = max(length(relativePosition), 0.0001);
return c*relativePosition / l*pow(abs(particleSettings.w - l), 2.0)*float(l <= particleSettings.w);
return (temp*relativePosition / vektorlength) * pow(abs(particleSettings.w - vektorlength), 2.0)
*float(vektorlength <= particleSettings.w);
}
float laplaceWeight (vec3 relativePosition)
......@@ -81,14 +79,13 @@ float laplaceWeight (vec3 relativePosition)
float radius_6 = radius_3 * radius_3;
float temp = 45.f /(PI * radius_6);
float vektorlength = length(relativePosition);
float length = length(relativePosition);
return temp * (particleSettings.w - length) * float(length <= particleSettings.w);
return temp * (particleSettings.w - vektorlength) * float(vektorlength <= particleSettings.w);
}
float thermalCon (float temperatureDiff){
return heatFlow /(particleSettings.w * temperatureDiff);
return heatFlow * temperatureDiff;
}
uint cubeID(vec4 position){
......@@ -128,6 +125,9 @@ void main(void) {
* ((inParticle[j].velocity.xyz - inParticle[id].velocity.xyz)/ inParticle[j].density)
* laplaceWeight(inParticle[id].position.xyz - inParticle[j].position.xyz);
vorticity += (cross(inParticle[j].vorticity.xyz, inParticle[id].position.xyz - inParticle[j].position.xyz))
* Weight(inParticle[id].position.xyz - inParticle[j].position.xyz);
if (inParticle[id].density > 28){
temperature += ((particleSettings.x / (inParticle[id].density * inParticle[j].density))
* heatFlow
......@@ -150,7 +150,6 @@ void main(void) {
}
outParticle[id].temperature = temperature;
// buoyancy = buoyCoeff * 10.5 * upDirection * inParticle[id].density;
buoyancy = buoyCoeff * temperature * upDirection * inParticle[id].density;
viscosity *= kinematicViscosity;
outParticle[id].velocity = inParticle[id].velocity + vec4(deltaTime * ( vorticity + pressure + viscosity + (buoyancy + externalForce.xyz * inParticle[id].density)* 0.1), 0.f);
......
......@@ -34,7 +34,7 @@ uniform ivec4 origin = ivec4(1);
void main(void) {
uint id = gl_GlobalInvocationID.x;
const float energyloss = 0.2;
const float energyloss = 0.5;
if(id >= particleCount)
{
return;
......
......@@ -67,7 +67,7 @@ float Weight(vec3 relativePosition)
void main(void) {
uint id = gl_GlobalInvocationID.x;
uint neighborGrid;
float density = 0.1;
float density = 0.f;
if (id >= particleCount)
{
......@@ -82,7 +82,8 @@ void main(void) {
neighborGrid = cubeID(inParticle[id].position + vec4(x, y, z, 0));
int count = 0;
for (int j = grid[neighborGrid].currentSortOutPut; j < grid[neighborGrid].currentSortOutPut + grid[neighborGrid].particlesInGrid && count <= 16; j++){
for (int j = grid[neighborGrid].currentSortOutPut; j < grid[neighborGrid].currentSortOutPut
+ grid[neighborGrid].particlesInGrid && count <= 16; j++){
if(j == id){
continue;
}
......
......@@ -103,4 +103,4 @@ void main(void) {
outParticle[id].vorticity = vec4((k + beta * cross(normal, externalForce.xyz)),0.f) * deltaTime;
}
}
\ No newline at end of file
}
......@@ -37,7 +37,8 @@ void main(void) {
} else
{
outParticle[id].position = vec4(inParticle[id].startPosition.xyz,0.f);
outParticle[id].velocity = vec4(0.f,0.f,0.f,0.f);
outParticle[id].velocity = vec4(0.f);
outParticle[id].vorticity = vec4(0.f);
outParticle[id].temperature = inParticle[id].startPosition.w;
outParticle[id].vorticity = vec4(1.f);
}
......
1. Recherche
2. Framework erstellen und Techniken erlernen
3. Implementation des Partikelsystems
4. Peformanceverbesserungen
5. Abwägen des Erreichten und Vergleich mit anderen Partikelsystemen
6. Ausarbeitung schreiben
https://online.officetimeline.com/app/#/file/d1e8f431-ef49-456b-afd2-0084f1f94cd5/gantt-view
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment