POV-Ray : Newsgroups : povray.newusers : Difference isn't working for me Server Time
1 Nov 2024 07:28:01 EDT (-0400)
  Difference isn't working for me (Message 1 to 5 of 5)  
From: Prodan
Subject: Difference isn't working for me
Date: 20 Feb 2006 11:35:01
Message: <web.43f9ee359c6b495eb3e251180@news.povray.org>
I can't get the difference function to work. Any ideas?
the code is:

 #include "colors.inc"
 camera {
    location <-3, 10, -50>
    look_at <5, 5, 0>
 }
 background{White}
 light_source { <-5, 10, 4> color White }
 light_source { <-3, 10, 5> color White }
 difference {
     box { <0, 0, 0>, <6, 53, 36> }
     box { <0, 0, 34>, <6, 51, 36> }
     box { <0, 0, -1>, <6, 49, 2> }
     box { <0, 0, -1>, <6, 47, 2> }
     box { <0, 0, -1>, <6, 45, 2> }
     box { <0, 0, -1>, <6, 43, 2> }
     box { <0, 0, -1>, <6, 41, 2> }
     box { <0, 0, -1>, <6, 39, 2> }
     box { <0, 0, -1>, <6, 37, 2> }
     box { <0, 0, -1>, <6, 35, 2> }
     box { <0, 0, -1>, <6, 33, 2> }
     box { <0, 0, -1>, <6, 31, 2> }
     box { <0, 0, -1>, <6, 29, 2> }
     box { <0, 0, -1>, <6, 27, 2> }
     pigment { color Red }
 }


Post a reply to this message

From: Tim Nikias
Subject: Re: Difference isn't working for me
Date: 20 Feb 2006 12:11:22
Message: <43f9f83a@news.povray.org>
> I can't get the difference function to work. Any ideas?

I'm not sure what you're trying to achieve, but you do know that every box
after the first is being subtracted from the first, right? And since every
box after the the third has one edge at <0,0,-1>, you might as well just us
the the third box, because every one after that just tries to cut off a
section which is already cut off by the third.

Maybe you should experiment with difference and various shapes a little more
to get a feeling for what it does, that's what I had to do in the beginning
of my POV-career. :-)

Regards,
Tim

-- 
aka "Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

From: Merrin Cullen
Subject: Re: Difference isn't working for me
Date: 20 Feb 2006 12:15:42
Message: <43f9f93e@news.povray.org>
Prodan,

Actually, difference is working just fine. Here are some problems you are
wrestling with.

1. The light is not in a position to light up the holes you are creating.
Move one of your lights to the same position as your camera & you will be
able to see the holes you are creating.
2. When in the process of developing an object, I frequently temporarily
change the color of the hole to one that contrasts with the objects color.
This helps me to see the the effects of the CSG operation.
3. When using CSG to create a hole, the shape used to create the hole must
extend past the surface of the original object. If the shape does not extend
past the surface of the original object, you have only created a hole inside
the original object that can not be seen unless it is exposed by other
holes.
4. Avoid coincident surfaces. For instance the shape box { <0, 0, 0>, <6,
53, 36> }and the shape box { <0, 0, 34>, <6, 51, 36> }both share common
sides on every side except in the +y  and +z directions. POV Ray will become
confused when mulitple shapes share a surface, this becomes more apparent
when the shapes have different pigments or textures. How to avoid coincicent
surfaces? Make sure one shape is slightly smaller or larger thatn the other
shape. (See #1 above)
5. Your camera is not in the best position to see many of the holes you are
trying to create.

I have attached a rendering of your image with the one of the lights
relocated to your camera position. Notice taht you can now see that some
material has been removed by your difference CSG. You can also see speckled
artifacts on some interior surfaces. These are caused by the coincidence
surfaces.

These are the same types of issues I faced when I first started with POV
Ray. Welcome to the learning curve!

Tim


Post a reply to this message


Attachments:
Download 'diff_test.jpg' (13 KB)

Preview of image 'diff_test.jpg'
diff_test.jpg


 

From: Prodan
Subject: Re: Difference isn't working for me
Date: 10 Mar 2006 07:45:00
Message: <web.441174705b48b2f5cc966960@news.povray.org>
"Merrin Cullen" <tim### [at] wohrrcom> wrote:
> Prodan,
>
> Actually, difference is working just fine. Here are some problems you are
> wrestling with.
>
> 1. The light is not in a position to light up the holes you are creating.
> Move one of your lights to the same position as your camera & you will be
> able to see the holes you are creating.
> 2. When in the process of developing an object, I frequently temporarily
> change the color of the hole to one that contrasts with the objects color.
> This helps me to see the the effects of the CSG operation.
> 3. When using CSG to create a hole, the shape used to create the hole must
> extend past the surface of the original object. If the shape does not extend
> past the surface of the original object, you have only created a hole inside
> the original object that can not be seen unless it is exposed by other
> holes.
> 4. Avoid coincident surfaces. For instance the shape box { <0, 0, 0>, <6,
> 53, 36> }and the shape box { <0, 0, 34>, <6, 51, 36> }both share common
> sides on every side except in the +y  and +z directions. POV Ray will become
> confused when mulitple shapes share a surface, this becomes more apparent
> when the shapes have different pigments or textures. How to avoid coincicent
> surfaces? Make sure one shape is slightly smaller or larger thatn the other
> shape. (See #1 above)
> 5. Your camera is not in the best position to see many of the holes you are
> trying to create.
>
> I have attached a rendering of your image with the one of the lights
> relocated to your camera position. Notice taht you can now see that some
> material has been removed by your difference CSG. You can also see speckled
> artifacts on some interior surfaces. These are caused by the coincidence
> surfaces.
>
> These are the same types of issues I faced when I first started with POV
> Ray. Welcome to the learning curve!
>
> Tim

I'm still having trouble creating it. How can one create stairs?


Post a reply to this message

From: Chris B
Subject: Re: Difference isn't working for me
Date: 10 Mar 2006 08:05:25
Message: <44117995$1@news.povray.org>
"Prodan" <nomail@nomail> wrote in message 
news:web.441174705b48b2f5cc966960@news.povray.org...
>
> I'm still having trouble creating it. How can one create stairs?
>

Is this what you were trying for?

#include "colors.inc"
camera {
   location <-3, 23, -20>
   look_at <5, 5, 18>
}
background{White}
light_source { <-5, 10, -40> color White }
light_source { <-3, 10, -50> color White }
difference {
    box { <   0, 0,  0>, <6  , 20, 36> }
    box { <-0.1, 2, -1>, <6.1, 20,  2> }
    box { <-0.1, 4, -1>, <6.1, 20,  4> }
    box { <-0.1, 6, -1>, <6.1, 20,  6> }
    box { <-0.1, 8, -1>, <6.1, 20,  8> }
    box { <-0.1,10, -1>, <6.1, 20, 10> }
    box { <-0.1,12, -1>, <6.1, 20, 12> }
    box { <-0.1,14, -1>, <6.1, 20, 14> }
    box { <-0.1,16, -1>, <6.1, 20, 16> }
    box { <-0.1,18, -1>, <6.1, 20, 18> }
    box { <-0.1,20, -1>, <6.1, 20, 20> }
    pigment {color Red }
}


Post a reply to this message

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