|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In one scene I'm working on, I need to sample data from discrete points using
trace(). From this, I'm currently generating a heightfield-like mesh.
Now I want to add some "ground fog"-like effect that follows the contours of
this height field.
I tried with a pigment based on a function that takes the values from an array,
but it seems that accessing an array from within functions is not possible (or
I'm doing something wrong).
Another idea would be to do an orthographic shot of the heightfield mesh with a
gradient pattern to convert it into a heightfield image; however, I would
prefer to avoid the additional rendering step.
Any smart idea how to accomplish this?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"clipka" <nomail@nomail> wrote in message
news:web.49b6a2f11a97d4f7f708085d0@news.povray.org...
> In one scene I'm working on, I need to sample data from discrete points
> using
> trace(). From this, I'm currently generating a heightfield-like mesh.
>
> Now I want to add some "ground fog"-like effect that follows the contours
> of
> this height field.
>
> I tried with a pigment based on a function that takes the values from an
> array,
> but it seems that accessing an array from within functions is not possible
> (or
> I'm doing something wrong).
>
> Another idea would be to do an orthographic shot of the heightfield mesh
> with a
> gradient pattern to convert it into a heightfield image; however, I would
> prefer to avoid the additional rendering step.
>
> Any smart idea how to accomplish this?
>
Just thinking aloud really, but you might be able to get something like this
by taking a transparent copy of the mesh scaled down in Y relative to its
top extent and filled with fog-like media. This should give you thicker fog
in the deeper and lower parts of the mesh and thinner fog over the ridges,
but would follow the contours of your mesh. You could even translate a
little in X or Z to give thicker fog on the leeward side of the hill.
Regards,
Chris B.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"Chris B" <nom### [at] nomailcom> wrote:
> Just thinking aloud really, but you might be able to get something like this
> by taking a transparent copy of the mesh scaled down in Y relative to its
> top extent and filled with fog-like media. This should give you thicker fog
> in the deeper and lower parts of the mesh and thinner fog over the ridges,
> but would follow the contours of your mesh. You could even translate a
> little in X or Z to give thicker fog on the leeward side of the hill.
Unfortunately that's not really what I need; these are nice twists to it that I
might pick up indeed (so thanks for them), but the basic idea doesn't work: The
fog would have uniform density with a "hard" boundary, which would look awfully
unrealistic; what I need instead is a density gradient, warped to follow the
height field.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka wrote:
> Now I want to add some "ground fog"-like effect that follows the contours of
> this height field.
You could use multiple copies of your mesh (or a thin slice thereof),
each filled with constant fog but with lower constant density for those
copies which are located higher. How many copies you need depends on
the desired quality.
You could also try to use a second tracing macro to explicitely
build a function out of terribly nested "select"s without needing
array accesses but I suppose that is highly impractical ;)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I was thinking in a more simple way, to use a density media based on the
lowest altitude, but that does not really answer your question I am afraid.
Thomas
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka wrote:
> In one scene I'm working on, I need to sample data from discrete points using
> trace(). From this, I'm currently generating a heightfield-like mesh.
>
> Now I want to add some "ground fog"-like effect that follows the contours of
> this height field.
>
> I tried with a pigment based on a function that takes the values from an array,
> but it seems that accessing an array from within functions is not possible (or
> I'm doing something wrong).
>
> Another idea would be to do an orthographic shot of the heightfield mesh with a
> gradient pattern to convert it into a heightfield image; however, I would
> prefer to avoid the additional rendering step.
>
> Any smart idea how to accomplish this?
clipka,
At the risk of missing the point entirely and/or saying something
stupid, I present this code:
// begin code
#declare hfRes = <40,40>;
#declare hfPts = array[hfRes.x][hfRes.y];
#declare hp = function{pigment{crackle scale .25}}
// read from hp pigment function into array
#declare V=0;
#while(V<hfRes.y)
#declare U=0;
#while(U<hfRes.x)
#declare hfPts[U][V] = hp(U/hfRes.x,V/hfRes.y,0).x;
#declare U=U+1;
#end
#declare V=V+1;
#end
// read from array into a pigment
#declare hfHeight=
pigment{
pigment_pattern{planar translate y}
pigment_map{
#declare V=0;
#while(V<hfRes.y)
[V/hfRes.y
planar rotate z*90 translate x
color_map{
#declare U=0;
#while(U<hfRes.x)
[U/hfRes.x
rgb hfPts[U][V]
]
#declare U=U+1;
#end
}
]
#declare V=V+1;
#end
}
}
// the pigment as a function
#declare hfF_Height=
function{
pattern{
pigment_pattern{hfHeight rotate x*90}
}
}
// height_field transforms
#declare hfTransform=
transform{
translate-(x+z)/2
scale<10,2,10>
rotate y*33
}
// height_field
height_field{
function hfRes.x, hfRes.y{
pigment{
hfHeight
scale<1,-1,1> translate y
}
}
pigment{rgb x}
transform{hfTransform}
}
// the base pattern for the fog
#declare fogPlane=function{pattern{planar}}
// the fog box
box{0,1
pigment{rgbt 1}
interior{
media{
//emission 1
//absorption 1
scattering{5,1}
density{
// base fog pattern is elevated with function pattern
function{
#declare offsX=1/hfRes.x;
#declare offsY=1/hfRes.y;
fogPlane(x,y-hfF_Height(x,0,z),z)
}
color_map{[.75 rgb 0][1 rgb 1]}
}
}
}
hollow
transform{hfTransform}
}
// end code
Basically it writes pigment values into an array, and then write values
from that array into an array-like pigment. It's not much different from
that SSS code I posted a while back. The resulting pigment is then used
to deform a function density within a box. It's not perfect, but may
suit your needs.
This code doesn't do the work of tracing the height_field, but since
you're a smart guy you can make the necessary changes :)
I hope this helps!
Sam
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
stbenge <^@hotmail.com> wrote:
> At the risk of missing the point entirely and/or saying something
> stupid, I present this code:
You're *not* missing the point; in fact, from a quick glance at the code this
one seems to perfectly hit the mark:
> // read from array into a pigment
> #declare hfHeight=
> pigment{
> pigment_pattern{planar translate y}
> pigment_map{
> #declare V=0;
> #while(V<hfRes.y)
> [V/hfRes.y
> planar rotate z*90 translate x
> color_map{
> #declare U=0;
> #while(U<hfRes.x)
> [U/hfRes.x
> rgb hfPts[U][V]
> ]
> #declare U=U+1;
> #end
> }
> ]
> #declare V=V+1;
> #end
> }
> }
Asked for a smart solution - got one as it seems; thanks a lot!
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka wrote:
> stbenge <^@hotmail.com> wrote:
>> At the risk of missing the point entirely and/or saying something
>> stupid, I present this code:
>
> You're *not* missing the point; in fact, from a quick glance at the code this
> one seems to perfectly hit the mark:
>
>> // read from array into a pigment
It's the best way I know. An in-POV-editable df3 pattern would be
better, if such a thing existed.
> Asked for a smart solution - got one as it seems; thanks a lot!
I usually try to help - don't always succeed; you're welcome! ;)
Sam
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
stbenge <^@hotmail.com> wrote:
> It's the best way I know. An in-POV-editable df3 pattern would be
> better, if such a thing existed.
Yeah. Or a way to #write binary data to create a df3 file "on the fly"...
BTW, do you happen to have an equally smart solution for cases where sample
points are not distributed evenly?
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka wrote:
> stbenge <^@hotmail.com> wrote:
>> It's the best way I know. An in-POV-editable df3 pattern would be
>> better, if such a thing existed.
>
> Yeah. Or a way to #write binary data to create a df3 file "on the fly"...
>
> BTW, do you happen to have an equally smart solution for cases where sample
> points are not distributed evenly?
No, I'm afraid not. But maybe a Voronoi diagram can used somehow...
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |