File: README.txt

package info (click to toggle)
povray 1%3A3.7.0.10-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 147,232 kB
  • sloc: cpp: 845,011; ansic: 122,118; sh: 34,204; pascal: 6,420; asm: 3,355; ada: 1,681; makefile: 1,389; cs: 879; awk: 590; perl: 245; xml: 95
file content (341 lines) | stat: -rw-r--r-- 11,916 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
// Persistence Of Vision Raytracer sample file.

// Jaime Vives Piqueres, Jan. 2011  <jaime@ignorancia.org>

/*******************************************************************************
 * $File: //depot/povray/smp/distribution/scenes/camera/mesh_camera/README.txt $
 * $Revision: #2 $
 * $Change: 5377 $
 * $DateTime: 2011/01/09 19:56:00 $
 * $Author: jholsenback $
 ******************************************************************************/
------------
INTRODUCTION
------------

The "mesh camera" is a new type of camera which uses a mesh as a guide
to trace the rays into the scene, using the normal at each face. It has
two main usages for now: baking textures and creating custom cameras.

Let's start first with an introduction to the new camera syntax (I hope
you will forget that I didn't use proper syntax specification):

camera{
    mesh_camera{
        rays_per_pixel
        distribution_type
        MESH_OBJECT ...
	[smooth]
    }
    location <location>
    [direction <direction>]
}


+ rays_per_pixel:
-----------------

This parameter controls the number of rays that will be shot from each
face on the mesh. Each distribution bellow allows different values, but
minimum is always 1.


+ distribution_type:
--------------------

This parameter controls how pixels are assigned to faces:

- #0 : This method allows single or multiple rays per pixel, with the
ray number for that pixel allocated to each mesh in turn. The index
into each mesh is the pixel number. If there is no face at that pixel
position, the resulting pixel is unaffected.

In this mode, you don't get the benefit of summing the meshes
sequentially. Each mesh represents a distinct ray for each pixel.
Generally, it would be expected that the number of faces in each mesh
is the same, but this is not a requirement.

- #1 : This method allows both multiple rays per pixel and summing of
meshes; i.e. the faces of all the supplied meshes are logically summed
together as if they were one single mesh. In this mode, if you specify
more than one ray per pixel, the second ray for a given pixel will go
to the face at (width * height * ray_number) + pixel_number, where
ray_number is the count of rays shot into a specific pixel.

In this mode, if the calculated face index exceeds the total number of
faces for all the meshes, no ray is shot.

