POV-Ray : Newsgroups : povray.general : texturing in csg Server Time
8 Aug 2024 04:08:33 EDT (-0400)
  texturing in csg (Message 1 to 4 of 4)  
From: Wlodzimierz ABX Skiba
Subject: texturing in csg
Date: 26 Mar 2001 08:03:13
Message: <3abf3e11@news.povray.org>
I'm not sure if it is bug or my misunderstand
it's crosspost becouse I play with MegaPOV 0.7 but I'm not sure what is its
behavior in POV 3.1
I have similiar syntax:

#declare Obj1=union{
  mesh{
    /* triangles */
    texture{Gray}
  }
  cylinder{} // <= THIS
  sphere{} // <= AND THIS
  texture{Black}
}

#local Obj2=union{
  object{Obj1 tranformations}
  other objects
  texture{Gray}
  transformations
}

object{Obj2 texture{Gray} transformations}

I think objects pointed as "THIS" should be Black but they appear as Gray. Shoud
I expect such behaviour? Can anybody confirm this behaviour?

ABX


Post a reply to this message

From: Dave B
Subject: Re: texturing in csg
Date: 26 Mar 2001 12:54:31
Message: <3abf8257$1@news.povray.org>
Somebody correct me if I am wrong but I do believe that the texture
statements for your second and third objects should be inside the objects
{}.
i.e.

#declare Obj1=union{
   mesh{
     /* triangles */
     texture{Gray}
   }
   cylinder{*cylinder definition* texture{Black} } // <= THIS
   sphere{*sphere definition* texture{Black} } // <= AND THIS
   }

I think this should sort your problem.

Dave

"Wlodzimierz ABX Skiba" <abx### [at] abxartpl> wrote in message
news:3abf3e11@news.povray.org...
> I'm not sure if it is bug or my misunderstand
> it's crosspost becouse I play with MegaPOV 0.7 but I'm not sure what is
its
> behavior in POV 3.1
> I have similiar syntax:
>
> #declare Obj1=union{
>   mesh{
>     /* triangles */
>     texture{Gray}
>   }
>   cylinder{} // <= THIS
>   sphere{} // <= AND THIS
>   texture{Black}
> }
>
> #local Obj2=union{
>   object{Obj1 tranformations}
>   other objects
>   texture{Gray}
>   transformations
> }
>
> object{Obj2 texture{Gray} transformations}
>
> I think objects pointed as "THIS" should be Black but they appear as Gray.
Shoud
> I expect such behaviour? Can anybody confirm this behaviour?
>
> ABX
>
>


Post a reply to this message

From: Francois Labreque
Subject: Re: texturing in csg
Date: 26 Mar 2001 20:08:10
Message: <3ABFE731.4DB35D6B@videotron.ca>
Dave B wrote:
> 
> Somebody correct me if I am wrong

Since you asked...

> but I do believe that the texture
> statements for your second and third objects should be inside the objects
> {}.
> i.e.
> 
> #declare Obj1=union{
>    mesh{
>      /* triangles */
>      texture{Gray}
>    }
>    cylinder{*cylinder definition* texture{Black} } // <= THIS
>    sphere{*sphere definition* texture{Black} } // <= AND THIS
>    }
> 
> I think this should sort your problem.

This will work of course, but is overkill the real way textures are
evaluated is:

If there is an object-specific texture,
    use it.
Else
    If there is a CSG-specific texture
        use it.
    Else
        Use the default values.
    
I have been unable to reproduce the problem Wlodimierz is having.  See
p.b.i. for examples, using the following scene:

// test file
#declare Black = color red 0 green 0 blue 0;
#declare Gray = color red 0.5 green 0.5 blue 0.5
#declare White = color red 1 green 1 blue 1;

// The camera, lights and floor are my "standard test scene".
camera { location <0, 8, -10> look_at <0, 4, 0> angle 60 }
light_source { < -20, 20, 0 > color red 0.3 green 0.3 blue 0.3 }
light_source { < 20, 20, 0 > color red 0.3 green 0.3 blue 0.3 }
light_source { < 0, 50, -50 > color red 0.3 green 0.3 blue 0.3 }
   
plane { y, 0 texture { pigment { color White } } }

#declare Obj1=union{
    //I used a sphere instead of a mesh, it's simpler
    sphere{ < 0, 2, 0 > 2 texture{ pigment { color Gray } } }
    cylinder{ < 0, 2, 0 > < 4, 2, 0 > 1 }
    sphere{ < 4, 2, 0 > 2 }
    texture{ pigment { color Black }}
}

#local Obj2=union{
  object{ Obj1 translate < -2, 2, 0 > }
  box { < -2, 0, -2 > < 2, 2, 2 > }
  texture{ pigment { color Gray } }
  rotate 45*y
}

