POV-Ray : Newsgroups : povray.general : Color help... : Re: Color help... Server Time
8 Aug 2024 01:19:20 EDT (-0400)
  Re: Color help...  
From: Vahur Krouverk
Date: 24 Jul 2001 14:29:35
Message: <3B5DBF56.1C6DDD06@comtrade.ee>
Michael Andrews wrote:
> 
> The way I'd have done it with a POVMan shader would be something like
> 
> #declare incoming = pigment {
>   shader{
>     shader_file "incoming.slp"
>     "falloff" 5
>     shadow_type shader_shadow
>   }
> }
> 
> sphere { 0,5
>   pigment {
>     pigment_pattern { incoming }
>     pigment_map {
>       [0.5 granite colour_map {[0 rgb x][1 rgb y]} ]
>       [0.5 bozo colour_map {[0 rgb z][1 rgb 1]} ]
>     }
>   }
>   finish { ambient 1 diffuse 0 specular 0 metallic }
> }
> 
> where the shader just returns the dot product between I (the incoming
> ray) and N (the surface normal).
> 
> Unfortunately, POVMan seems to count the pigment_pattern interior as a
> non-object pigment definition so neither I nor N are defined. I'm having
> to assume this from the fact that it does not work; usually it warns you
> about an incomplete initialization (when a shader is used in a warp, for
> instance) but in this case the pigment_pattern simply returns a value of
> 1 without any warnings.
> 
> If anyone can see another way of doing it I would also like to know ...
 
I tried it and indeed it doesn't work as expected. Seems like I vector
is wrong. POVMan calculates I by subtracting initial point of incoming
ray from intersection point in order to obtain 'true' (unnormalized)
view vector (incoming ray structure contains direction vector, but it is
normalized.) I assume that intersection point is correct, so initial
point in ray structure is one to blame. Unfortunately I don't have time
to examine it right now (i'm on vacation and packing for bicycle tour)
and I can't say, where is the problem. But I made note in 'things to do'
list to correct it in next version.
Temporary solution, which will work for trivial cases, would be to
calculate I vector by 'hand' by subtracting E (camera position) from P
(shading point). I made quick test and it seems to work. However, this
will not work in more complicated cases (e.g. with reflecting rays or
materials with different ior.)

HTH,
Vahur


Post a reply to this message

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