POV-Ray : Newsgroups : povray.general : Rendering meshes with unique color per face Server Time
16 Nov 2024 07:14:16 EST (-0500)
  Rendering meshes with unique color per face (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Marc Ellenrieder
Subject: Rendering meshes with unique color per face
Date: 29 Feb 2004 04:43:06
Message: <4041b429@news.povray.org>
Hi, 

I'm trying to render a PovRay mesh with different colors for each face. The
colors are numbered from 0 to NumberofFaces.I have split up the
color-number longint value into three bytes for each RGB color. So the
first face gets the color <0 , 0, 1/255>, the second <0,0,2/255>, the 256th
face the color <0, 1/255,0> and so on. 

Basically, the idea is to know in the final image, which face is visible in
a particular pixel by using the color value as an index.

Now I have the problem, that I am not able to tell PovRay to perform no
shading. That results in a problem, as PovRay renders neighbouring faces
with e.g. color 1 and 2 in the same color. Thus I am no longer able to
differntiate between the faces in the image. 

I tried to turn off all anti-aliasing, buffering etc. and even tried to
render with -Q0. The result was, that I got unique colors per face but now
the color-value did no longer correspond to the face number. 

What more can I do? Is PovRay the right tool to use for this task?

I have attached a sample .pov file and the command line I used to this
message. Any suggestions are welcome.

    Thank you, 

        Marc 


povray +Imodel.pov +O model.bmp +W640 +H480 -A -UL -UV -Q0 

============================================================================== 

// a simple cube

#declare model = mesh2 { 

vertex_vectors { 
   8 
   < +2972.72000 , -2972.71900 , -2972.72000 > 
   < +2972.72000 , +2972.72000 , -2972.72000 > 
   < -2972.72000 , +2972.71900 , -2972.72000 > 
   < -2972.71900 , -2972.72100 , -2972.72000 > 
   < +2972.72100 , -2972.71800 , +2972.72000 > 
   < -2972.71900 , -2972.72000 , +2972.72000 > 
   < -2972.72100 , +2972.71900 , +2972.72000 > 
   < +2972.71800 , +2972.72100 , +2972.72000 > 
    } 
texture_list { 
   12 
   texture{pigment{rgb <0,0,3.921569e-003>}} 
   texture{pigment{rgb <0,0,7.843137e-003>}} 
   texture{pigment{rgb <0,0,1.176471e-002>}} 
   texture{pigment{rgb <0,0,1.568627e-002>}} 
   texture{pigment{rgb <0,0,1.960784e-002>}} 
   texture{pigment{rgb <0,0,2.352941e-002>}} 
   texture{pigment{rgb <0,0,2.745098e-002>}} 
   texture{pigment{rgb <0,0,3.137255e-002>}} 
   texture{pigment{rgb <0,0,3.529412e-002>}} 
   texture{pigment{rgb <0,0,3.921569e-002>}} 
   texture{pigment{rgb <0,0,4.313725e-002>}} 
   texture{pigment{rgb <0,0,4.705882e-002>}} 
    } 
face_indices { 
   12 
   <   0 ,   1 ,   2 >,0 
   <   2 ,   3 ,   0 >,1 
   <   4 ,   5 ,   6 >,2 
   <   6 ,   7 ,   4 >,3 
   <   0 ,   4 ,   7 >,4 
   <   7 ,   1 ,   0 >,5 
   <   1 ,   7 ,   6 >,6 
   <   6 ,   2 ,   1 >,7 
   <   2 ,   6 ,   5 >,8 
   <   5 ,   3 ,   2 >,9 
   <   4 ,   0 ,   3 >,10 
   <   3 ,   5 ,   4 >,11 
    } 
} 
camera { 
        perspective 
        location  < -5352.586, -50926.453, +5382.069 > 
        direction < +0.104, +0.989, -0.105 > 
        up        < +0.011, +0.103, +0.989 > 
        sky       < +0.011, +0.103, +0.989 > 
        right     < +0.989, -0.104, +0.000 > 
        angle     7.772 
       } 

background { color rgb <1, 1, 1> } 

global_settings { assumed_gamma 1.0 ambient_light rgb <1, 1, 1> } 

// Show the model 

model


Post a reply to this message