object{ Obj2 texture{ pigment { color Gray } } }
//end of file

I think Wlodimierz will have to post actual code and images to see what
is going on.


-- 
Francois Labreque | The surest sign of the existence of extra-
    flabreque     | terrestrial intelligence is that they never
        @         | bothered to come down here and visit us!
  videotron.ca    |                             - Calvin


Post a reply to this message

From: Wlodzimierz ABX Skiba
Subject: Re: texturing in csg - perhaps not texturing
Date: 27 Mar 2001 05:04:18
Message: <3ac065a2@news.povray.org>
Francois Labreque wrote in message <3ABFE731.4DB35D6B@videotron.ca>...
> I think Wlodimierz will have to post actual code and images to see what
> is going on.


I try. My project is rather large but I try separate all code and connect all
include files.
Althought I'm not sure if there is problem in texturing - I observe crashing and
strange things when I add macros for arrays for big polygons.
At first take a look at my macro set:

// ============= START OF MACROS INCLUDE FILE

#macro CountSize(Array)
  dimension_size(Array,1)
#end

#macro CountEntries(Array)
  #local Size=CountSize(Array);
  #local counter=0;
  #local Finish=no;
  #while(!Finish)
    #if(counter>=Size)
      #local Finish=yes;
    #else
      #if(!defined(Array[counter]))
        #local Finish=yes;
      #else
        #local counter=counter+1;
      #end
    #end
  #end
  counter
#end

#macro AddPoint(Array,Point)
  #local Size=CountSize(Array);
  #local Entries=CountEntries(Array);
  #if(Size!=Entries)
    #declare Array[Entries]=Point;
  #else
    #local NewArray=array[Size+1]
    #local counter=0;
    #while(counter<Size)
      #local NewArray[counter]=Array[counter];
      #local counter=counter+1;
    #end
    #local NewArray[counter]=Point;
    #declare Array=NewArray
  #end
#end

#macro AddCircle(Array,P0,R)
  #local P1=P0+<0,0,R>;
  AddPoint(Array,P1)
  #local counter=1;
  #local CAqu=100;
  #while(counter<(CAqu-1))
    #local P=P0+vrotate(<0,0,R>,y*counter*360/(CAqu-1));
    AddPoint(Array,P)
    #local counter=counter+1;
  #end
  AddPoint(Array,P1)
#end

#macro AddRectangle(Array,P0,L,W)
  AddPoint(Array,(P0+x*L/2+z*W/2))
  AddPoint(Array,(P0+x*L/2-z*W/2))
  AddPoint(Array,(P0-x*L/2-z*W/2))
  AddPoint(Array,(P0-x*L/2+z*W/2))
  AddPoint(Array,(P0+x*L/2+z*W/2))
#end

#macro ListPoints(Array)
  #local Entries=CountEntries(Array);
  Entries
  #local counter=0;
  #while(counter<Entries)
    Array[counter]
    #local counter=counter+1;
  #end
#end

// ============= END OF MACROS INCLUDE FILE

ok.
I think it shoud works for any start size of array

#declare Start=2;
#local List=array[Start]
AddPoint(List,...)
AddPoint(List,...)
AddPoint(List,...)
AddPoint(List,...)
AddPoint(List,...)
AddCircle(List,...,...)
AddCircle(List,...,...)
polygon{ ListPoints(List) texture{...}}

But it crashes after some added points (I think it is memory allocation
problem). Becouse it crashed I try to calculate number of entries before
creating List and declare proper value for Start and than it works fine but ...
Sometimes I forget to close point in AddPoint for example AddPoint(List,<3,4,7)
or forget write first argument AddPoint(<3,4,7>) and parsing stops but parser
points warning inside macro AddPoint. I correct my mistake and run it again but
than parser says that some "Points in polygon are no coplanar and will be
ignored" (or something like this) but it is rendered ok. After some more such
mistakes and repairs appear two things - parser crashes or goes to infinity!!!
After restart it parses correctly without any warning.

I'm talking about runing with MegaPOV 0.7 but this source should works with pure
POV-Ray 3.1 I think

I'll try investigate texturing problem after moment.

ABX


Post a reply to this message

From: Wlodzimierz ABX Skiba
Subject: Re: texturing in csg
Date: 27 Mar 2001 06:50:55
Message: <3ac07e9f@news.povray.org>
Francois Labreque wrote in message <3ABFE731.4DB35D6B@videotron.ca>...
> I think Wlodimierz will have to post actual code and images to see what
> is going on.


just sended to p.b.i

ABX


Post a reply to this message

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