Skip to content

Commit 7b8df04

Browse files
committed
Change output handling.
- Add support for bit depths as low as 1 bpc. - Add support for low-depth greyscale output. - Add support for greyscale preview. - Change PGM gamma handling. - Add more dither algorithms, including blue noise ordered dither. Also refactor some related code.
1 parent b297299 commit 7b8df04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2474
-772
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ $RECYCLE.BIN/
222222
# Files created by make in various subdirectories
223223
.dirstamp
224224

225+
# ===========================
226+
# POV-Ray meta-build detritus
227+
# ===========================
228+
229+
# Byte-compiled python modules
230+
*.pyc
231+
225232
# =====================
226233
# POV-Ray Miscellaneous
227234
# =====================

changes.txt

+13
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ Changed Behaviour
6868
`mixed`. See the documentation for details.
6969
- The dithering implementation has been modified, and may produce slightly
7070
different results for otherwise identical scenes.
71+
- The PGM (greyscale variant of PPM) output gamma handling now matches that
72+
of regular PPM, honoring `File_Gamma` defaulting to ITU-R BT.709. To get
73+
linear greyscale output, explicitly specify `File_Gamma=1.0`.
74+
- Greyscale output no longer automatically forces bit depth to 16 bpc. To get
75+
16 bpp greyscale output, explicitly specify `Bits_Per_Color=16`.
76+
- Preview now reflects greyscale setting.
7177

7278
New Features
7379
------------
@@ -85,6 +91,13 @@ New Features
8591
the list of control points.
8692
- The `matrix` syntax now allows allows for a trailing comma at the end of
8793
the list of coefficients.
94+
- File formats supporting variable bit depths (PNG and PPM/PGM) now allow for
95+
bit depths as low as 1 bit per colour channel. (1-bit greyscale PPM/PGM will
96+
still be written as PGM, not PBM.)
97+
- Command-line option `+F` now allows specifying both the `G` greyscale flag
98+
and the bit depth.
99+
- Support for blue noise dithering has been added, plus a couple more error
100+
diffusion dithering filters.
88101

