POV-Ray : Newsgroups : povray.advanced-users : Calculating normals and perturbing them. : Re: Calculating normals and perturbing them. Server Time
28 Nov 2025 04:08:11 EST (-0500)
  Re: Calculating normals and perturbing them.  
From: Bald Eagle
Date: 26 Nov 2025 19:45:00
Message: <web.69279ed729c138871f9dae3025979125@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> I may or may not get the opportunity to try this, but it would be useful to plot
> expected normal scalar values as an overlay, and also render the potential
> vector-promoted scalar values to see if they give the same results.

Well I did.  And it was as (unnecessarily) annoying, confusing, frustrating, and
difficult as these things always are.

I'm very interested in what the/your expected result is.

(very cool version statement - you have a lot of clever little things in your
scenes)


#version max (3.5, min (3.8, version));

global_settings { assumed_gamma 1 }

light_source { <(frame_number = 2? 1: -1), 1, -1.4> * 1000, rgb 1 }

camera
{ location -6 * z
   right x
   angle 30
}

#declare OriginalFunction =
function
{ max
 ( select (x - 1, 1, select (x - 2, 0, 1)),
   select (y - 1, 1, select (y - 2, 0, 1))
 )
}

#declare Pattern = function {
 spline {
  0, <0, 0, 0>,
  1, <1, 1 ,1>
 }
}

#declare VectorValues =
normal {
 average
 normal_map {
  [function { Pattern (OriginalFunction(x, y, z)).red}]
  [function { Pattern (OriginalFunction(x, y, z)).green}]
  [function { Pattern (OriginalFunction(x, y, z)).blue}]
 }
}


#declare Function = 1;

#switch (Function)

 #case (0)
  box
  { 0, 3
     pigment { rgb <1, 0.5, 0.5> }
     normal
     {
      function {OriginalFunction (x, y, z)}
       accuracy 0.1
     }
     translate <-1.5, -1.5, 0>
  }
 #break

 #case (1)
  box
  { 0, 3
     pigment { rgb <1, 0.5, 0.5> }
     normal
     {
      VectorValues
       accuracy 0.1
     }
     translate <-1.5, -1.5, 0>
  }
 #break

#end

#declare Ext = 5;
#for (Y, -Ext, Ext)
 #for (X, -Ext, Ext)
  text { ttf "arial.ttf", str (OriginalFunction (X, Y, 0), 0, 0), 0.02, 0.0
translate <-0.25, -0.25, 0> scale 0.5 translate <X, Y, -0.01> pigment {rgb
z*0.5} no_shadow}
 #end
#end


Post a reply to this message


Attachments:
Download 'cousinricky_normals.png' (19 KB)

Preview of image 'cousinricky_normals.png'
cousinricky_normals.png


 

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