POV-Ray : Newsgroups : povray.newusers : Height_field clipped_by a box Server Time
23 Nov 2024 17:45:11 EST (-0500)
  Height_field clipped_by a box (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: mathieu r
Subject: Height_field clipped_by a box
Date: 29 Aug 2012 04:35:00
Message: <web.503dd37771e7393e270882f00@news.povray.org>
Hi,

Me again..
Sorry if I post a lot..

I wanted to clip a height_field by a box using clipped_by but it doesn't work

height_field {
        png
        "IN\dem.png"
        smooth
        texture{

        pigment {
        White
        }

        finish {
        ambient 0.1
        diffuse 0.55
        }  }

        clipped_by { box { <0,0,0>,<10,10,10 > }}

        translate <-0.5,0,-0.48>
        scale <14,4,14>
}

However, intersection works. Intersection isn't the best, I think, for that
purpose? clipped_by or bounding-by seems more convenient.



Mat


Post a reply to this message

From: clipka
Subject: Re: Height_field clipped_by a box
Date: 29 Aug 2012 06:20:22
Message: <503dece6$1@news.povray.org>
Am 29.08.2012 10:31, schrieb mathieu_r:
> Hi,
>
> Me again..
> Sorry if I post a lot..

That's what the newsgroups are there for :-)

> I wanted to clip a height_field by a box using clipped_by but it doesn't work

Can you be more specific about the "doesn't work" part?

The difference between intersection and clipped_by is that an 
intersection will generate new surfaces where the original object is cut 
apart, while clipped_by will let you look inside the object as if it was 
just a hollow shell.

> However, intersection works. Intersection isn't the best, I think, for that
> purpose?

If it works, it works.

> clipped_by or bounding-by seems more convenient.

Do /not/ use bounded_by for such purposes. It is intended solely as a 
hint for the renderer about how big (and where) a complicated object 
actually is, to speed up finding the object's surface. Any attempt to 
use it for shaping your object /will/ lead to unexpected results.


Post a reply to this message

From: mathieu r
Subject: Re: Height_field clipped_by a box
Date: 29 Aug 2012 09:10:01
Message: <web.503e1476c872e122270882f00@news.povray.org>
Ok, so Intersection seems the right way to do it.

I have another question:

I've intersected my height_field with my box. Ok but between my height_field and
the bottom of my box there is an empty gap. How to fill it? You know, like city
models

If possible with the same texture as the height_field object.


clipka <ano### [at] anonymousorg> wrote:
> Am 29.08.2012 10:31, schrieb mathieu_r:
> > Hi,
> >
> > Me again..
> > Sorry if I post a lot..
>
> That's what the newsgroups are there for :-)
>
> > I wanted to clip a height_field by a box using clipped_by but it doesn't work
>
> Can you be more specific about the "doesn't work" part?
>
> The difference between intersection and clipped_by is that an
> intersection will generate new surfaces where the original object is cut
> apart, while clipped_by will let you look inside the object as if it was
> just a hollow shell.
>
> > However, intersection works. Intersection isn't the best, I think, for that
> > purpose?
>
> If it works, it works.
>
> > clipped_by or bounding-by seems more convenient.
>
> Do /not/ use bounded_by for such purposes. It is intended solely as a
> hint for the renderer about how big (and where) a complicated object
> actually is, to speed up finding the object's surface. Any attempt to
> use it for shaping your object /will/ lead to unexpected results.


Post a reply to this message

From: clipka
Subject: Re: Height_field clipped_by a box
Date: 29 Aug 2012 11:28:53
Message: <503e3535$1@news.povray.org>
Am 29.08.2012 15:09, schrieb mathieu_r:
> Ok, so Intersection seems the right way to do it.
>
> I have another question:
>
> I've intersected my height_field with my box. Ok but between my height_field and
> the bottom of my box there is an empty gap. How to fill it? You know, like city
> models
>
> If possible with the same texture as the height_field object.

Intersect the height field with a slightly smaller box; i.e, instead of:

   height_field {
     ...
     texture { ... }
     translate ... scale ... rotate ...
   }

use the following:

   intersection {
     height_field { ... }
     box { <0.0001, 0.0001, 0.0001>, <0.9999, 1.0001, 0.9999> }
     texture { ... }
     translate ... scale ... rotate ...
   }

This works due to some inconsistency of the height_field object: 
Although it lacks a visible bottom and sides, it is nonetheless 
considered to be filling the entire space below the surface; so if you 
cut off its "non-sides" and "non-bottom", you'll get visible surfaces at 
the cuts.


Post a reply to this message

From: mathieu r
Subject: Re: Height_field clipped_by a box
Date: 30 Aug 2012 05:35:01
Message: <web.503f32c8c872e1222ebecedb0@news.povray.org>
Nice! Thanks. It works!

clipka <ano### [at] anonymousorg> wrote:
> Am 29.08.2012 15:09, schrieb mathieu_r:
> > Ok, so Intersection seems the right way to do it.
> >
> > I have another question:
> >
> > I've intersected my height_field with my box. Ok but between my height_field and
> > the bottom of my box there is an empty gap. How to fill it? You know, like city
> > models
> >
> > If possible with the same texture as the height_field object.
>
> Intersect the height field with a slightly smaller box; i.e, instead of:
>
>    height_field {
>      ...
>      texture { ... }
>      translate ... scale ... rotate ...
>    }
>
> use the following:
>
>    intersection {
>      height_field { ... }
>      box { <0.0001, 0.0001, 0.0001>, <0.9999, 1.0001, 0.9999> }
>      texture { ... }
>      translate ... scale ... rotate ...
>    }
>
> This works due to some inconsistency of the height_field object:
> Although it lacks a visible bottom and sides, it is nonetheless
> considered to be filling the entire space below the surface; so if you
> cut off its "non-sides" and "non-bottom", you'll get visible surfaces at
> the cuts.


Post a reply to this message

From: mathieu r
Subject: Re: Height_field clipped_by a box
Date: 31 Aug 2012 07:20:01
Message: <web.50409d54c872e122a7fd5a260@news.povray.org>
Sorry, I come back..

Actually, filling my object is easier than making it empty..

To make it empty, I tried to clip my height_object with a sphere with a value of
transmit equal to 1.

But I can still see the sphere contours even if they're smoothened.

Maybe I didn't use the transmit keyword the right way?


Here is the code:
intersection {
height_field {
        png
        "IN\PNG\dem.png"
        smooth

        texture{
        pigment {
        White
        }

        finish {
        ambient 0.1
        diffuse 0.55
        }
        }

        translate <-0.5,0,-0.48>
        scale <14,4,14>
}

sphere {
  <0, 1, 0>
  5
  pigment {
  White
  transmit 1
  }
  hollow on
}
}

"mathieu_r" <nomail@nomail> wrote:
> Nice! Thanks. It works!
>
> clipka <ano### [at] anonymousorg> wrote:
> > Am 29.08.2012 15:09, schrieb mathieu_r:
> > > Ok, so Intersection seems the right way to do it.
> > >
> > > I have another question:
> > >
> > > I've intersected my height_field with my box. Ok but between my height_field and
> > > the bottom of my box there is an empty gap. How to fill it? You know, like city
> > > models
> > >
> > > If possible with the same texture as the height_field object.
> >
> > Intersect the height field with a slightly smaller box; i.e, instead of:
> >
> >    height_field {
> >      ...
> >      texture { ... }
> >      translate ... scale ... rotate ...
> >    }
> >
> > use the following:
> >
> >    intersection {
> >      height_field { ... }
> >      box { <0.0001, 0.0001, 0.0001>, <0.9999, 1.0001, 0.9999> }
> >      texture { ... }
> >      translate ... scale ... rotate ...
> >    }
> >
> > This works due to some inconsistency of the height_field object:
> > Although it lacks a visible bottom and sides, it is nonetheless
> > considered to be filling the entire space below the surface; so if you
> > cut off its "non-sides" and "non-bottom", you'll get visible surfaces at
> > the cuts.


Post a reply to this message

From: clipka
Subject: Re: Height_field clipped_by a box
Date: 31 Aug 2012 16:18:10
Message: <50411c02$1@news.povray.org>
Am 31.08.2012 13:17, schrieb mathieu_r:
> Sorry, I come back..
>
> Actually, filling my object is easier than making it empty..
>
> To make it empty, I tried to clip my height_object with a sphere with a value of
> transmit equal to 1.

Why not simply use clipped_by for that purpose?

> But I can still see the sphere contours even if they're smoothened.

Try explicitly specifying the sphere's finish as "ambient 0 diffuse 0 
specular 0 phong 0 emission 0 reflection 0"; maybe some earlier 
"default" statement is setting one of these values to non-zero by default.


Post a reply to this message

From: Alain
Subject: Re: Height_field clipped_by a box
Date: 2 Sep 2012 14:23:09
Message: <5043a40d$1@news.povray.org>

> Hi,
>
> Me again..
> Sorry if I post a lot..
>
> I wanted to clip a height_field by a box using clipped_by but it doesn't work
>
> height_field {
>          png
>          "IN\dem.png"
>          smooth
>          texture{
>
>          pigment {
>          White
>          }
>
>          finish {
>          ambient 0.1
>          diffuse 0.55
>          }  }
>
>          clipped_by { box { <0,0,0>,<10,10,10 > }}
>
>          translate <-0.5,0,-0.48>
>          scale <14,4,14>
> }
>
> However, intersection works. Intersection isn't the best, I think, for that
> purpose? clipped_by or bounding-by seems more convenient.
>
>
>
> Mat
>
>
>
>
You clip your hight_field by a box that is 10 times to big.

You need to:
1 - make the box buch smaller.
OR
2 - Use your actual box AFTER you scale the hight_field, but before you 
move it. Also, adjust the translate by your scale.

scale <14,4,14>
clipped_by { box { <0,0,0>,<10,10,10 > }}
translate <-0.5,0,-0.48>*14


Post a reply to this message

From: Thomas de Groot
Subject: Re: Height_field clipped_by a box
Date: 3 Sep 2012 03:20:06
Message: <50445a26@news.povray.org>
On 2-9-2012 20:23, Alain wrote:

> You clip your hight_field by a box that is 10 times to big.
>
> You need to:
> 1 - make the box buch smaller.
> OR
> 2 - Use your actual box AFTER you scale the hight_field, but before you
> move it. Also, adjust the translate by your scale.
>
> scale <14,4,14>
> clipped_by { box { <0,0,0>,<10,10,10 > }}
> translate <-0.5,0,-0.48>*14
>
>
Expanding a bit on this (see also the corresponding Docs paragraphs):

- A height_field starts as a 1x1x1 object. If you use clipped_by 
/before/ scaling the height_field it should be smaller than the unit object.

- The order in which you perform the transformations is crucial and you 
should always think about them as operating from the origin. The basic 
order is /scale/ then /rotate/ then /translate/. Any other order will 
lead to (possibly) unexpected results. Example:

box {-1, 1 rotate 45*y translate 10*x} will show a box rotated 45 
degrees around the vertical axis and translated 10 units along the x-axis.

box {-1, 1 translate 10*x rotate 45*y} will rotate a box placed at 10 
units on the +x-axis, 45 degrees towards the -z-axis.

Thomas


Post a reply to this message

From: mathieu r
Subject: Re: Height_field clipped_by a box
Date: 3 Sep 2012 12:55:01
Message: <web.5044e0d3c872e12255f6125a0@news.povray.org>
Hi,

I didn't know all of these prerequisites, in particular the scale / transmate
order.

I think that clipka's right. I'll try his solution, that is setting ambient,
diffuse, specular, phong,... to 0

I'll try this out and let you know.

Thanks for all your advice!

Mat

Thomas de Groot <tho### [at] degrootorg> wrote:
> On 2-9-2012 20:23, Alain wrote:
>
> > You clip your hight_field by a box that is 10 times to big.
> >
> > You need to:
> > 1 - make the box buch smaller.
> > OR
> > 2 - Use your actual box AFTER you scale the hight_field, but before you
> > move it. Also, adjust the translate by your scale.
> >
> > scale <14,4,14>
> > clipped_by { box { <0,0,0>,<10,10,10 > }}
> > translate <-0.5,0,-0.48>*14
> >
> >
> Expanding a bit on this (see also the corresponding Docs paragraphs):
>
> - A height_field starts as a 1x1x1 object. If you use clipped_by
> /before/ scaling the height_field it should be smaller than the unit object.
>
> - The order in which you perform the transformations is crucial and you
> should always think about them as operating from the origin. The basic
> order is /scale/ then /rotate/ then /translate/. Any other order will
> lead to (possibly) unexpected results. Example:
>
> box {-1, 1 rotate 45*y translate 10*x} will show a box rotated 45
> degrees around the vertical axis and translated 10 units along the x-axis.
>
> box {-1, 1 translate 10*x rotate 45*y} will rotate a box placed at 10
> units on the +x-axis, 45 degrees towards the -z-axis.
>
> Thomas


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.