From: "Jérôme M. Berger"
Subject: Re: Rendering meshes with unique color per face
Date: 29 Feb 2004 04:59:17
Message: <4041b7f5$1@news.povray.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

	I'm not sure that I understand. I rendered the source you provided
(replacing the color values by 1/12 to 12/12 in order to get colors that
are different enough to be visible) and each face was colored differently.

		Jerome

Marc Ellenrieder wrote:
| Hi,
|
| I'm trying to render a PovRay mesh with different colors for each
face. The
| colors are numbered from 0 to NumberofFaces.I have split up the
| color-number longint value into three bytes for each RGB color. So the
| first face gets the color <0 , 0, 1/255>, the second <0,0,2/255>, the
256th
| face the color <0, 1/255,0> and so on.
|
| Basically, the idea is to know in the final image, which face is
visible in
| a particular pixel by using the color value as an index.
|
| Now I have the problem, that I am not able to tell PovRay to perform no
| shading. That results in a problem, as PovRay renders neighbouring faces
| with e.g. color 1 and 2 in the same color. Thus I am no longer able to
| differntiate between the faces in the image.
|
| I tried to turn off all anti-aliasing, buffering etc. and even tried to
| render with -Q0. The result was, that I got unique colors per face but now
| the color-value did no longer correspond to the face number.
|
| What more can I do? Is PovRay the right tool to use for this task?
|
| I have attached a sample .pov file and the command line I used to this
| message. Any suggestions are welcome.
|
|     Thank you,
|
|         Marc
|
|
| povray +Imodel.pov +O model.bmp +W640 +H480 -A -UL -UV -Q0
|
|
==============================================================================

|
| // a simple cube
|
| #declare model = mesh2 {
|
| vertex_vectors {
|    8
|    < +2972.72000 , -2972.71900 , -2972.72000 >
|    < +2972.72000 , +2972.72000 , -2972.72000 >
|    < -2972.72000 , +2972.71900 , -2972.72000 >
|    < -2972.71900 , -2972.72100 , -2972.72000 >
|    < +2972.72100 , -2972.71800 , +2972.72000 >
|    < -2972.71900 , -2972.72000 , +2972.72000 >
|    < -2972.72100 , +2972.71900 , +2972.72000 >
|    < +2972.71800 , +2972.72100 , +2972.72000 >
|     }
| texture_list {
|    12
|    texture{pigment{rgb <0,0,3.921569e-003>}}
|    texture{pigment{rgb <0,0,7.843137e-003>}}
|    texture{pigment{rgb <0,0,1.176471e-002>}}
|    texture{pigment{rgb <0,0,1.568627e-002>}}
|    texture{pigment{rgb <0,0,1.960784e-002>}}
|    texture{pigment{rgb <0,0,2.352941e-002>}}
|    texture{pigment{rgb <0,0,2.745098e-002>}}
|    texture{pigment{rgb <0,0,3.137255e-002>}}
|    texture{pigment{rgb <0,0,3.529412e-002>}}
|    texture{pigment{rgb <0,0,3.921569e-002>}}
|    texture{pigment{rgb <0,0,4.313725e-002>}}
|    texture{pigment{rgb <0,0,4.705882e-002>}}
|     }
| face_indices {
|    12
|    <   0 ,   1 ,   2 >,0
|    <   2 ,   3 ,   0 >,1
|    <   4 ,   5 ,   6 >,2
|    <   6 ,   7 ,   4 >,3
|    <   0 ,   4 ,   7 >,4
|    <   7 ,   1 ,   0 >,5
|    <   1 ,   7 ,   6 >,6
|    <   6 ,   2 ,   1 >,7
|    <   2 ,   6 ,   5 >,8
|    <   5 ,   3 ,   2 >,9
|    <   4 ,   0 ,   3 >,10
|    <   3 ,   5 ,   4 >,11
|     }
| }
| camera {
|         perspective
|         location  < -5352.586, -50926.453, +5382.069 >
|         direction < +0.104, +0.989, -0.105 >
|         up        < +0.011, +0.103, +0.989 >
|         sky       < +0.011, +0.103, +0.989 >
|         right     < +0.989, -0.104, +0.000 >
|         angle     7.772
|        }
|
| background { color rgb <1, 1, 1> }
|
| global_settings { assumed_gamma 1.0 ambient_light rgb <1, 1, 1> }
|
| // Show the model
|
| model
|
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAQbf0qIYJdJhyixIRAo6AAKCnl+Mz6mhvF9OR5vUt09q0OMYJkQCfRYtQ
ZCgqbR5Drfzzmn9+apJI5VI=
=tkSM
-----END PGP SIGNATURE-----


