POV-Ray : Newsgroups : povray.general : area highlights Server Time
20 Nov 2024 01:22:40 EST (-0500)
  area highlights (Message 1 to 8 of 8)  
From: Simon Adameit
Subject: area highlights
Date: 19 Dec 2001 14:34:30
Message: <3c20ebc6@news.povray.org>
Hi,

I want to implement area highlights as a pigment.
I get the intersection point and the direction of the normal from
pigment functions. The reflected ray function also works, but I don't know
how to vnormalize a vector that is three functions without using vnormalize
because I'm not allowed to use vectors in functions.


Post a reply to this message

From: Lutz-Peter Hooge
Subject: Re: area highlights
Date: 19 Dec 2001 14:58:59
Message: <MPG.168b0fe4d00b5e199896d0@news.povray.org>
In article <3c20ebc6@news.povray.org>, gom### [at] gmxde says...

> pigment functions. The reflected ray function also works, but I don't know
> how to vnormalize a vector that is three functions without using vnormalize
> because I'm not allowed to use vectors in functions.

When your functions are a,b,c then the normalized vector is

<a,b,c>/vlength(<a,b,c>) = <a,b,c>/sqrt(a^2+b^2+c^2)

Lutz-Peter


Post a reply to this message

From: Simon Adameit
Subject: Re: area highlights
Date: 19 Dec 2001 15:10:05
Message: <3c20f41d$1@news.povray.org>
> When your functions are a,b,c then the normalized vector is
>
> <a,b,c>/vlength(<a,b,c>) = <a,b,c>/sqrt(a^2+b^2+c^2)
>

Thanks! I'll try it tomorrow and post the images when they are ready.


Post a reply to this message

From:
Subject: Re: area highlights
Date: 20 Dec 2001 04:00:29
Message: <ql932uco2d1mltnpkih5s6j38ibhri31a1@4ax.com>
On Wed, 19 Dec 2001 20:33:54 +0100, "Simon Adameit" <gom### [at] gmxde> wrote:
> I want to implement area highlights as a pigment.
> I get the intersection point and the direction of the normal from
> pigment functions. The reflected ray function also works, but I don't know
> how to vnormalize a vector that is three functions without using vnormalize
> because I'm not allowed to use vectors in functions.

You don't have to normalize IMO. You have to average scaled values just like
slopes.

I just checked to compare result of the averaged slopes and normal direction.
Looks like slope isn't proportional to view on Direction axis. But results is
similiar I think you should try with it. Here is testing scene:

#version 3.5;
#include "math.inc"
camera{location 0 look_at y spherical h_angle 360 v_angle 180}
light_source{0 color rgb 1}
// use first to return modified slope
#local P1=pigment{
  average
  pigment_map{
    [3 slope x color_map{[0 red   -3][1 red   3]}]
    [3 slope y color_map{[0 green -3][1 green 3]}]
    [3 slope z color_map{[0 blue  -3][1 blue  3]}]
  }
}
// use second to return normal direction
#local P2=pigment{
  average
  pigment_map{
    [3 function{adj_range2(-x,-1,1,0,1)} color_map{[0 red   -3][1 red   3]}]
    [3 function{adj_range2(-y,-1,1,0,1)} color_map{[0 green -3][1 green 3]}]
    [3 function{adj_range2(-z,-1,1,0,1)} color_map{[0 blue  -3][1 blue  3]}]
  }
}
sphere{0 1 pigment{P1} hollow} // change P1 to P2 when needed

//ABX


Post a reply to this message

From: Simon Adameit
Subject: Re: area highlights
Date: 20 Dec 2001 10:06:04
Message: <3c21fe5c@news.povray.org>

ql932uco2d1mltnpkih5s6j38ibhri31a1@4ax.com...
> You don't have to normalize IMO. You have to average scaled values just
like
> slopes.
>
> I just checked to compare result of the averaged slopes and normal
direction.
> Looks like slope isn't proportional to view on Direction axis. But results
is
> similiar I think you should try with it. Here is testing scene:

I don't get any normals from the slope pattern when I use it in a function
that I use in an other function. Just something like <1,1,1> or <0,0,0>. Is
there another way to get the normals or should I just make a thing that only
works for spheres?


Post a reply to this message

From:
Subject: Re: area highlights
Date: 20 Dec 2001 10:29:15
Message: <7uv32u02nosul1q59a818bs9kluhgo08tj@4ax.com>
On Thu, 20 Dec 2001 15:53:05 +0100, "Simon Adameit" <gom### [at] gmxde> wrote:
> I don't get any normals from the slope pattern when I use it in a function
> that I use in an other function. Just something like <1,1,1> or <0,0,0>.

And what you expected when you have no surface ? AFAIK only slope at
texture/pigment/normal level has right behaviour. When you call it within
function then there is no internal intesection entry and therefore no normal.
And that's probably why there is no f_slope() function in "functions.inc"

> Is there another way to get the normals or should I just make a thing that only
> works for spheres?

I'm affraid no.

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)&_((x+y)*.7,z,.1)&_((x+y+2)*.7,z,.1)&_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From:
Subject: Re: area highlights
Date: 20 Dec 2001 10:46:41
Message: <qo142ukodc8f3r77sfejfuhlcfot97rqdd@4ax.com>
On Thu, 20 Dec 2001 15:53:05 +0100, "Simon Adameit" <gom### [at] gmxde> wrote:
> Is there another way to get the normals

As I said I'm affraid no, but ...

> or should I just make a thing that only
> works for spheres?

... you can write patch (start with current 3.1 sources and later move to 3.5).
Of course before patch you can test general rule with functions, spheres and
betas.

ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)&_((x+y)*.7,z,.1)&_((x+y+2)*.7,z,.1)&_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35


Post a reply to this message

From: Simon Adameit
Subject: Re: area highlights
Date: 20 Dec 2001 11:37:56
Message: <3c2213e4$1@news.povray.org>

qo142ukodc8f3r77sfejfuhlcfot97rqdd@4ax.com...
> On Thu, 20 Dec 2001 15:53:05 +0100, "Simon Adameit" <gom### [at] gmxde>
wrote:
> > Is there another way to get the normals
>
> As I said I'm affraid no, but ...
>
> > or should I just make a thing that only
> > works for spheres?
>
> ... you can write patch (start with current 3.1 sources and later move to
3.5).
> Of course before patch you can test general rule with functions, spheres
and
> betas.

Of course before patch I have to learn C :-)


Post a reply to this message

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