|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD schrieb:
> OK, here's what I have:
> ...
> dv_Sqr(hf_function1(x - dv_D,y,z) + hf_function1(x + dv_D,y,z) -
> 2 * hf_function1(x,y,z))
> ...
> However, I get the error: "Parse Error: Expected '.', + found instead"
Sorry, I forgot that with that hf_function1 being a pigment function,
you'll need to evaluate a particular color component, so instead of
hf_function1(...)
you need to write:
hf_function1(...).grey
(or .red, .green or .blue, but if I'm not mistaken the height_field
object uses the combined grey value as well, so the same should be used
as the basis for the curvature computations.)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka wrote:
> Sorry, I forgot that with that hf_function1 being a pigment function,
> you'll need to evaluate a particular color component, so instead of
>
> hf_function1(...)
>
> you need to write:
>
> hf_function1(...).grey
>
> (or .red, .green or .blue, but if I'm not mistaken the height_field
> object uses the combined grey value as well, so the same should be used
> as the basis for the curvature computations.)
Thanks! However, all I see is black. Here are the relevant portions of
my scene.
-Mike
//START
#local hf_pigment1 = pigment
{
image_map {png "hf_big.png"}
rotate x * 180 // flipped
}
#local hf_function1 = function {pigment {hf_pigment1}}
#local dv_D = 1/1024;
#local dv_Sqr = function(x) {x * x}
#local dv_G = function(x,y,z)
{
sqrt
(
dv_Sqr(hf_function1(x - dv_D,y,z).gray + hf_function1(x +
dv_D,y,z).gray - 2 * hf_function1(x,y,z).gray)
+
dv_Sqr(hf_function1(x,y - dv_D,z).gray + hf_function1(x,y -
dv_D,z).gray - 2 * hf_function1(x,y,z).gray)
)
}
height_field
{
function 1024, 1024 {hf_function1(x,y,z).gray}
smooth
texture
{
pigment
{
function {dv_G(x,y,z)}
color_map
{
[0 rgb 0]
[1 rgb 1]
}
}
finish {ambient 1}
}
translate <-1/2,0,-1/2,>
}
//END
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD schrieb:
> Thanks! However, all I see is black. Here are the relevant portions of
> my scene.
Ah, yes... looks like I forgot that you need to multiply the sqrt() term
with the image's size again (and then scale to taste).
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD <mik### [at] gmailcom> wrote:
> Thanks! However, all I see is black. Here are the relevant portions of
> my scene.
>
> -Mike
>
> //START
> #local hf_pigment1 = pigment
> {
> image_map {png "hf_big.png"}
> rotate x * 180 // flipped
> }
> #local hf_function1 = function {pigment {hf_pigment1}}
>
> #local dv_D = 1/1024;
> #local dv_Sqr = function(x) {x * x}
> #local dv_G = function(x,y,z)
> {
> sqrt
> (
> dv_Sqr(hf_function1(x - dv_D,y,z).gray + hf_function1(x +
> dv_D,y,z).gray - 2 * hf_function1(x,y,z).gray)
> +
> dv_Sqr(hf_function1(x,y - dv_D,z).gray + hf_function1(x,y -
> dv_D,z).gray - 2 * hf_function1(x,y,z).gray)
> )
> }
The dy component is being subtracted twice, when it should be subtracted for one
value, then added.
#local dv_G = function(x,y,z)
{
1/dv_D *
sqrt
(
dv_Sqr( hf_function1(x - dv_D,y,z).gray
+ hf_function1(x + dv_D,y,z).gray
- 2 * hf_function1(x,y,z).gray )
+dv_Sqr( hf_function1(x,y - dv_D,z).gray
+ hf_function1(x,y + dv_D,z).gray
- 2 * hf_function1(x,y,z).gray )
)
}
Also, isn't that the first derivative (i.e. slope), not the second? The
function is roughly analogous to what you would want to do with, say, the
surface normal of the object (i.e. measure the normal's rate of change), or the
values that are returned from the slope pattern.
If you use this directly as a pigment, you should clip it between 0 and 1.
Personally, I would also probably rotate the image and evaluate in the xz plane
because it is easier for me to think of, but either way will work.
-Reactor
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Reactor wrote:
> Also, isn't that the first derivative (i.e. slope), not the second? The
> function is roughly analogous to what you would want to do with, say, the
> surface normal of the object (i.e. measure the normal's rate of change), or the
> values that are returned from the slope pattern.
>
> If you use this directly as a pigment, you should clip it between 0 and 1.
> Personally, I would also probably rotate the image and evaluate in the xz plane
> because it is easier for me to think of, but either way will work.
>
>
> -Reactor
There are unfortunately some weird striations in the resulting image:
http://i421.photobucket.com/albums/pp292/SharkD2161/Support/hf_striations.png
At least I can *see* something. :)
-Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD schrieb:
> There are unfortunately some weird striations in the resulting image:
>
> http://i421.photobucket.com/albums/pp292/SharkD2161/Support/hf_striations.png
The factor to multiply the sqrt() term with is obviously too high,
leading to the banded pattern.
In addition, it appears to me that your input file is suffering from
JPEG artifacts, causing those regular-spaced vertical stripes.
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
SharkD <mik### [at] gmailcom> wrote:
> Reactor wrote:
> > Also, isn't that the first derivative (i.e. slope), not the second? The
> > function is roughly analogous to what you would want to do with, say, the
> > surface normal of the object (i.e. measure the normal's rate of change), or the
> > values that are returned from the slope pattern.
> >
> > If you use this directly as a pigment, you should clip it between 0 and 1.
> > Personally, I would also probably rotate the image and evaluate in the xz plane
> > because it is easier for me to think of, but either way will work.
> >
> >
> > -Reactor
>
>
> There are unfortunately some weird striations in the resulting image:
>
> http://i421.photobucket.com/albums/pp292/SharkD2161/Support/hf_striations.png
>
> At least I can *see* something. :)
>
> -Mike
The striations are do to the values going outside of the 0...1 range. It can be
clipped using min() and max().
Are you using the change in slope to decide where to place objects? I've been
working on a macro for that, trying to get it to decide where to place rocks
for stream beds. It works ok, but I think it needs to average the normals in a
small radius for each point to get a more accurate test of concavity.
-Reactor
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
clipka wrote:
> In addition, it appears to me that your input file is suffering from
> JPEG artifacts, causing those regular-spaced vertical stripes.
Not JPEG artifacts, but artifacts from increasing the dimensions of a
low resolution heightfield. I thought L3DT had eliminated them, but it
didn't. Thanks.
-Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Reactor wrote:
> Are you using the change in slope to decide where to place objects? I've been
> working on a macro for that, trying to get it to decide where to place rocks
> for stream beds. It works ok, but I think it needs to average the normals in a
> small radius for each point to get a more accurate test of concavity.
>
> -Reactor
Sort of. I am rendering the image to act as a guide. Based on the guide
I place the objects manually in a separate application.
-Mike
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
> Please point me to the part where it describes POV SDL.
The derivative of a surface is really 2D, but here's the
x component. It's just the change in the slope (dx) with
the interval xstep. With an image it really isn't smooth up
close, so you need to make sure that the interval is large
enough to avoid the artefacts, and small enough to still
get an accurate slope.
camera {
orthographic
location <0,0,1>
look_at <0,0,0>
right 1*x
up 1*y
}
// input heightfield image
#declare fn1 = function {pigment {image_map {png "plasma3.png"}}};
// derivative
#declare xstep = 0.01;
#declare dx = function { (fn1(x,y,z).grey-fn1(x-xstep,y,z).grey) -
(fn1(x+xstep,y,z).grey-fn1(x,y,z).grey) };
// remap to drawable colors
#declare fcolor = function { select( dx(x,y,z)+0.5, 0,
select( dx(x,y,z)-0.5, dx(x,y,z)+0.5,1))};
box { // this box fits exactly in view
<-0.5, -0.5, 0>, <0.5, 0.5, 0>
texture {
pigment {
image_map {
function 200,200 {fcolor(x-0.5,y-0.5,z)}
}
}
}
}
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
|
|