- #2 : Distribution method 2 is a horizontal array of sub-cameras, one
per mesh (i.e. like method #0, it does not sum meshes). The image is
divided horizontally into #num_meshes blocks, with the first mesh
listed being the left-most camera, and the last being the right-most.
The most obvious use of this would be with two meshes to generate a
stereo camera arrangement.

In this mode, you can (currently) only have a single ray per pixel.

- #3 : This method will reverse-map the face from the UV co-ordinates;
i.e. texture baking. When used back into the meshes, there are visible
seams, and AA will produce incorrect pixels on the outside edge of the
UV maps.

In this mode, you can (currently) only have a single ray per pixel.

You can use the smooth modifier to allow interpolation of the normals
at the vertices. This allows for use of UV mapped meshes as cameras,
with the benefit of not being resolution dependant, unlike the other
distributions.


+ mesh_object:
--------------

One or more mesh or mesh2 object to be used as camera. These will be
treated differently depending on the distribution method, as explained
above.

Transformations on the meshes can be used here, and will reflect on the
resulting image as it would be expected for a regular camera.


+ location:
-----------

On this special camera, location doesn't really tells where the camera
is placed (that information is on the mesh object itself), but is used
to move the origin of the ray slightly off the face, along the normal
of that face. The X and Y for location is not currently used, and the Z
always refers to the normal of the face, rather than the real Z
direction in the scene.


+ direction:
------------

Again, this doesn't correspond to the real direction vector of the
camera. It serves only to reverse the normal of all the faces, if
necessary. As with location, only the Z component is used.


-----
USAGE
-----

As I said above, this new feature has two main usages:


+ Texture baking:
-----------------

It is surely the usage that is going to be the most popular, because it
is something other packages already do, and because it can be very
useful for some specific and well established applications. I showed on
the demo the potential as a tool to accelerate POV-Ray renderings,
specially for camera animation, but the basics will apply when baking
for other purposes, like generating texture maps for external
applications (modelling packages, architectural presentations,
games, VR environments, etc...).

As it's expected, it only allows to bake meshes, so it will be only
useful when your scene consists mostly on meshes. That's why the demo
scene included on the zip uses only mesh objects created with Wings3D:
two vases and a room with a window. All of them have uv maps, which are
also necessary to bake the textures.

The idea is to set up a scene in a way that would allow for normal
rendering while developing the scene, later will allow to bake all the
textures (with lighting) to image files, and finally will allow the use
the baked textures to render the scene in much shorter time. The
benefits are multiple: you can enhance/change the textures with an
external paint program and render again in seconds, or add slow
features to the baked render, like micro-normals for blurred
reflections, focal blur, or any other feature wich used on a
direct render will be very slow.

To accomplish the baking step, I used the animation features so that
each mesh can be baked with a different value of the clock. Then, with
a little script, I launch all the baking renders with custom output
file names. These will be used later on a final step, where the lights
are off and the baked textures have all emission on the finish. The
baking script also calls to a "tool scene" which mitigates the problem
with visible seams on the UV maps.


+ Custom cameras:
-----------------

Perhaps not as exciting for the general public as the baking usage,
this alternative use has great potential for experimentation, and
surely will be the source for many useful tools that will use it for
the more varied effects.

For a start, my examples illustrate how to mimic a classic pinhole
camera, and how to add some interesting effects, like vignetting or
distortion. Other uses could include custom focal blur, simulating
specific lenses (with one or more elements), etc...

The basic premise of this approach is to use a mesh as a camera, but
without instantiating it into the scene, as it was done for baking.
Consider a standard POV camera: it could be represented as a mesh, with
one face per pixel, all faces being set in the same plane, with the
normal of the faces pointing in the direction of the camera, with
angles diverging from the camera location.

So, I started just with that... a simple mesh with image_width columns
and image_height rows of triangles, with all the normals pointing into
the scene in the correct way. Sounds simple, but it took me a while to
figure out the maths to do it, and a bit more learning how to use the
useful macros from transforms.inc. In the end, I was so confused that
my damaged brain decide to take a shortcut, and I was illuminated with
the idea of using trace() to overcome all the mathematical difficulties.

Finally I ended up writing a set of macros to help creating and placing
such camera meshes. Here are some quick informations about the macros:

    * The meshes are mesh{} objects, since mesh2{} will not get better
results, and the former is easier to create for me. 

    * The meshes are optionally written to an include file for later
use, as the creation process can be long for big resolutions. 

    * The mesh camera is created initially witouth a location or
look_at, as it  allows for easier creation, and for reuse of the camera
on different locations/scenes once written to file. 

    * An additional macro automates the transformations needed to place
the camera with the desired location and look_at. 

-----------
DEMO SCENES
-----------

Here is the description of the included demos and auxiliary files:

+ common files:
---------------

- demo_globals.inc

  Common global settings for all the scenes.
	
- demo_common.inc

  Common textures, object and lighting. 
  
- demo_room.inc

  Room used by all the demos, created with Wings3D.
  
- vase1.inc
- vase2.inc

  Test objects for all the demos, created with Wings3D.
  

+ texture baking:
-----------------

- baking_demo.pov

  Demo to show the baking possibilities. First, set use_baking to 0 to
see the scene witouth using any trick, just the "real thing". Then use
the script bake.sh to bake all the meshes on the scene. Finally, set
use_baking to 2 and render again to compare the results (and speed)
with the first render. 

- baking_repair_seams.pov

  Tool to mitigate the problem with visible UV seams on the baked
textures. 

- bake.sh

  Script to automatically bake and repair all the textures for the
demo. Calls the above scenes in turn for each mesh, with output files
named according to the ones used on the baked textures. 

+ custom cameras:
-----------------

- meshcam_macros.inc

  These are macros to help creating the grid-like meshes needed to make
a custom camera, with the desired horizontal angle. I implemented a classic 
pinhole camera, and a variant with optional lens distortion, as well as a 
typical orthographic camera. All the mesh cameras have an uv-mapped version,
for use withouth the need of a triangle per pixel. There is also a macro to 
help placing the camera at the desired "location", looking at the desired 
"look_at". 

- meshcam_persp_demo.pov

  Example usage for the meshcam macros with distrib. #0. It shows how to use
the macros to create a custom mesh for a perspective (pinhole) camera, and 
how to apply some effects, like antialiasing and vignetting, or how to save 
the mesh to a file for reuse. 

- meshcam_persps_demo_uv.pov

  Same as the above, but using the uv-version of the macros with distrib. #3 
and the smooth modifier, to avoid having to use a face for each pixel.

- meshcam_persp_compare.pov

  Tool to compare the pinhole mesh cameras created by the macros against the
default perspective camera. I used it to verify if my results did match the 
standard camera.

- meshcam_ortho_demo.pov, meshcam_ortho_demo_uv.pov

  Demo escenes for the orthographic mesh camera macros.

- meshcam_stereo_demo.pov

  Example scene for usage of the macros with distrib. #2, to set up a
stereo pair. 



--------------
UNTESTED IDEAS
--------------

  I had a lot of weird ideas during last weeks, but these are the ones
that where interesting enough for my brain to remember them:

+Texture baking:
----------------

- Baking "lighting maps" (that it's, baking with plain white textures
in all the objects), which can be used later to change the textures on
the "baked render" with little cost. 

- Baking pseudo-Ao maps for dirt patterns.

- Baking reflections for blurred reflections on stills?

- Baking maps for use on displacement mapping with Poseray.


+ Custom cameras:
-----------------

- More interesting projections.

- Focal blur, with several layers of meshes with faces perturbed
strategically?

- Using instances of the mesh camera in the scene, perhaps some
interesting effects could be achieved, like I did with vignetting...
I'm thinking for example on chromatic aberration.

- Creating camera animations in a long horizontal strip of frames,
using distrib. #2.



-- 
Jaime Vives Piqueres <jaime@ignorancia.org>
		
La Persistencia de la Ignorancia
http://www.ignorancia.org