89102
Performance Improvements
90103
------------------------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// POV-Ray 3.8 Scene File "dither_showcase.pov"
2+
// author: Christoph Lipka
3+
// date: 2018-09-30
4+
//
5+
//--------------------------------------------------------------------------
6+
#version 3.8;
7+
8+
#ifndef (Glow)
9+
#declare Glow = on;
10+
#end
11+
#ifndef (Brightness)
12+
#declare Brightness = 4.0;
13+
#end
14+
15+
global_settings {
16+
max_trace_level 5
17+
assumed_gamma 1.0
18+
radiosity {
19+
pretrace_start 0.08
20+
pretrace_end 0.01
21+
count 150
22+
nearest_count 20
23+
error_bound 0.5
24+
recursion_limit 2
25+
low_error_factor .5
26+
gray_threshold 0.0
27+
minimum_reuse 0.015
28+
brightness 1
29+
adc_bailout 0.01/2
30+
}
31+
}
32+
33+
#default {
34+
texture {
35+
pigment {rgb 1}
36+
finish {
37+
ambient 0.0
38+
diffuse 0.8
39+
specular albedo 1.0 roughness 0.001
40+
reflection { 1.0 fresnel on }
41+
conserve_energy
42+
fresnel on
43+
}
44+
}
45+
}
46+
47+
// ----------------------------------------
48+
49+
#local TestRed = <1.0,.03,.03>;
50+
#local TestGreen = <.03,1.0,.03>;
51+
#local TestBlue = <.03,.03,1.0>;
52+
53+
#local CameraFocus = <0,1,1>;
54+
#local CameraDist = 8;
55+
#local CameraDepth = 3.0;
56+
#local CameraTilt = 5;
57+
58+
camera {
59+
location <0,0,0>
60+
direction z*CameraDepth
61+
right x*image_width/image_height
62+
up y
63+
translate <0,0,-CameraDist>
64+
rotate x*CameraTilt
65+
translate CameraFocus
66+
}
67+
68+
#macro LightSource(Pos,Color)
69+
light_source {
70+
Pos
71+
color Color
72+
area_light x*vlength(Pos)/10, y*vlength(Pos)/10, 9,9 adaptive 1 jitter circular orient
73+
}
74+
75+
#end
76+
77+
LightSource(<-500,500,-500>, rgb Brightness)
78+
79+
// ----------------------------------------
80+
81+
plane {
82+
y, 0
83+
texture { pigment { color rgb 0.2 } }
84+
interior { ior 1.5 }
85+
}
86+
87+
#macro TestSphere(Pos,Radius,TargetColor,Hole)
88+
#if (Hole)
89+
union {
90+
#local Th = 20;
91+
#local R = 0.05;
92+
#local SinTh = sin(Th*pi/180);
93+
#local CosTh = cos(Th*pi/180);
94+
difference {
95+
sphere { <0,0,0>, 1 }
96+
cylinder { y, y*(1-R)*CosTh, SinTh }
97+
cylinder {-y,-y*(1-R)*CosTh, SinTh }
98+
cylinder { y,-y,(1-R)*SinTh-R }
99+
}
100+
torus { (1-R)*SinTh, R translate y*(1-R)*CosTh }
101+
torus { (1-R)*SinTh, R translate -y*(1-R)*CosTh }
102+
#else
103+
sphere { <0,0,0>, 1
104+
#end
105+
texture { pigment { color TargetColor }
106+
finish { emission Glow * Brightness * 0.5 }
107+
}
108+
interior { ior 1.5 }
109+
rotate z*30
110+
rotate y*clock*360 - y*45
111+
scale Radius
112+
translate Pos + y*Radius
113+
}
114+
#end
115+
116+
TestSphere(<-2,0,1>, 1, TestRed, false)
117+
TestSphere(< 0,0,1>, 1, TestBlue, true)
118+
TestSphere(< 2,0,1>, 1, TestGreen, false)

source/base/data/bluenoise64a.cpp

+307
Large diffs are not rendered by default.

source/base/data/bluenoise64a.h

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
//******************************************************************************
2+
///
3+
/// @file base/data/bluenoise64a.h
4+
///
5+
/// Blue noise pattern data
6+
/// Auto-generated using metagen-bluenoise.py.
7+
///
8+
/// @copyright
9+
/// @parblock
10+
///
11+
/// Persistence of Vision Ray Tracer ('POV-Ray') version 3.8.
12+
/// Copyright 1991-2018 Persistence of Vision Raytracer Pty. Ltd.
13+
///
14+
/// POV-Ray is free software: you can redistribute it and/or modify
15+
/// it under the terms of the GNU Affero General Public License as
16+
/// published by the Free Software Foundation, either version 3 of the
17+
/// License, or (at your option) any later version.
18+
///
19+
/// POV-Ray is distributed in the hope that it will be useful,
20+
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
/// GNU Affero General Public License for more details.
23+
///
24+
/// You should have received a copy of the GNU Affero General Public License
25+
/// along with this program. If not, see <http://www.gnu.org/licenses/>.
26+
///
27+
/// ----------------------------------------------------------------------------
28+
///
29+
/// POV-Ray is based on the popular DKB raytracer version 2.12.
30+
/// DKBTrace was originally written by David K. Buck.
31+
/// DKBTrace Ver 2.0-2.12 were written by David K. Buck & Aaron A. Collins.
32+
///
33+
/// @endparblock
34+
///
35+
//******************************************************************************
36+
37+
/// @file
38+
/// @attention
39+
/// **DO NOT EDIT THIS FILE!**
40+
/// Instead, if this file needs fixing, modify metagen-bluenoise.py
41+
/// or its invocation in `tools/meta-make/Makefile` accordingly,
42+
/// and re-generate this file as described in @ref tools-metamake (`tools/meta-make/readme.md`).
43+
44+
namespace pov_base {
45+
46+
extern const unsigned short kBlueNoise64a[4096];
47+
48+
}

0 commit comments

Comments
 (0)