POV-Ray : Newsgroups : povray.binaries.images : workbench9.png : Re: workbench9.png Server Time
15 Oct 2024 09:06:19 EDT (-0400)
  Re: workbench9.png  
From: Bald Eagle
Date: 19 Apr 2023 18:35:00
Message: <web.64406c46299a4b841f9dae3025979125@news.povray.org>
"Mike Miller" <mil### [at] gmailcom> wrote:

> Haha...now you got me thinking. :)
> This basement could be the backdrop to lots of creepy concepts.

I somehow knew you'd be inspired.  :D

> > Quaternions:
> >
https://news.povray.org/povray.binaries.scene->files/thread/%3C3f81dba5%40news.povray.org%3E/
>
>
> Thank you!... I've been looking for this. And if you pointed me to this earlier,
> my apologies. I tried adding quaternion rotations to my Blender export utility
> and got hung up on the 'convert to euler' math.
>
> I have a question and I'm sure it's been asked many time:
> In run time, can you access/read the pixel values in a loaded bitmap?

Yes Sir.

In "functions.inc" you will find a macro as a wrapper for a function.

#macro eval_pigment(pigm, vec)
    #local fn = function { pigment { pigm } }
    #local result = (fn(vec.x, vec.y, vec.z));
    result
#end

POV-Ray of course loads it into a unit square, and so you have to scale it, but
that can be done with some extent calculations and scaling.

My standard cut-n-paste code for that is:

#declare Feet = 12;
#declare XSize = 4*Feet;
#declare ImageMap = pigment {image_map {png "AlphaMirror4.png" once} };
#declare Resolution = max_extent (ImageMap);
#declare Resolution = Resolution + <0, 0, 1>;

#declare Photo1 =
 box {0, 1
  texture {
   ImageMap
  }

  translate <-0.5, -0.5, -0.5>
  scale Resolution2*(1/Resolution2.x)*XSize
 }


If you need implementation code for eval_pigment, just let me know.


- BW


Post a reply to this message

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