# Dynamic cloud rendering

This topic is 2606 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi,

I'm working on implenting dynamic 3d clouds into my game using this paper:

http://www.ijvr.org/issues/issue2-2009/10.pdf

However, I am having difficulties understanding the transition rules:

What does ^ and ? mean? Does it mean multiplication/division? or is it some kind of if-statement..?

##### Share on other sites
^ = and
v = or
L (thingy) = not

Part of boolean algebra.

##### Share on other sites
Thanks, now it makes sense. I thought hum, act and cld were floats..

However my implentation isn't working as expected.

#include "Cloud.h" CCloud::CCloud(void) { } CCloud::~CCloud(void) { for(int i = 0; i<m_SizeX;i++) { for(int j = 0;j<m_SizeY;j++) { delete[] m_Cells[j]; } delete[] m_Cells; } delete[] m_Cells; } void CCloud::Init(int SizeX, int SizeY, int SizeZ) { m_SizeX = SizeX; m_SizeY = SizeY; m_SizeZ = SizeZ; m_Cells = new CloudCell**[SizeX]; for(int i = 0; i<SizeX;i++) { m_Cells = new CloudCell*[SizeY]; for(int j = 0;j<SizeY;j++) { m_Cells[j] = new CloudCell[SizeZ]; } } } void CCloud::Setup(float pEx, float pAct, float pHum) { m_pEx = pEx; m_pAct = pAct; m_pHum = pHum; for(int i = 0; i<m_SizeX;i++) { for(int j = 0;j<m_SizeY;j++) { for(int k = 0;k<m_SizeZ;k++) { m_Cells[j][k].act = rand()/RAND_MAX; m_Cells[j][k].cld = rand()/RAND_MAX; m_Cells[j][k].hum = rand()/RAND_MAX; } } } } void CCloud::Update(void) { CloudCell* Cell; for(int i = 0; i<m_SizeX;i++) { for(int j = 0;j<m_SizeY;j++) { for(int k = 0;k<m_SizeZ;k++) { Cell = &m_Cells[j][k]; Cell->hum = Cell->hum&(!Cell->act); Cell->cld = Cell->cld|(!Cell->act); Cell->act = !Cell->act&Cell->hum&GetAct(i, j, k); } } } vector<vector<vector<CloudCell>>> Cells; Cells.resize(m_SizeX); for(int i = 0; i<m_SizeX;i++) { Cells.resize(m_SizeY); for(int j = 0;j<m_SizeY;j++) { Cells[j].resize(m_SizeZ); for(int k = 0;k<m_SizeZ;k++) { Cell = &m_Cells[j][k]; Cell->cld = Cell->cld & (rand()/RAND_MAX>m_pEx); Cell->hum = Cell->hum | (rand()/RAND_MAX>m_pHum); Cell->act = Cell->act | (rand()/RAND_MAX>m_pAct); Cells[j][k] = *Cell; } } } } bool CCloud::GetAct(int X, int Y, int Z) { m_SizeX -=1; m_SizeY -=1; m_SizeZ -=1; bool Act = m_Cells[min(X+1,m_SizeX)][Y][Z].act | m_Cells[X][min(Y+1,m_SizeY)][Z].act | m_Cells[X][Y][min(Z+1,m_SizeZ)].act | m_Cells[max(X-1,0)][Y][Z].act | m_Cells[X][max(Y-1,0)][Z].act | m_Cells[X][Y][max(Z-1,0)].act | m_Cells[max(X-2,0)][Y][Z].act | m_Cells[min(X+2,m_SizeX)][Y][Z].act | m_Cells[X][max(Y-2,0)][Z].act | m_Cells[X][min(Y+2,m_SizeY)][Z].act | m_Cells[X][Y][max(Z-2,0)].act; m_SizeX +=1; m_SizeY +=1; m_SizeZ +=1; return Act; }

Is there anything obviously wrong with the code? Or something I misunderstood? Because after having called Update(), all cells in the temporary 3d vector are having the same 3 variables: hum = false, cld = false, act = false. Some ideas?

1. 1
2. 2
Rutin
16
3. 3
4. 4
5. 5

• 11
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633721
• Total Posts
3013532
×