Post a reply to this message

From: Francois LE COAT
Subject: Re: Rendering meshes with unique color per face
Date: 29 Feb 2004 05:18:26
Message: <4041bc72$1@news.povray.org>
Hi Marc,

Marc Ellenrieder wrote:
> Basically, the idea is to know in the final image, which face is visible in
> a particular pixel by using the color value as an index.
> 
> Now I have the problem, that I am not able to tell PovRay to perform no
> shading. That results in a problem, as PovRay renders neighbouring faces
> with e.g. color 1 and 2 in the same color. Thus I am no longer able to
> differntiate between the faces in the image. 

I'm not quite sure it will answer your question ...

You should modify the "finish" rendering of your object so that faces
will not be shaded. Just put an "ambient" light to 1.0, and a "diffuse"
light to 0.0 in the "finish" section of your object properties. This
will give to the faces of your object a plain color, without any
interference with the light sources ...

Please tell me if it works ...

Regards,


Author of Eureka 2.12 (2D Graph Describer, 3D Modeller)
http://eureka.lutece.net


Post a reply to this message

From: Marc Ellenrieder
Subject: Re: Rendering meshes with unique color per face
Date: 2 Mar 2004 02:13:21
Message: <40443410@news.povray.org>


> You should modify the "finish" rendering of your object so that faces
> will not be shaded. Just put an "ambient" light to 1.0, and a "diffuse"
> light to 0.0 in the "finish" section of your object properties. This
> will give to the faces of your object a plain color, without any
> interference with the light sources ...
> 
> Please tell me if it works ...

