Hello!
I would be very grateful if someone could help me I am a newbie at this so I need help T_T
My aim is to create solar flares in opengl. Since the sun is made of gas and there is a differential rotation that depends on
particle’s position, I used an equation in order to create a sphere with them!I gave different velocities to them… and the
next step is colouring the particles! I wish to give to them this kind of effect:
So, my question is: How to give that? I mean the vivid colours, luminosity,… it is a very cool effect so I want to learn it.
You can give me just the name of the effect … just what I have to apply.
Do you mean changing the intensity of the assigned components rgb depending on the age of the particle??? I thought that the age of a particle should be assigned just in case it has a life time… in my case,it is needed for flares but not for sun surface. However, thank you for opening up my mind I will try an age for
the sphere too… I hope to do a good job:) Thank you again!
Don’t mind about the uglyness of the product… I am still working on it lol BUT, I cannot understand why , when I use a texture to color my rays in a good way, I got the black borders… why?! What should I do? Can you help me?
Looks like you’re pretty close to what you want. As ZbuffeR said, it’s just a matter of setting up transparency correctly.
The code below shows you how I do it. ‘bug’ is a visual debugging flag I use when my particle system isn’t working the way I want it to. When ‘bug’ is TRUE, I turn off blending so I can see the edges of the quads I’m texturing on. I also put a blue, wireframe edge on each quad to clearly show it’s size and orientation. The Blendfunc statement is what turns transparency on correctly. The image I’m using is simply a white star that fades to black towards the edges. It’s a .bmp file without an alpha channel.
//---+----3----+----2----+----1----+---><---+----1----+----2----+----3----+----4
//---------------------------- Draw_Particles ------------------------------
void Draw_Particles (short update, float skale, int mission, short bug)
{
int p, particles;
glDisable (GL_LIGHTING);
glEnable (GL_DEPTH_TEST);
glEnable (GL_TEXTURE_2D);
glBlendFunc (GL_SRC_ALPHA, GL_ONE);
if (bug) glDisable (GL_BLEND);
else glEnable (GL_BLEND);
particles = skale * MAX_PARTICLES;
if (skale > 1.0) {
BELL
printf (" Draw_Particles: skale = %.2f
", skale);
STOP
}
for (p = 0; p < particles; ++p) {
Thrusta[p].Draw (update, skale, mission, bug);
}
glDisable (GL_BLEND);
glDisable (GL_TEXTURE_2D);
}
The screen grabs below show my particle system with blending off and on.
With blending off, my scene looks a lot like yours, except that I have much
more overlap between my quads (and I put blue edges on each quad).
Yet in my particle system (above), it doesn’t seem to make a difference whether or not depth testing is enabled. The rocket flame looks the same either way. However the flame is incorrectly drawn relative to the rocket body if depth testing is disabled.
If I remember correctly you have to enable depth test, set z-buffer as read-only and set glDepthFunc(GL_LEQUAL) to avoid z-fighting between particles
Also you may consider doing some kind of billboarding to every particle, to make it look better when the camera moves.
Your sun’s surface looks pretty good except at the edges.
The edge looks too perfect, too hard, as if you put a red circle behind the sun.
The flares need some structure to them.
You’re trying to do something fairly difficult, particularly the flares. If your goal is to get something similar to the original picture you posted, I wouldn’t know where to start. I still think your solar surface is pretty good, though in the last picture the flares (or rays) have messed it up a bit. You might not be able to get those thin filaments making up solar flares with the particle system approach you’re using because the individual particles are too big. I’m guessing that CGI professionals would use a volumetric rendering approach to do the flares.
Yeah… I know … I didn’t notice the difficul at the start … even because my laptop is not that powerful… so it cannot deal with a large amount of particles… My surface + rays are very heavy I think I will show to my teacher just something like this :