POV-Ray : Newsgroups : povray.programming : own output format : Re: own output format Server Time
28 Jul 2024 08:22:08 EDT (-0400)
  Re: own output format  
From: Le Forgeron
Date: 23 Aug 2002 09:41:03
Message: <3D663B8E.8030809@free.fr>
Rafal 'Raf256' Maj wrote:

> Hello,
> what steps should I do to create own text output format ?
> output file will be like :
> 
> width height
> line1
> line2
> line3
> 
> where lineN is :
> pixel1 ; pixel2 ; pixelN
> 
> where pixel is :
> 
> r,g,b,x,y,z,normal_fi,normal_theta,distance,alpha,id,cpu_time


The problem might be to collect the information when it is available.

The traditional file writing code is usually given a line of pixel at a 
time. Here, pixel being "traditional" pixel (rgba), not your pixel.
To collect your information, you will have to patch (heavily) the 
rendering engine
so that not only it compute the color of the pixel, but also saves the 
ray intersection... x,y,z: Evaluate_Ray(...),
Normal : You could have the classical 3 components vectors from the 
intersection of the ray (IF there is an intersection, background does 
not count), up to you to transform the vector,
distance is obviously the depth of the ray/intersection,
alpha is already part of the colour,
id : as long as you extend the object fields, the intersection will 
provide you with the object pointer, the remaining is easy.
cpu_time : look at the histogramme code, calling the right function 
before and after tracing each ray.

You have ONE BIG PROBLEM: Antialiasing!
You won't be able to perform it (what do you store if half the pixel is 
from a sphere and the other half is a box or the background).


Post a reply to this message

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