POV-Ray : Newsgroups : povray.animations : Using Animation to Generate A Ray In An Arbitrary Direction Server Time
21 Nov 2024 07:55:02 EST (-0500)
  Using Animation to Generate A Ray In An Arbitrary Direction (Message 1 to 4 of 4)  
From: Paul Riley
Subject: Using Animation to Generate A Ray In An Arbitrary Direction
Date: 26 Jan 2015 21:35:01
Message: <web.54c6f9022af03687508ea77d0@news.povray.org>
Thanks for receiving me into the POVRAY forum.

I first used POVRay some 20 years ago, and found it enjoyable, in an era where
3D modellers were few. I generated my geometry in AutoCAD and had fun with
rendering them.

Now I'm interested in computer generated art, and I need to able to receive the
colour for a traced ray at some arbitrary direction. Normally, POVRay will
generate a complete image of predetermined width and height. Is there a way I
can ask it to render only a single pixel in a direction of my choosing? Let me
explain why.

I have been doing distortions on 2D artwork, and the problem is that certain
areas of the 2D source art are of too low resolution. I want to start with pixel
co-ordinates in the destination image space, and apply mathematical
transformations to produce the desired camera angles in the 3D space. I would
like POVRay to return the pixel colour for these angle co-ordinates, so I can
insert that colour in my target image.

I have considered using animation within POVRay to do this, as follows. It is a
basic layman's description of what happens.

1)  POVRay opens source file and reads in all scene details.
2)  Animation clock start=0 and end = target_width * target_height - 1, and
number of frames = target_width * target_height. Every increment of the clock
variable is then a new target pixel.
3)  For each animation iteration, use the clock variable to determine which
target pixel is being rendered. Use calculations in POVRay to determine the
Delta Azimuth and Delta Elevation angles from the nominal camera direction, and
correct the camera direction to reflect this.
4) Render an image of Width = Height = 1 pixel, and save that file with a unique
name.
5) End POVRay
6) Custom program reads all of the output files in turn, reads the single pixel,
and assembles the target image, and deletes all of he POVRay output files.

This process will produce a very large number of files, which I would need to
accommodate in a RAM drive for speed reasons. It seems quite clumsy though, and
experienced POV'ers may know of a different way to achieve this.

In the normal operation of POVRay, I would imagine that the software loops
through the target pixel array, determines what the required camera (or ray)
direction is and requests the colour of that ray from the renderer. Is it
possible to interfere with that process, and create my own loop where I can
request a ray to be traced in a direction of my own choosing? i.e. when the loop
call a routine to calculate the ray direction, can it call my routine to
calculate some arbitrary direction?

Your wisdom would be well appreciated.

Thanks,

Paul


Post a reply to this message

From: clipka
Subject: Re: Using Animation to Generate A Ray In An Arbitrary Direction
Date: 26 Jan 2015 22:18:35
Message: <54c7038b$1@news.povray.org>
Am 27.01.2015 um 03:33 schrieb Paul Riley:

> In the normal operation of POVRay, I would imagine that the software loops
> through the target pixel array, determines what the required camera (or ray)
> direction is and requests the colour of that ray from the renderer. Is it
> possible to interfere with that process, and create my own loop where I can
> request a ray to be traced in a direction of my own choosing? i.e. when the loop
> call a routine to calculate the ray direction, can it call my routine to
> calculate some arbitrary direction?

You might want to have a closer look at the mesh camera.


Post a reply to this message

From: Paul Riley
Subject: Re: Using Animation to Generate A Ray In An Arbitrary Direction
Date: 26 Jan 2015 23:20:01
Message: <web.54c710e23648a51c508ea77d0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 27.01.2015 um 03:33 schrieb Paul Riley:
>
> > In the normal operation of POVRay, I would imagine that the software loops
> > through the target pixel array, determines what the required camera (or ray)
> > direction is and requests the colour of that ray from the renderer. Is it
> > possible to interfere with that process, and create my own loop where I can
> > request a ray to be traced in a direction of my own choosing? i.e. when the loop
> > call a routine to calculate the ray direction, can it call my routine to
> > calculate some arbitrary direction?
>
> You might want to have a closer look at the mesh camera.

Thanks for that.

If I use a regular mesh object, with simple triangles for the mesh camera, how
is the sense of the triangle's normal vector defined? I assume that the normal
vector is the unit vector of the cross product of two of the side vectors. If
so, which ones? If the three vertices are a, b and c, then is the normal vector
ab x bc or is it bc x ab?

Paul


Post a reply to this message

From: MichaelJF
Subject: Re: Using Animation to Generate A Ray In An Arbitrary Direction
Date: 27 Jan 2015 02:40:00
Message: <web.54c740be3648a51c5e3d0a820@news.povray.org>
"Paul Riley" <nomail@nomail> wrote:

>
> If I use a regular mesh object, with simple triangles for the mesh camera, how
> is the sense of the triangle's normal vector defined? I assume that the normal
> vector is the unit vector of the cross product of two of the side vectors. If
> so, which ones? If the three vertices are a, b and c, then is the normal vector
> ab x bc or is it bc x ab?
>
> Paul

Better specify the normals yourself. May be not the easiest task, but this way
you gain control over the normals.

Best regards,
Michael


Post a reply to this message

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