POV-Ray : Newsgroups : povray.newusers : calculation for pixel normal value and color value in source code : Re: calculation for pixel normal value and color value in source code Server Time
7 Jul 2024 07:49:15 EDT (-0400)
  Re: calculation for pixel normal value and color value in source code  
From: Jim Charter
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.