#include <PreIllumSystem.h>
Public Member Functions | |
void | SetEyeCamera (Camera *theCam) |
void | Init (int particlecount, int directioncount) |
Initializator function. | |
void | Display () |
Render the particle system. | |
void | Refresh (Vector lightpos, Vector lightpos2, Vector lightcolor, Vector lightcolor2) |
Refreshes the system in a frame. | |
char * | DisplayTexture (int tex) |
Displays one of the textures used by the system. | |
void | getNearest (Vector *positions) |
void | IncreaseOpacity () |
void | DecreaseOpacity () |
void | IncreaseAlbedo () |
void | DecreaseAlbedo () |
float | getAlbedo () |
float | getOpacity () |
void | ResetIllumTexture () |
void | setSkyColor (Vector skyC) |
Public Attributes | |
ParticleSystem | m_System |
a system that stores particle positions and can render them as sprites | |
int | m_DirectionCount |
the number of directions the technique should use | |
int | m_ParticleCount |
the number of particles in the system | |
float | m_Albedo |
the albedo of one particle | |
float | m_Opacity |
the desirer opacity of the medium | |
float | m_Symmetry |
the symmetry of scattering used in the phase function | |
int | m_LightWindowSize |
resolution of the lightsources viewports | |
int | m_IterateCount |
number of iterations in a frame | |
Private Member Functions | |
void | CreateGivenDirections () |
generates directions equally along the unit sphere | |
void | CreateRandomDirections (bool fillarray) |
generates random directions | |
void | Calculate_Up_Right_Vector (Vector viewdir, Vector &UpVector, Vector &RightVector) |
float | Phase (Vector diri, Vector dirj, float symmetry) |
calculates the scattering phase function value for two directions and a symmetry value | |
GetNearestDirection (Vector LightPosition) | |
searches the stored directions and returns the one closest to a given direction | |
void | InitSystem (int particlecount, int directioncount) |
Initializator function. | |
void | CreateVisibilityTexture () |
Creates a texture that stores the visibility information of the particles. | |
void | CreateNearestDirectionTexture () |
Creates a texture that stores. | |
void | CreatePhaseTexture () |
Creates a look-up texture to speed up phase function calculation. | |
void | CreateLVisMap () |
Creates a texture that can be used to determine which particles are visible from the lightsource. | |
void | CreateTauTexture () |
Creates a texture tha stores the tau value for each particle. | |
void | RefreshDirectIllumTexture () |
Refreshes the texture that stores direct illumination information. | |
void | Iterate () |
Updates the illumination texture. | |
void | CreateEyeRadTexture () |
Updates the eye radiance texture. | |
void | FindVisiblesWithRendering (Vector LightPosition, int row) |
Finds the visible particles from a point of view. | |
void | RenderToImpostor () |
not used | |
Private Attributes | |
Vector | m_SkyColor |
color of the sky | |
Impostor | m_ScreenQuad |
used for fullscreen quad rendering | |
Impostor | m_CameraImpostor |
Impostor | m_LightImpostor |
Camera * | m_EyeCamera |
view camera | |
Camera | m_TempCamera |
Vector | m_LightPosition |
position of the first lightsource | |
Vector | m_LightColor |
color of the first lightsource | |
Vector | m_LightPosition2 |
position of the second lightsource | |
Vector | m_LightColor2 |
color of the second lightsource | |
int | m_NearestDir |
the closest direction from the predefined directions to the light's direction | |
int | m_NearestDir2 |
the second closest direction from the predefined directions to the light's direction | |
float | m_Weight1 |
weight of m_NearestDir | |
float | m_Weight2 |
weight of m_NearestDir2 | |
Particle * | m_ParticleArray |
float * | m_PositionArray |
float * | m_DirectionData |
Vector * | m_Directions |
float * | m_DirectionArray |
unsigned char * | m_LVisMap |
unsigned char * | m_LRendVisMap |
float * | m_Pixels |
GLuint | m_VisibilityTexID |
stores the visibility information of the particles | |
GLuint | m_DirectionsTexID |
stores predefined directions to use | |
GLuint | m_PhaseTextureID |
a look-up texture to speed up phase function calculation | |
GLuint | m_LVisMapID |
a texture that can be used to determine which particles are visible from the lightsource | |
GLuint | m_RenderedVisID |
used when determining licible particles | |
GLuint | m_TauTextureID |
stores tau value for each particle | |
CgProgram | m_TexRectPrograms |
CgProgram | m_LightIllumPrograms |
CgProgram | m_IllumIteratePrograms |
CgProgram | m_EyeRadPrograms |
CgProgram | m_LVisPrograms |
CgProgram | m_FinalRenderPrograms |
RenderTexture | m_DirectIlumTexture |
RenderTexture | m_IllumTexture |
RenderTexture | m_IllumTexture2 |
RenderTexture * | m_IllumColorTex |
RenderTexture * | m_IllumRenderTex |
RenderTexture | m_EyeRadTexture |
RenderTexture | m_Target |
Texture | m_BillboardTexture |
Texture | m_Bbtex |
RenderTexture | m_ImpostorTexture |
This particle system can be lit with two dinamic directional light sources and a sky light color. The direction and color of the light sources can freely change.
|
Updates the eye radiance texture. The eye radiance texture stores the amount of light headig from each particle to the eye. |
|
Creates a texture tha stores the tau value for each particle. The tau values are calculated from the given desired opacity and the size of the particle. |
|
Creates a texture that stores the visibility information of the particles. For each particle for each direction the first visible (from that direction) particle's id is stored. |
|
Displays one of the textures used by the system. Used for debugging and presentation. |
|
Finds the visible particles from a point of view. The light visibility texture stores the id of the visible particles (with occlusion) from the light sources. The param "row" means the id of the lightsource ( 0 or 1). The visibility is calculated with rendering the particles from the lightsource. Each particle has a color corresponding it's id. The resulting image is read back, and the pixels are counted. If the number of pixels with a particle's id found is greather than some limit, the particle is visible. |
|
Refreshes the system in a frame. The actual light positions and colors should be passed. |
|
Refreshes the texture that stores direct illumination information. Direct illumination is the amount of light coming directly from the lightsource. |
|
number of iterations in a frame As the result of the last frame is used, this should be set to one. |
|
used when determining licible particles
|
|
stores the visibility information of the particles For each particle for each direction the first visible (from that direction) particle's id is stored. |
|
weight of m_NearestDir m_NearestDir and m_NearestDir2 will be interpolated |
|
weight of m_NearestDir2 m_NearestDir and m_NearestDir2 will be interpolated |