POV-Ray : Newsgroups : povray.newusers : isosurfaces, textures and csg difference. Server Time
30 Jul 2024 12:31:56 EDT (-0400)
  isosurfaces, textures and csg difference. (Message 1 to 8 of 8)  
From: Bill Hails
Subject: isosurfaces, textures and csg difference.
Date: 30 May 2004 06:10:45
Message: <40b9b325@news.povray.org>
Hi.
I'm getting back into things after an enforced hiatus,
so here's a question.

I'm trying to use a perturbed isosurface to subtract some
damage (chips etc.) from some csg stonework.

The actual code is quite complex, but essentially I have:

difference {
    object { Stonework }
    isosurface {
        // isosurface cylinder + pigment function
    }
    texture { T }
}

The pigment function is the same as the pigment used by T.

The max_gradient is set so that there are no warnings,
however the common surface looks a *lot* darker than
the rest of the stonework (but not just black).

There is too much interdependant code to post that, but
I'll put a little pic on p.b.i to illustrate.

Hope someone can help.

-- 
Bill Hails
http://thyme.homelinux.net/


Post a reply to this message

From: Mike Williams
Subject: Re: isosurfaces, textures and csg difference.
Date: 30 May 2004 14:39:33
Message: <VUXJrDAbpiuAFwJm@econym.demon.co.uk>
Wasn't it Bill Hails who wrote:
>Hi.
>I'm getting back into things after an enforced hiatus,
>so here's a question.
>
>I'm trying to use a perturbed isosurface to subtract some
>damage (chips etc.) from some csg stonework.
>
>The actual code is quite complex, but essentially I have:
>
>difference {
>    object { Stonework }
>    isosurface {
>        // isosurface cylinder + pigment function
>    }
>    texture { T }
>}
>
>The pigment function is the same as the pigment used by T.
>
>The max_gradient is set so that there are no warnings,
>however the common surface looks a *lot* darker than
>the rest of the stonework (but not just black).
>
>There is too much interdependant code to post that, but
>I'll put a little pic on p.b.i to illustrate.
>
>Hope someone can help.

What value are you using for max_trace?

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Bill Hails
Subject: Re: isosurfaces, textures and csg difference.
Date: 31 May 2004 04:39:48
Message: <40baef53@news.povray.org>
Mike Williams wrote:

> [...]
> 
> What value are you using for max_trace?
> 

hmm, thanks for the suggestion, it was at the default
but changing it to 20 made no difference.

First up what I'm actually trying to do is:

difference {
        object {
                StoneWork
                texture { T }
        }
        isosurface {
                // isocylinder + pigment fn of T
                texture { T1 }
        }
}

but this change makes no difference to the problem
and I was trying to simplify when I posted.

I have a few observations though.

1. Switch to radiosity without conventional lighting
and the problem more or less disappears.

2. Swap in a simple cylinder for the isosurface and
the problem also goes away.

3. However, drop the intensity if the pigment fn
perturbing the isosurface cylinder to zero (so it's
a simple isosurface cylinder) and the problem persists.

if it helps, here's my code for the isosurface cylinder
(vim syntax highlighting converted to html):

http://thyme.homelinux.net/IsoCylinder.html

I'm probably doing something stupid :-(

-- 
Bill Hails
http://thyme.homelinux.net/


Post a reply to this message

From: Mike Williams
Subject: Re: isosurfaces, textures and csg difference.
Date: 31 May 2004 13:48:07
Message: <9Bk8fIAX+2uAFwsY@econym.demon.co.uk>
Wasn't it Bill Hails who wrote:

>http://thyme.homelinux.net/IsoCylinder.html

One thing that immediately jumps out as being a bit dodgy is the fact
that

        (CyFn(x, y, z).gray - 0.5) * Intensity

can be negative for some points on some pigment patterns. At such points
the isosurface will be slightly larger than the specified Radius and can
cause a thin sliver of surface fall outside the contained_by box.

