POV-Ray : Newsgroups : povray.general : Preserving textures through CSG Server Time
31 Oct 2024 12:16:02 EDT (-0400)
  Preserving textures through CSG (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Rarius
Subject: Preserving textures through CSG
Date: 1 Oct 2005 15:50:45
Message: <433ee895@news.povray.org>
I am building a cutaway image of a machine, but I am having a problem with 
the textures. If I texture an object then intersect that object, the texture 
of the object is overwritten on those surfaces where the object is cut... 
For example:

difference
{
    cylinder
    {
        <-10, 0, 0>
        <10, 0, 0>
        1
        pigment{colour Red}
    }
    plane{y, 0}
}

I get half a red cylinder, but the part where the plane cuts the sphere is 
the default texture...

I thought there was something like a "preserve_textures" modifier, but I 
can't find anything like that in the help. Can anyone suggest what the 
modifier might be?

BTW doing the cutaway to each element of the machine before texturing is not 
an option. It is just too complex and I rotate/translate a lot of parts 
after texturing!

Rarius


Post a reply to this message

From: Rarius
Subject: Re: Preserving textures through CSG
Date: 1 Oct 2005 16:00:03
Message: <433eeac3@news.povray.org>
OK.. I found it... I needed to use "cutaway_textures"... Unfortunately I am 
still getting exactly the same behaviour! The intersection is still taking 
the default texture! Is there a bug in v3.6?

Rarius

"Rarius" <rar### [at] rariuscouk> wrote in message 
news:433ee895@news.povray.org...
>I am building a cutaway image of a machine, but I am having a problem with 
>the textures. If I texture an object then intersect that object, the 
>texture of the object is overwritten on those surfaces where the object is 
>cut...


Post a reply to this message

From: Ger
Subject: Re: Preserving textures through CSG
Date: 1 Oct 2005 16:04:44
Message: <433eebdb@news.povray.org>
Rarius wrote:

> I am building a cutaway image of a machine, but I am having a problem with
> the textures. If I texture an object then intersect that object, the
> texture of the object is overwritten on those surfaces where the object is
> cut... For example:
> 
> difference
> {
>     cylinder
>     {
>         <-10, 0, 0>
>         <10, 0, 0>
>         1
>         pigment{colour Red}
>     }
>     plane{y, 0}
> }
> 
> I get half a red cylinder, but the part where the plane cuts the sphere is
> the default texture...
> 
> I thought there was something like a "preserve_textures" modifier, but I
> can't find anything like that in the help. Can anyone suggest what the
> modifier might be?
> 
> BTW doing the cutaway to each element of the machine before texturing is
> not an option. It is just too complex and I rotate/translate a lot of
> parts after texturing!
> 
> Rarius

> 
difference
{
    cylinder
    {
        <-10, 0, 0>
         <10, 0, 0>
        1
    }
    plane{y, 0}
    pigment{colour Red}
}

This way the plane has the same texture as the cylinder.
-- 
Ger


Post a reply to this message

From: Rarius
Subject: Re: Preserving textures through CSG
Date: 1 Oct 2005 16:13:06
Message: <433eedd2@news.povray.org>
Thanks for the suggestion Ger, but as I said I can't do that.. The machine 
is too complex, with too many textures...

Rarius

"Ger" <No.### [at] ThankYou> wrote in message news:433eebdb@news.povray.org...
> Rarius wrote:
>
>> I am building a cutaway image of a machine, but I am having a problem 
>> with
>> the textures. If I texture an object then intersect that object, the
>> texture of the object is overwritten on those surfaces where the object 
>> is
>> cut... For example:
>>
>> difference
>> {
>>     cylinder
>>     {
>>         <-10, 0, 0>
>>         <10, 0, 0>
>>         1
>>         pigment{colour Red}
>>     }
>>     plane{y, 0}
>> }
>>
>> I get half a red cylinder, but the part where the plane cuts the sphere 
>> is
>> the default texture...
>>
>> I thought there was something like a "preserve_textures" modifier, but I
>> can't find anything like that in the help. Can anyone suggest what the
>> modifier might be?
>>
>> BTW doing the cutaway to each element of the machine before texturing is
>> not an option. It is just too complex and I rotate/translate a lot of
>> parts after texturing!
>>
>> Rarius
>
>>
> difference
> {
>    cylinder
>    {
>        <-10, 0, 0>
>         <10, 0, 0>
>        1
>    }
>    plane{y, 0}
>    pigment{colour Red}
> }
>
> This way the plane has the same texture as the cylinder.
> -- 
> Ger


Post a reply to this message

From: Michael Raiford
Subject: Re: Preserving textures through CSG
Date: 1 Oct 2005 18:06:32
Message: <433f0868$1@news.povray.org>
Rarius wrote:
> Thanks for the suggestion Ger, but as I said I can't do that.. The machine 
> is too complex, with too many textures...
> 
> Rarius
> 
> "Ger" <No.### [at] ThankYou> wrote in message news:433eebdb@news.povray.org...
> 
>>Rarius wrote:
>>
>>
>>>I am building a cutaway image of a machine, but I am having a problem 
>>>with
>>>the textures. If I texture an object then intersect that object, the
>>>texture of the object is overwritten on those surfaces where the object 
>>>is
>>>cut... For example:
>>>
>>>difference
>>>{
>>>    cylinder
>>>    {
>>>        <-10, 0, 0>
>>>        <10, 0, 0>
>>>        1
>>>        pigment{colour Red}
>>>    }
>>>    plane{y, 0}
>>>}
>>>
>>>I get half a red cylinder, but the part where the plane cuts the sphere 
>>>is
>>>the default texture...
>>>
>>>I thought there was something like a "preserve_textures" modifier, but I
>>>can't find anything like that in the help. Can anyone suggest what the
>>>modifier might be?
>>>
>>>BTW doing the cutaway to each element of the machine before texturing is
>>>not an option. It is just too complex and I rotate/translate a lot of
>>>parts after texturing!
>>>
>>>Rarius
>>
>>difference
>>{
>>   cylinder
>>   {
>>       <-10, 0, 0>
>>        <10, 0, 0>
>>       1
>>   }
>>   plane{y, 0}
>>   pigment{colour Red}
>>}
>>
>>This way the plane has the same texture as the cylinder.
>>-- 
>>Ger 
> 
> 
> 


Something like this:

difference
{
    cylinder
    {
        <-10, 0, 0>
         <10, 0, 0>
        1
        pigment{colour Red}
    }
    plane{y, 0
	pigment { color Green }
    }
}


Post a reply to this message

From: Rarius
Subject: Re: Preserving textures through CSG
Date: 1 Oct 2005 19:02:56
Message: <433f15a0$1@news.povray.org>
You aren't understanding what I need to do... Here is a better example...

difference
{
    union
    {
        cylinder{-x, y, 1 pigment{Red}}
        cylinder{x, -y, 1 pigment{Yellow}}
    }
    plane{-y, 0}
    cutaway_textures
}

This works fine, but I have actually found out that my problem is that 
instead of a simple plane, I was trying to cut the object with an 
intersection as follows:

difference
{
    union
    {
        cylinder{-x, y, 1 pigment{Red}}
        cylinder{x, -y, 1 pigment{Yellow}}
    }
    intersection
    {
        plane{-y, 0}
        plane{-y, 0 rotate<60, 0, 0>}
    }
    cutaway_textures
}

Rarius


Post a reply to this message

From: Mike Williams
Subject: Re: Preserving textures through CSG
Date: 2 Oct 2005 02:31:56
Message: <ygav3TAp33PDFwa6@econym.demon.co.uk>
Wasn't it Rarius who wrote:
>This works fine, but I have actually found out that my problem is that 
>instead of a simple plane, I was trying to cut the object with an 
>intersection as follows:
>
>difference
>{
>    union
>    {
>        cylinder{-x, y, 1 pigment{Red}}
>        cylinder{x, -y, 1 pigment{Yellow}}
>    }
>    intersection
>    {
>        plane{-y, 0}
>        plane{-y, 0 rotate<60, 0, 0>}
>    }
>    cutaway_textures
>}

It looks like cutaway_textures doesn't work if the cutting object itself
is compound. Is this a bug?

If your cutting object is an intersection, you can work round it like
this:

#declare Thing = union
{
   cylinder{-x, y, 1 pigment{Red}}
   cylinder{x, -y, 1 pigment{Yellow}}
}

union {
  difference {
    object {Thing}
    plane{-y, 0}
    cutaway_textures
  }
  difference {
    object {Thing}
    plane{-y, 0 rotate<60, 0, 0>}
    cutaway_textures
  }
}


Or if the cutting object is a union or merge, rather than an
intersection, do this:

#declare Thing = union
{
   cylinder{-x, y, 1 pigment{Red}}
   cylinder{x, -y, 1 pigment{Yellow}}
}

union {
  difference {
    object {Thing}
    plane{-y, 0}
    plane{-y, 0 rotate<60, 0, 0>}
    cutaway_textures
  }
}


If the cutting object is a difference, use the same method as for
intersection but add "inverse" to the second object.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Slime
Subject: Re: Preserving textures through CSG
Date: 2 Oct 2005 03:35:50
Message: <433f8dd6$1@news.povray.org>
> union {
>   difference {
>     object {Thing}
>     plane{-y, 0}
>     cutaway_textures
>   }
>   difference {
>     object {Thing}
>     plane{-y, 0 rotate<60, 0, 0>}
>     cutaway_textures
>   }
> }


I don't think that would have the desired effect in some cases. Here's what
I would do:

#declare cutpart = intersection
{
    plane{-y, 0}
    plane{-y, 0 rotate<60, 0, 0>}
}

union
{
    difference {
        cylinder{-x, y, 1}
        object {cutpart}
        pigment{Red}
    }
     difference {
        cylinder{x, -y, 1}
        object {cutpart}
        pigment{Yellow}
    }
}

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Rarius
Subject: Re: Preserving textures through CSG
Date: 2 Oct 2005 06:29:45
Message: <433fb699$1@news.povray.org>
As I said in my original post... My main object is too complex, with too 
many textures to difference each part seperately.

As Mike said, it appears that cutout_textures acts very strangely if the 
second part of the difference or intersection is a compound object... 
sometimes it works sometimes it doesn't!

Rarius

> I don't think that would have the desired effect in some cases. Here's 
> what
> I would do:
>
> #declare cutpart = intersection
> {
>    plane{-y, 0}
>    plane{-y, 0 rotate<60, 0, 0>}
> }
>
> union
> {
>    difference {
>        cylinder{-x, y, 1}
>        object {cutpart}
>        pigment{Red}
>    }
>     difference {
>        cylinder{x, -y, 1}
>        object {cutpart}
>        pigment{Yellow}
>    }
> }
>
> - Slime
> [ http://www.slimeland.com/ ]
>
>


Post a reply to this message

From: Mike Williams
Subject: Re: Preserving textures through CSG
Date: 2 Oct 2005 15:58:34
Message: <rEJpOHAYrDQDFwjT@econym.demon.co.uk>
Wasn't it Rarius who wrote:
>As I said in my original post... My main object is too complex, with too 
>many textures to difference each part seperately.
>
>As Mike said, it appears that cutout_textures acts very strangely if the 
>second part of the difference or intersection is a compound object... 
>sometimes it works sometimes it doesn't!

So, does my method work with your complex main object?

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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