POV-Ray : Newsgroups : povray.newusers : calculation for pixel normal value and color value in source code Server Time
29 Oct 2024 22:45:10 EDT (-0400)
  calculation for pixel normal value and color value in source code (Message 1 to 3 of 3)  
From: Yunying
Subject: calculation for pixel normal value and color value in source code
Date: 11 Feb 2010 05:45:02
Message: <web.4b73df795ff3978c25acb1ab0@news.povray.org>
Hi, I am a begineer for Pov-Ray. I am doing a school project which requires me
to use pov-ray to generate a picture which each pixel value actually represent
its normal value.

  My supervisor told me I can just replace the color value(R,G,B)of each pixel
by that pixel's normal value(x,y,z).(P.S. I have tried to use this method to
edit the tutorial example in 'Introduction to POV-Ray'(SDL Tutorial: A
raytracer, p.g. 176. and could get the normal_value picture I want).

  However, the tutorial I tried is only suitable for generating spheres, if I
want to generate a more complex picture, I don't know how to do. Do I need to
edit the source code? or anybody can tell me where I can find
the source code which calculate each pixel's color and its normal value? then I
can directly use the normal value to replace the color value. If you can, please
tell me the variable name used to represent these two variables? Please please
help!!! it's very important to me.

  Thank you very much!

P.s. I have got a reply from other group, but I cannot understand very well
about this, can any one explain it? Or have other suggestion?Is there a way
which I only need to edit one part of the code(e.g. source code), so I can use
it for all of the other model program without editing every program?

This is the reply suggestion from Warp, thanks for his/her help.

>>  You might be able to do that without having to modify the source code.

  Define three pigments, each using a slope_map oriented towards each of
the main axes, and each using one of the RGB components as its color map
(ie. the first would be from black to red, the second from black to green,
and so on). Then use the average of these pigments as your overall pigment
of the object.

--
                                                          - Warp
>>


Post a reply to this message

From: Warp
Subject: Re: calculation for pixel normal value and color value in source code
Date: 11 Feb 2010 10:38:39
Message: <4b74247f@news.povray.org>
Yunying <zyu### [at] gmailcom> wrote:
> This is the reply suggestion from Warp, thanks for his/her help.

> >>  You might be able to do that without having to modify the source code.

>   Define three pigments, each using a slope_map oriented towards each of
> the main axes, and each using one of the RGB components as its color map
> (ie. the first would be from black to red, the second from black to green,
> and so on). Then use the average of these pigments as your overall pigment
> of the object.

  I should have said "slope pattern" rather than "slope_map". I got the
terms confused. Anyways, here's some relevant documentation:

http://wiki.povray.org/content/Documentation:Reference_Section_5#Pigment
http://wiki.povray.org/content/Documentation:Reference_Section_5.5#Slope
http://wiki.povray.org/content/Documentation:Reference_Section_5.3#Average

  Basically: Create three pigments. Each pigment should use a slope pattern
pointing towards each of the three main axes, and their color maps should be
a desired map between black and the main RGB color component. Then the final
pigment can be constructed by creating a pigment which uses an average
pigment_map of those three.

-- 
                                                          - Warp


Post a reply to this message

From: Jim Charter
Subject: Re: calculation for pixel normal value and color value in source code
Date: 12 Feb 2010 17:56:01
Message: <4b75dc81$1@news.povray.org>
Yunying wrote:
> Hi, I am a begineer for Pov-Ray. I am doing a school project which requires me
> to use pov-ray to generate a picture which each pixel value actually represent
> its normal value.
> 
>   My supervisor told me I can just replace the color value(R,G,B)of each pixel
> by that pixel's normal value(x,y,z).(P.S. I have tried to use this method to
> edit the tutorial example in 'Introduction to POV-Ray'(SDL Tutorial: A
> raytracer, p.g. 176. and could get the normal_value picture I want).
> 
>   However, the tutorial I tried is only suitable for generating spheres, if I
> want to generate a more complex picture, I don't know how to do. Do I need to
> edit the source code? or anybody can tell me where I can find
> the source code which calculate each pixel's color and its normal value? then I
> can directly use the normal value to replace the color value. If you can, please
> tell me the variable name used to represent these two variables? Please please
> help!!! it's very important to me.
> 
>   Thank you very much!
> 
> P.s. I have got a reply from other group, but I cannot understand very well
> about this, can any one explain it? Or have other suggestion?Is there a way
> which I only need to edit one part of the code(e.g. source code), so I can use
> it for all of the other model program without editing every program?
> 
> This is the reply suggestion from Warp, thanks for his/her help.
> 
>>>  You might be able to do that without having to modify the source code.
> 
>   Define three pigments, each using a slope_map oriented towards each of
> the main axes, and each using one of the RGB components as its color map
> (ie. the first would be from black to red, the second from black to green,
> and so on). Then use the average of these pigments as your overall pigment
> of the object.
> 
> --
>                                                           - Warp
> 
> 

Warp has given you a very clever approach for solving your problem.  The 
reason he is describing the solution rather than coding it for you is 
that being an educator himself he does not want to simply hand you the 
solution.

Also, he has allowed for your simplified description of your problem, in 
which you describe a 'pixel' as having a 'normal'.  This literally does 
not make sense but with a little forgiveness does make sense.  So, 
please allow Warp the same latitude he has allowed you and take a 
careful look at what he has suggested to you.

-Jim


Post a reply to this message

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