I can't quite see how that would cause exactly the effect that you
showed in the image you posted, but you  could try doing something like
this to force the box to be big enough to contain the bits that stand
proud of the surface

        #declare Box_Width = Radius + sqrt(Intensity*0.5);
        contained_by {
            box {
                <-Box_Width, 0, -Box_Width>,
                <Box_Width, Height, Box_Width>
            }
        }

Or, more simply, ensure that your surface fits inside the box by not
subtracting 0.5 from the pigment

        (CyFn(x, y, z).gray) * Intensity

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Mike Williams
Subject: Re: isosurfaces, textures and csg difference.
Date: 31 May 2004 13:57:08
Message: <FgrinPApH3uAFwZm@econym.demon.co.uk>
Wasn't it Bill Hails who wrote:
>Mike Williams wrote:
>
>> [...]
>> 
>> What value are you using for max_trace?
>> 
>
>hmm, thanks for the suggestion, it was at the default
>but changing it to 20 made no difference.
>
>if it helps, here's my code for the isosurface cylinder
>(vim syntax highlighting converted to html):
>
>http://thyme.homelinux.net/IsoCylinder.html

I assume that's the old version, since it has no Max_trace in the
isosurface{} block.

In my tests, that code wouldn't work at all in conjunction with
difference{} until I added either max_trace or all_intersections inside
the macro.

[You couldn't possibly be confusing max_trace with max_trace_level,
could you?]

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Bill Hails
Subject: Re: isosurfaces, textures and csg difference.
Date: 31 May 2004 15:23:20
Message: <40bb8628@news.povray.org>
Mike Williams wrote:

> Wasn't it Bill Hails who wrote:
>> [...]
> [You couldn't possibly be confusing max_trace with max_trace_level,
> could you?]
> 

Aagh, you're right :-). I hadn't even heard of
max_trace. I'll read up and try again.

-- 
Bill Hails
http://thyme.homelinux.net/


Post a reply to this message

From: Bill Hails
Subject: Re: isosurfaces, textures and csg difference.
Date: 31 May 2004 15:27:30
Message: <40bb8722@news.povray.org>
Mike Williams wrote:

> Wasn't it Bill Hails who wrote:
> 
>>http://thyme.homelinux.net/IsoCylinder.html
> 
> One thing that immediately jumps out as being a bit dodgy is the fact
> that
> 
>         (CyFn(x, y, z).gray - 0.5) * Intensity
> 
> can be negative for some points on some pigment patterns. At such points
> the isosurface will be slightly larger than the specified Radius and can
> cause a thin sliver of surface fall outside the contained_by box.
> 
> I can't quite see how that would cause exactly the effect that you
> showed in the image you posted, but you  could try doing something like
> this to force the box to be big enough to contain the bits that stand
> proud of the surface
> 
>         #declare Box_Width = Radius + sqrt(Intensity*0.5);
>         contained_by {
>             box {
>                 <-Box_Width, 0, -Box_Width>,
>                 <Box_Width, Height, Box_Width>
>             }
>         }
> 
> Or, more simply, ensure that your surface fits inside the box by not
> subtracting 0.5 from the pigment
> 
>         (CyFn(x, y, z).gray) * Intensity
> 

You're right as usual. I was subtracting 0.5 so that the "average"
surface would be coincident with the unperturbed cylinder. I'll
increase the box dimensions.

-- 
Bill Hails
http://thyme.homelinux.net/


Post a reply to this message

From: Bill Hails
Subject: Re: isosurfaces, textures and csg difference.
Date: 31 May 2004 16:13:07
Message: <40bb91d3@news.povray.org>
Bill Hails wrote:

> Mike Williams wrote:
> 
>> Wasn't it Bill Hails who wrote:
>>> [...]
>> [You couldn't possibly be confusing max_trace with max_trace_level,
>> could you?]
>> 
> 
> Aagh, you're right :-). I hadn't even heard of
> max_trace. I'll read up and try again.
> 

Thanks a million Mike!

all_intersections fixed it. I've increased the
box size as per your suggestion too, and it's
looking good.

-- 
Bill Hails
http://thyme.homelinux.net/


Post a reply to this message

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