Thank you for your suggestions. I tried that and additionally set
Display_Gamma=1.0 on the command line. The result was indeed a different
color per face.
But,.... the color (the blue value in this case), did not correspond to the
face number :-( The cube has 12 faces in total and I didn't get color
values from 1 to 12. Even moving the color values to a more visible
interval did not help. PovRay still seems to do some shading. Maybe PovRay
is not the right tool for this kind of task.

-- 
---------------------------------------------------------------
TrackerChamp            
(Tra### [at] gmxnet)  

PGP/GPG fingerprint:       8674 6B05 3844 DB4A 65AB  A40B 23A1 A148 37F6
436D


Post a reply to this message

From: Francois LE COAT
Subject: Re: Rendering meshes with unique color per face
Date: 2 Mar 2004 06:54:28
Message: <404475f4@news.povray.org>
Hi,

Marc Ellenrieder wrote:
> Maybe PovRay is not the right tool for this kind of task.

Let's have a look at this ...

Regards,


http://eureka.lutece.net

================================================================

// a simple cube

#declare model = mesh2 {

vertex_vectors {
    8
    < +2972.72000 , -2972.71900 , -2972.72000 >
    < +2972.72000 , +2972.72000 , -2972.72000 >
    < -2972.72000 , +2972.71900 , -2972.72000 >
    < -2972.71900 , -2972.72100 , -2972.72000 >
    < +2972.72100 , -2972.71800 , +2972.72000 >
    < -2972.71900 , -2972.72000 , +2972.72000 >
    < -2972.72100 , +2972.71900 , +2972.72000 >
    < +2972.71800 , +2972.72100 , +2972.72000 >
     }
texture_list {
    12
    texture{pigment{rgb <0,0,0.1>}}
    texture{pigment{rgb <0,0,0.2>}}
    texture{pigment{rgb <0,0,0.3>}}
    texture{pigment{rgb <0,0,0.4>}}
    texture{pigment{rgb <0,0,0.5>}}
    texture{pigment{rgb <0,0,0.6>}}
    texture{pigment{rgb <0,0,0.7>}}
    texture{pigment{rgb <0,0,0.8>}}
    texture{pigment{rgb <0,0,0.9>}}
    texture{pigment{rgb <0,0,0.8>}}
    texture{pigment{rgb <0,0,0.7>}}
    texture{pigment{rgb <0,0,0.6>}}
     }
face_indices {
    12
    <   0 ,   1 ,   2 >,0
    <   2 ,   3 ,   0 >,1
    <   4 ,   5 ,   6 >,2
    <   6 ,   7 ,   4 >,3
    <   0 ,   4 ,   7 >,4
    <   7 ,   1 ,   0 >,5
    <   1 ,   7 ,   6 >,6
    <   6 ,   2 ,   1 >,7
    <   2 ,   6 ,   5 >,8
    <   5 ,   3 ,   2 >,9
    <   4 ,   0 ,   3 >,10
    <   3 ,   5 ,   4 >,11
     }
}
camera {
         perspective
         location  < -5352.586, -50926.453, +5382.069 >
         direction < +0.104, +0.989, -0.105 >
         up        < +0.011, +0.103, +0.989 >
         sky       < +0.011, +0.103, +0.989 >
         right     < +0.989, -0.104, +0.000 >
         angle     7.772
         look_at <0,0,0>
        }

background { color rgb <1, 1, 1> }

global_settings { assumed_gamma 0.7 ambient_light rgb <1, 1, 1> }

light_source { <-20, 400000, -20> color rgb <1,1,1> }

// Show the model

object {
model
finish { ambient 1.0 diffuse 0.0 }
}


Post a reply to this message

From: Warp
Subject: Re: Rendering meshes with unique color per face
Date: 2 Mar 2004 07:10:11
Message: <404479a3@news.povray.org>
Francois LE COAT <lec### [at] atariorg> wrote:
> global_settings { assumed_gamma 0.7 ambient_light rgb <1, 1, 1> }

  Are you sure you don't want to use assumed_gamma 1 instead?

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Francois LE COAT
Subject: Re: Rendering meshes with unique color per face
Date: 2 Mar 2004 07:48:07
Message: <40448287@news.povray.org>
Hi,

Warp wrote:
>>global_settings { assumed_gamma 0.7 ambient_light rgb <1, 1, 1> }
> 
>   Are you sure you don't want to use assumed_gamma 1 instead?

Well, as you like ...

The big problem with Marc's script is that there was no light
source ... Then, all the faces of his cube had a color close
to dark black. That way, there was no possibility do distinguish
between faces colors. I only modified a few things so that
features can be visible. With a gamma of 0.7, it's even more
visible ...

... So, as you like, no problem.
Marc could tell us if it's better or not ...

Regards,


http://eureka.lutece.net


Post a reply to this message

From: Christopher James Huff
Subject: Re: Rendering meshes with unique color per face
Date: 3 Mar 2004 11:37:48
Message: <cjameshuff-595009.11384903032004@news.povray.org>
In article <40448287@news.povray.org>,
 Francois LE COAT <lec### [at] atariorg> wrote:

> The big problem with Marc's script is that there was no light
> source ... Then, all the faces of his cube had a color close
> to dark black. That way, there was no possibility do distinguish
> between faces colors. I only modified a few things so that
> features can be visible. With a gamma of 0.7, it's even more
> visible ...

Um...if you want the colors in the image to be the colors specified, you 
need to use an ambient of 1, diffuse of 0, no light sources, and no 
gamma correction.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

From: Warp
Subject: Re: Rendering meshes with unique color per face
Date: 3 Mar 2004 14:51:48
Message: <40463754@news.povray.org>
Christopher James Huff <cja### [at] earthlinknet> wrote:
> and no gamma correction.

  AFAIK that's what "assumed_gamma 1" does. The default is something else,
which means gamma correction is done to all colors specified in the
scene file.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Christopher James Huff
Subject: Re: Rendering meshes with unique color per face
Date: 3 Mar 2004 16:50:08
Message: <cjameshuff-57784A.16510903032004@news.povray.org>
In article <40463754@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

> Christopher James Huff <cja### [at] earthlinknet> wrote:
> > and no gamma correction.
> 
>   AFAIK that's what "assumed_gamma 1" does. The default is something else,
> which means gamma correction is done to all colors specified in the
> scene file.

No. "assumed_gamma 1" uses the Display_Gamma value, which should be the 
gamma of whatever device you are going to display the image on, and 
defaults to 1.8 on Macs and 2.2 on PCs. The default (with no 
assumed_gamma specified) is to do no gamma correction at all. You could 
also set both assumed_gamma and Display_Gamma to 1, but that's more work 
than necessary.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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