density function
I''m trying to program a little visualisation tool for atoms/molecules in opengl.
The electron orbitals are my biggest problem.
I want to visualize the outer electrons with their density function.
This means I have to make fog with altering density.
My first attempt was generating a lot of little white cubes and adjusting their alpha-values by the density function,but this is to slow.
Does anyone know a better way to generate a fog with altering density?
December 21, 2001 05:26 PM
Too slow? What do you mean? How exactly did you do it?
You can also do glcolor4f(r,g,b,A) where A could be the value of what you need.
Or are you using blending, and or multitexture or multi-pass rendering?
You can also do glcolor4f(r,g,b,A) where A could be the value of what you need.
Or are you using blending, and or multitexture or multi-pass rendering?
First of all : I''m new to 3D-programming (I started this month reading the nehe-tutorials).
I used blending and about 8000 cubes per orbital (20^3). (still looks a bit blocky while rotating)
Adjusting transparency of the cubes was done with glColor4f(..., alpha-value derived from density function).
I think I can optmize math a lot with precalculations. But I hope there is a better way to do this than with thousands of cubes.
When I have the time to clean up my sourcecode I will post it ... if anyone wants to have a look at it.
I used blending and about 8000 cubes per orbital (20^3). (still looks a bit blocky while rotating)
Adjusting transparency of the cubes was done with glColor4f(..., alpha-value derived from density function).
I think I can optmize math a lot with precalculations. But I hope there is a better way to do this than with thousands of cubes.
When I have the time to clean up my sourcecode I will post it ... if anyone wants to have a look at it.
Don't know if this would work, but how about taking a flat colour texture large enough to cover your atom and writing to the alpha channel pixel by pixel based on the density function. For example: Taking vectors x and y across and down the screen, go pixel by pixel, averaging the values of the density function along the z direction and write that value to the alpha channel of the texture. Then all you need to do is display the texture over the top of the atom.
Note - this isn't something I've ever tried - please let me know if it works/helps in any way.
Enigma
------
...represent a Jesus that never existed. ...
Edited by - Enigma on December 22, 2001 7:46:14 AM
Note - this isn't something I've ever tried - please let me know if it works/helps in any way.
Enigma
------
...represent a Jesus that never existed. ...
Edited by - Enigma on December 22, 2001 7:46:14 AM
Sounds good to me...
I would have to do a perspective-correct walkthrough (not just along z-axis), but once generated for some view-angles, it should be pretty fast even on larger molecules.
It will take some time till I have the opportunity to try it out .. (xmas and the family stuff) but I will let you know how it works.
thanks
I would have to do a perspective-correct walkthrough (not just along z-axis), but once generated for some view-angles, it should be pretty fast even on larger molecules.
It will take some time till I have the opportunity to try it out .. (xmas and the family stuff) but I will let you know how it works.
thanks
Just thought of something (you may already have realised this). Instead of averaging the density function along the Z-axis, you need to multiply their inverses and then invert that again. I.e. if you sample three positions in the density function and find densities of 0.9, 0.1 and 0.1, then the alpha value of that pixel should be 1 - ((1 - 0.9) * (1 - 0.1) * (1 - 0.1)) = 0.919, instead of (0.9 + 0.1 + 0.1) / 3 = 0.367 to 3 d.p.
Enigma
------
...only my use, or use what God has...
Enigma
------
...only my use, or use what God has...
Hmm, I was thinking of some kind of integral or sum.
I didn''t think of how I was going to build it.
You are right, I think the alpha-value or density function value( for example 0.9 = 90%) is extinction and the other one transmission (1-0.9 = 10%).
Anyway ..
I''m looking forward to try it out ... (when I''m back at home and my equipment)
I didn''t think of how I was going to build it.
You are right, I think the alpha-value or density function value( for example 0.9 = 90%) is extinction and the other one transmission (1-0.9 = 10%).
Anyway ..
I''m looking forward to try it out ... (when I''m back at home and my equipment)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement