I want to be able to render objects such as clouds,
in which each of its parts have varying amounts
of quite fine-grained transparency.
In terms of rendering such an artifact in
"OpenGL" (I'm only concerned at this point with
how it might be rendered, rather than the -
probably quite complex - generation algorithm,
which I'll leave for later inspiration :-): from
what I've seen of "glFog" and friends, the types
of fog involved seem to be far too coarse-
grained for such a situation, so I thought perhaps
"glBendFunc" might better suit my purposes but,
being a relative newcomer to "OpenGL", I don't
have much idea of the context in which to call it
(in terms of, say, sample code)
I was thinking, at this stage, that I might
intersperse calls to "glVertex" (to specify the
location within the cloud) and "glBlendFunc"
(to specify the density of the cloud at that
location ...
Could someone please tell me if I'm barking up
the wrong tree, perhaps with a bit of sample
code showing how this might be otherwise
correctly done?
Thanks,
Russell
|
|
0
|
|
|
|
Reply
|
Russell
|
9/29/2007 1:18:23 AM |
|
On 2007-09-29, Russell Potter <"russellpotter AT optusnet DOT com DOT
au"> wrote:
>
> I want to be able to render objects such as clouds,
> in which each of its parts have varying amounts
> of quite fine-grained transparency.
Cloud rendering is a very involved topic, and open to research.
You will find that it's especially difficult to render conveincing
clouds, especially with the polygon rasterization algorithm, used in
realtime graphics, and employed by OpenGL.
Simplest is the rendering of distant clouds as seen from the ground,
for which, texturing sky-domes with photographs of real clouds can be
realistic enough for most applications.
Otherwise, I'd start by looking into volume rendering (which is mostly
done with ray tracing, but can be approximated with OpenGL).
> what I've seen of "glFog" and friends, the types
> of fog involved seem to be far too coarse-
glFog is not anywhere near what you want. It just adjusts the color of
the vertices, as a function of distance from the viewer.
> I was thinking, at this stage, that I might
> intersperse calls to "glVertex" (to specify the
> location within the cloud) and "glBlendFunc"
> (to specify the density of the cloud at that
> location ...
To further refine that idea, look into "particle systems".
--
John Tsiombikas (Nuclear / Mindlapse)
http://nuclear.sdf-eu.org/
|
|
0
|
|
|
|
Reply
|
John
|
9/29/2007 2:20:29 AM
|
|
On Sep 29, 3:18 am, Russell Potter <"russellpotter AT optusnet DOT com
DOT au"> wrote:
> I want to be able to render objects such as clouds,
> in which each of its parts have varying amounts
> of quite fine-grained transparency.
>
> what I've seen of "glFog" and friends, the types
> of fog involved seem to be far too coarse-
> grained for such a situation
Yes, glFog is useless for this.
There's a lot of ways to simulate clouds, none are perfect.
Use google...
--
<\___/>
/ O O \
\_____/ FTB. Remove my socks for email address.
|
|
0
|
|
|
|
Reply
|
fungus
|
9/29/2007 6:26:13 AM
|
|
John,
> Cloud rendering is a very involved topic, and open to research.
> You will find that it's especially difficult to render conveincing
> clouds, especially with the polygon rasterization algorithm, used in
> realtime graphics, and employed by OpenGL.
As I wrote in my original posting, at this
stage I'm really only interested in the
mechanics of how/whether it's possible to
specify a level of fog within just a
particular volume, which is, I would
imagine, the most natural way to render
a cloud.
The geometrical arrangement of this fog
(that is, the shape of a realistic cloud)
was really a topic I was going to leave
for later research and analysis.
I was, however, thinking of doing this
stuff in real-time, so do you have any
pointers to further reading I should
perhaps be doing on "the polygon
rasterization algorithm" if that's a good
place place to start?
> Simplest is the rendering of distant clouds as seen from the ground,
> for which, texturing sky-domes with photographs of real clouds can be
> realistic enough for most applications.
But this image would, I can only presume,
remain totally static over time and
wouldn't be able to cope very well with
changes in viewer location ... I really
think that a rough approximation to a
real cloud's shape us all that's needed
for most situations, since I would think
that any good level of detail in clouds
is only necessary in those nearly overhead,
with vastly less detail required for more
distant clouds.
> Otherwise, I'd start by looking into volume rendering (which is mostly
> done with ray tracing, but can be approximated with OpenGL).
Mmm ..., I'd imagined that just raising the fog
levels here the cloud cloud is located and at the
appropriate altitude (which just simulates how
a real cloud is put together, after all) would
automatically generate some semblance of a
cloud's appearance, without having to manually
ray-trace anything ... unless I'm, once again,
barking up the wrong tree :-) ...
> glFog is not anywhere near what you want. It just adjusts the color of
> the vertices, as a function of distance from the viewer.
Yes, that's what I had thought unless, as I've
been asking, it's possible to raise the level of
fog within a restricted volume ...
>> I was thinking, at this stage, that I might
>> intersperse calls to "glVertex" (to specify the
>> location within the cloud) and "glBlendFunc"
>> (to specify the density of the cloud at that
>> location ...
>
> To further refine that idea, look into "particle systems".
So, from you reply I only presume that the above-
mentioned two commands *are* the right
approach to use but, in the above situation,
could you tell me the correct constants to use
for the two parameters to "glBlendFunc" to
generate the desired effect?
Thanks,
Russell
|
|
0
|
|
|
|
Reply
|
Russell
|
9/29/2007 7:48:49 AM
|
|
fungus,
> Yes, glFog is useless for this.
>
> There's a lot of ways to simulate clouds, none are perfect.
As I said in my original posting I
understand "glFog" isn't what I
was looking for, but what I
*really* want to know iswhether
it's possible to and, if so, how
to use "glFog" in a restricted
volume, or can this only be done
for the whole scene at once,
and whether "glBlendFunc" is at all
useful abs, id so, how it might be
used in thus situation...
> Use google...
>
I'm a bit confused: are you saying there
is a "Google clouds"-type application
with relevant formation on clouds, that
I should just try searching for cloud
information on "Google", or that
I should be looking to "Google Earth"
for a demonstration of cloud rendering?
Russell
|
|
0
|
|
|
|
Reply
|
Russell
|
9/29/2007 8:16:54 AM
|
|
On 2007-09-29, Russell Potter <"russellpotter AT optusnet DOT com DOT au"> wrote:
>
>> Cloud rendering is a very involved topic, and open to research.
>> You will find that it's especially difficult to render conveincing
>> clouds, especially with the polygon rasterization algorithm, used in
>> realtime graphics, and employed by OpenGL.
>
> As I wrote in my original posting, at this
> stage I'm really only interested in the
> mechanics of how/whether it's possible to
> specify a level of fog within just a
> particular volume, which is, I would
> imagine, the most natural way to render
> a cloud.
You can't you must really gain a better understanding of how OpenGL
operates. It doesn't do any magic, it just draws polygons. I won't
explain it here, get a good graphics book and the red book as well.
>> Simplest is the rendering of distant clouds as seen from the ground,
>> for which, texturing sky-domes with photographs of real clouds can be
>> realistic enough for most applications.
>
> But this image would, I can only presume,
> remain totally static over time and
> wouldn't be able to cope very well with
> changes in viewer location ... I really
> think that a rough approximation to a
> real cloud's shape us all that's needed
You might use procedural textures, even better calculate procedural
cloud textures in the pixel shader, to be able to make clouds that
change shape. However, it is extremely difficult, if at all possible, to
shade such clouds conviencingly, if that is needed.
>> glFog is not anywhere near what you want. It just adjusts the color of
>> the vertices, as a function of distance from the viewer.
>
> Yes, that's what I had thought unless, as I've
> been asking, it's possible to raise the level of
> fog within a restricted volume ...
As fungus said, you can't use glFog for rendering clouds, it doesn't
work that way.
>> To further refine that idea, look into "particle systems".
>
> So, from you reply I only presume that the above-
> mentioned two commands *are* the right
> approach to use but, in the above situation,
> could you tell me the correct constants to use
> for the two parameters to "glBlendFunc" to
> generate the desired effect?
It's not that simple... you might or might not use particle systems for
that. It wouldn't be my first choice, but it certainly is a choice. The
reason I mentioned the name is to make you have a closer look. It's not
something that is done with "appropriate parameters to glBlendFunc",
it's much more involved.
--
John Tsiombikas (Nuclear / Mindlapse)
http://nuclear.sdf-eu.org/
|
|
0
|
|
|
|
Reply
|
John
|
9/29/2007 8:21:26 AM
|
|
John,
> You can't you must really gain a better understanding of how OpenGL
> operates. It doesn't do any magic, it just draws polygons. I won't
> explain it here, get a good graphics book and the red book as well.
Believe it or not, I *do* have a *basic* understanding
of OpenGL's operation, but my reasoning in an additional
posting is that an implication of OpenGL documentation
such as the "Red Book" is that more functionality
is possible than just strictly that explicitly related
so, just because such documentation doesn't mention my
specific scenario doesn't mean it isn't possible
... As for the "Red Book" itself, having just had
a look at what it has to say on fog, I can say that it
really skims over the topic to such a degree as to not
shed any light at all ... :-)
The only reason I mention both "glFog" and
"glBlendFunc" at all is that they're about the only
two function the "Red Book" talks mentions in that
area.
> You might use procedural textures, even better calculate procedural
> cloud textures in the pixel shader, to be able to make clouds that
> change shape. However, it is extremely difficult, if at all possible, to
> shade such clouds conviencingly, if that is needed.
I'm a bit confused: you just earlier told me,
quite flatly, that what I wanted couldn't be
done, but now you're saying it *can* be done,
even if, in you're opinion, it'll be difficult:
but all I asked was *whether* it could be done,
*not* whether anyone thought it was so hard
to do that I should just throw in the towel
before I even start :-(
And perhaps at thus point I should mention
that I'm only in the planning stage of my
OpenGL application, and so only looking at
which OpenGL calls to make yo achieve my
desired ends: the exact details of
implementing the correct algorithms will
be rightly left to a much later stage
Well, either way, perhaps I should use such
a shader (whether pixel or procedural): but,
as I asked "fungus", how to I install such
a creature into my rendering pipe-line (if
that's the right terminology :-)?
> It's not that simple...
So you keep saying :-( ... but, as I keep
asking in turn, though seemingly to no
avail, even a smidgen of sample code on your
part to illustrate how it might *be* done
would go a long, long, way ...
> you might or might not use particle systems for
> that. It wouldn't be my first choice, but it certainly is a choice. The
> reason I mentioned the name is to make you have a closer look. It's not
> something that is done with "appropriate parameters to glBlendFunc",
> it's much more involved.
Well, the reason I pursued the
"glVertex/glBlendFunc" possibility
was that, when I originally brought
the subject up, you replied that I
should "pursue the idea" by
"looking into particle systems" -
implying, in my mind, anyway, that
I was on the right track - although
here the implication seems to be that
I'm not
Russell
|
|
0
|
|
|
|
Reply
|
Russell
|
9/29/2007 12:12:08 PM
|
|
Russell Potter <"russellpotter AT optusnet DOT com DOT au">
wrote:
>
> I want to be able to render objects such as clouds,
> in which each of its parts have varying amounts
> of quite fine-grained transparency.
One of the toughest subjects there is...
I think this thread on gamedev.net
<http://www.gamedev.net/community/forums/topic.asp?whichpage=2&pagesize=20&topic_id=86024>
is one of the best on that topic (it was a long time public,
since a few months you've got to have a gamedev.net login to
read it).
There are also some interesting links in that thread, that are
really worth reading, though you can easily spend 3 weeks in a
row doing so.
Wolfgang Draxinger
--
E-Mail address works, Jabber: hexarith@jabber.org, ICQ: 134682867
|
|
0
|
|
|
|
Reply
|
Wolfgang
|
9/29/2007 1:17:02 PM
|
|
On Sep 29, 10:16 am, Russell Potter <"russellpotter AT optusnet DOT
com DOT au"> wrote:
>
> > Use google...
>
> I'm a bit confused: are you saying there
> is a "Google clouds"-type application
> with relevant formation on clouds, that
> I should just try searching for cloud
> information on "Google", or that
> I should be looking to "Google Earth"
> for a demonstration of cloud rendering?
>
I mean you should go to google and type
"cloud rendering" into the little box.
--
<\___/>
/ O O \
\_____/ FTB. Remove my socks for email address.
|
|
0
|
|
|
|
Reply
|
fungus
|
9/29/2007 8:59:00 PM
|
|
On 2007-09-29, Russell Potter <"russellpotter AT optusnet DOT com DOT
au"> wrote:
>> It's not that simple...
>
> So you keep saying :-( ... but, as I keep
> asking in turn, though seemingly to no
> avail, even a smidgen of sample code on your
> part to illustrate how it might *be* done
> would go a long, long, way ...
I will not even try to teach you how to use OpenGL, or how to render
clouds through OpenGL, or write your program for you. I have better ways
to spend my time.
However, I've given you a fair number of hints and references to topics
that might help you, should you pursue them further. I told you to look
into volume rendering, and how it can be approximated with OpenGL. I
told you to look into procedural textures and about mapping them to a
skydome. And I even told you that your blended vertices idea is close to
what we call "particle systems" which is one way of approximating fuzzy
objects, and might be an idea to try. And most importantly I told you
that cloud rendering is a pretty open research topic, and thus you
should do well to study the relevant bibliography.
Now YOU have to take all these, and study them, and see what helps you
and what doesn't. Try searching in google for articles and tutorials,
try searching in the ACM digital library for SIGGRAPH papers, try
finding the terms we mentioned in wikipedia... but don't expect anyone
to do that for you and then write you a "sample code".
P.S. What you are trying to do *IS* difficult, that means there are many
ways to do it, with conflicting pros and cons. Noone knows exactly what
is right for your case, you must decide amongs the possibilities that we
here mentioned, or those that you find by searching around.
--
John Tsiombikas (Nuclear / Mindlapse)
http://nuclear.sdf-eu.org/
|
|
0
|
|
|
|
Reply
|
John
|
9/29/2007 9:05:16 PM
|
|
On Sep 29, 6:12 am, Russell Potter <"russellpotter AT optusnet DOT com
DOT au"> wrote:
> And perhaps at thus point I should mention
> that I'm only in the planning stage of my
> OpenGL application, and so only looking at
> which OpenGL calls to make yo achieve my
> desired ends: the exact details of
> implementing the correct algorithms will
> be rightly left to a much later stage
>
You have it pretty much backwards. Figure out what exactly you want
to accomplish, and the minor details of specific OpenGL calls will be
quickly apparent. Otherwise, it's like a builder trying to go nail
and screw shopping before he decides if he is building a house or a
boat. Cloud rendering has no right answer, so it's impossible to say
"just do XYZ." Do you need to viewer to be able to enter the clouds?
Can visible objects enter the clouds? How far will you be from the
clouds? Do you need to show animated cloud formation? Do the clouds
need to cast shadows? Do things need to be able to cast shadows on
the clouds? It's all very different if you are making a flight
simulator where you and your wingman can fly right into the clouds,
versus a first person shooter where you can only see clouds far above
you. And, that is different again from a space sim where you will
only ever see clouds from above. Do a little research on some of what
has already been published about clouds, smoke, and volume rendering
(there is a ton of stuff available for free if you just take a little
time to poke around!) and see what suits you. You may even find
something implimented in OpenGL that is just what you are after to use
as a guide for implimenting something similar.
> Well, either way, perhaps I should use such
> a shader (whether pixel or procedural): but,
> as I asked "fungus", how to I install such
> a creature into my rendering pipe-line (if
> that's the right terminology :-)?
>
All shaders are procedural. Again, there is a ton of stuff available
online that you can read. It'll be much more convenient for all of us
if you do so.
> > It's not that simple...
>
> So you keep saying :-( ... but, as I keep
> asking in turn, though seemingly to no
> avail, even a smidgen of sample code on your
> part to illustrate how it might *be* done
> would go a long, long, way ...
>
Honestly, a convenient smidgen of sample code probably wouldn't be
very useful to you.
> > you might or might not use particle systems for
> > that. It wouldn't be my first choice, but it certainly is a choice. The
> > reason I mentioned the name is to make you have a closer look. It's not
> > something that is done with "appropriate parameters to glBlendFunc",
> > it's much more involved.
>
> Well, the reason I pursued the
> "glVertex/glBlendFunc" possibility
> was that, when I originally brought
> the subject up, you replied that I
> should "pursue the idea" by
> "looking into particle systems" -
> implying, in my mind, anyway, that
> I was on the right track - although
> here the implication seems to be that
> I'm not
>
> Russell
I seriously considered spending a bunch of time writing up a few
potential strategies for cloud rendering, but seriously the very first
hit on googling for "cloud rendering" was a page with some lovely
sample images and links to articles and papers explaining how they
were made. Glancing at the next few hits, they also seem extremely
informative on the subject.
|
|
0
|
|
|
|
Reply
|
forkazoo
|
9/29/2007 9:50:02 PM
|
|
> As I wrote in my original posting, at this
> stage I'm really only interested in the
> mechanics of how/whether it's possible to
> specify a level of fog within just a
> particular volume, which is, I would
> imagine, the most natural way to render
> a cloud.
Look up volumetric fog.
> The geometrical arrangement of this fog
> (that is, the shape of a realistic cloud)
> was really a topic I was going to leave
> for later research and analysis.
Louds of stuff here:
http://www.vterrain.org/Atmosphere/Clouds/
--
Charles E Hardwidge
|
|
0
|
|
|
|
Reply
|
Charles
|
10/2/2007 8:33:45 AM
|
|
John,
I've just discovered the "glFogCoord"
command: do you think that would help
in my situation?
Russell
|
|
0
|
|
|
|
Reply
|
Russell
|
10/4/2007 10:40:25 PM
|
|
|
12 Replies
277 Views
(page loaded in 0.144 seconds)
|