[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz ./TODO Documentation/Manuscripts/gzigzag.bi...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz ./TODO Documentation/Manuscripts/gzigzag.bi... |
Date: |
Fri, 15 Nov 2002 03:11:46 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/11/15 03:11:44
Modified files:
. : TODO
Documentation/Manuscripts: gzigzag.bib
Documentation/Manuscripts/Irregu: irregu.tex
gfx/demo : fillets.py irregu4.py texlab.py
gfx/libtexture : noise.texture
gfx/libutil : Perlin.hxx perlin.cxx saveanim.py
gzz/util : saveimage.py
Log message:
Train trip: article, filming
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.399&tr2=1.400&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Documentation/Manuscripts/gzigzag.bib.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Documentation/Manuscripts/Irregu/irregu.tex.diff?tr1=1.42&tr2=1.43&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/fillets.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregu4.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/texlab.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libtexture/noise.texture.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/Perlin.hxx.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/perlin.cxx.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/saveanim.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/util/saveimage.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
Patches:
Index: gzz/Documentation/Manuscripts/Irregu/irregu.tex
diff -u gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.42
gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.43
--- gzz/Documentation/Manuscripts/Irregu/irregu.tex:1.42 Thu Nov 14
09:11:16 2002
+++ gzz/Documentation/Manuscripts/Irregu/irregu.tex Fri Nov 15 03:11:44 2002
@@ -359,6 +359,9 @@
yield an acceptable performance. Also, it is easier to avoid
aliasing artifacts in the texture approach..
+This approach, generating shape through texture, is similar to
+the one used by Perlin in \cite{perlin-hypertexture} for synthesizing
+solid shapes.
\subsection{Drawing the shape}
@@ -588,6 +591,10 @@
In this section, we discuss a zoomable user interface (XXX REFS)
where panning and showing the current scale through the torn edge are
more important.
+
+\subsection{``Jigsaw puzzle'' view}
+
+One application...
\section{Conclusions}
Index: gzz/Documentation/Manuscripts/gzigzag.bib
diff -u gzz/Documentation/Manuscripts/gzigzag.bib:1.59
gzz/Documentation/Manuscripts/gzigzag.bib:1.60
--- gzz/Documentation/Manuscripts/gzigzag.bib:1.59 Tue Nov 12 05:41:27 2002
+++ gzz/Documentation/Manuscripts/gzigzag.bib Fri Nov 15 03:11:44 2002
@@ -1353,6 +1353,16 @@
year = "1985"
}
address@hidden perlin-hypertexture,
+ author = "Ken Perlin, Eric M. Hoffert",
+ title = "Hypertexture",
+ journal = "Computer Graphics",
+ volume = "23",
+ number = "3",
+ pages = "253--262",
+ year = "1989"
+}
+
@book{ texturing-and-modeling,
editor="David S. Ebert",
title="Texturing and Modeling --- A Procedural Approach",
Index: gzz/TODO
diff -u gzz/TODO:1.399 gzz/TODO:1.400
--- gzz/TODO:1.399 Fri Nov 15 02:46:29 2002
+++ gzz/TODO Fri Nov 15 03:11:44 2002
@@ -12,6 +12,10 @@
0.8alpha4: Cleanup release after crucial demos; make it possible for anyone to
get *THE* demo up and running
jvk:
+ - obtain Heckbert, 1986, survey of texture mapping!
+ - try to obtain Catmull 74 texture stuff
+ - irregu4: motion is wrong: here, if paper stays still
+ to screen, we *will* have the wrong interpretation!
- abstract out irregu implementations so Tjl can make demo movie easily.
- Add the important references to gzz.bib. With URLs, if possible.
- test opengl/imaging on NV25: any faster?
@@ -67,10 +71,8 @@
in JAVA code, and the result passed as a parameter to
createPaperQuad, since that's the most flexible approach.
tjl:
- - buoy null tests
- demo movie of irregu general stuff
- demo movie of xupdf
- - shader for fBm for irregu
+ polygon puzzle view
+ [GI03] irregu animations
+ [GI03] paper animations?
@@ -299,6 +301,7 @@
- Main zz view:
- Clipping in awt
- porting: make sure all demos etc. work with plain mesa
+ - implement Perlin's "improving noise" paper
0.8alpha6: Another doc round
Index: gzz/gfx/demo/fillets.py
diff -u gzz/gfx/demo/fillets.py:1.9 gzz/gfx/demo/fillets.py:1.10
--- gzz/gfx/demo/fillets.py:1.9 Mon Oct 7 03:40:03 2002
+++ gzz/gfx/demo/fillets.py Fri Nov 15 03:11:44 2002
@@ -173,7 +173,7 @@
self.putCells(vs, rot)
- sca = vs.matcher.add(vs.coords.scaleXYZ(rot, 1, 1, 0.01), "sca")
+ sca = vs.matcher.add(vs.coords.scale(rot, 1, 1, 0.01), "sca")
vs.map.put(getDList("""
Enable BLEND
@@ -204,9 +204,9 @@
wid, h = (600, 600)
l = 300
cc=[(vs.matcher.addSub(into,
- vs.coords.coordsys(into, d, 0, -2*l, wid/2,
h/2),"foo"+str(d)),
+ vs.coords.ortho(into, d, 0, -2*l, wid/2,
h/2),"foo"+str(d)),
vs.matcher.addSub(into,
- vs.coords.coordsys(into, d, -0.75*wid*self.movel, 2*l,
wid/2, h/2), "bar"+str(d)))
+ vs.coords.ortho(into, d, -0.75*wid*self.movel, 2*l, wid/2,
h/2), "bar"+str(d)))
for d in (600, 800)]
putnoc(vs, getDList("""
@@ -366,7 +366,7 @@
def putcs(self, vs):
for x in range(0,self.cw):
for y in range(0, self.ch):
- self.cs[x][y]=vs.coords.coordsys(str(x)+"_"+str(y), 10,
+ self.cs[x][y]=vs.coords.ortho(str(x)+"_"+str(y), 10,
x + 0.2 , y + 0.2, 0.6, 0.6)
def key(self, k):
if k == "s":
@@ -501,7 +501,7 @@
for y in (2-dy,2,2+dy)]
cs = []
for ctr in ctrs:
- coordsys = vs.coords.coordsys(0, 20, ctr[0], ctr[1], w/2, h/2)
+ coordsys = vs.coords.ortho(0, 20, ctr[0], ctr[1], w/2, h/2)
vs.matcher.add(coordsys, str(dx)+str(ctr[1]))
cs.append((coordsys, ctr))
for c in cs:
@@ -574,7 +574,11 @@
sc.scene(vs1)
sc.key("p")
sc.scene(vs2)
- saveanim.savesequence(w, "/tmp/anim", vs1, vs2, 20)
+ saveanim.savesequence(w, "tmpfilm/frame0.", vs1, vs2, 40)
+ saveanim.savesequence(w, "tmpfilm/frame1.", vs2, vs1, 20)
+
+ saveanim.encodefilm("tmpfilm/frame*", "filletfilm.avi")
+
return 0
currentScene = scenes[0]
Index: gzz/gfx/demo/irregu4.py
diff -u gzz/gfx/demo/irregu4.py:1.14 gzz/gfx/demo/irregu4.py:1.15
--- gzz/gfx/demo/irregu4.py:1.14 Fri Nov 15 03:05:01 2002
+++ gzz/gfx/demo/irregu4.py Fri Nov 15 03:11:44 2002
@@ -8,10 +8,17 @@
pap = ThePaperMill().getPaper(seed)
paperquad = GLRen.createPaperQuad(pap, -4, -4, 4, 4, 0)
-textures = [ ("sawnoise",
+textures = [
+ ("noise",
+
"type,fBm,freq,4,bias,.5,scale,.5,fbmlacu,1.5,fbmgain,.8,fbmoct,10"),
+("sawnoise",
"bias,0.5,scale,0.15,freq,1,df,2,scale2,0.25,freq2,10,df2,.5"),
("fnoise",
"scale,0.2,freq,4,df,4,bias,0.5"),
+
+ ("noise",
+ "type,fBm,freq,4,bias,5,scale,.25"),
+
]
ripple_scale = 0.25
@@ -442,8 +449,7 @@
self.shape = int(k[1:]) - 1
self.initcode()
elif k == "t":
- global textures
- textures = textures[1:] + textures[:1]
+ rotatelist(textures)
inittex()
self.initcode()
Index: gzz/gfx/demo/texlab.py
diff -u gzz/gfx/demo/texlab.py:1.13 gzz/gfx/demo/texlab.py:1.14
--- gzz/gfx/demo/texlab.py:1.13 Fri Oct 25 10:20:15 2002
+++ gzz/gfx/demo/texlab.py Fri Nov 15 03:11:44 2002
@@ -12,6 +12,21 @@
tres = 128
args = [
+ [256, 256, 0, 4, "RGBA", "RGBA", "noise",
+ ["bias", "0", "scale", "1.0", "type", "faBm",
+ "freq", "10"]],
+
+ [256, 256, 0, 4, "RGBA", "RGBA", "noise",
+ ["bias", "0", "scale", "0.7", "type", "faBm",
+ "fbmlacu","1.5",
+ "fbmoct", "20",
+ "fbmgain", ".8",
+ "freq", "10"]],
+
+ [256, 256, 0, 4, "RGBA", "RGBA", "noise",
+ ["bias", "0.5", "scale", "0.5", "type", "faBm",
+ "freq", "3"]],
+
#[128, 128, 0, 4, "RGBA", "RGBA", "noise",
# ["bias", "0.5", "scale", "0.15",
# "fbm", "1", "freq", "1", "freq2", "16", "df", "1"]],
Index: gzz/gfx/libtexture/noise.texture
diff -u gzz/gfx/libtexture/noise.texture:1.2
gzz/gfx/libtexture/noise.texture:1.3
--- gzz/gfx/libtexture/noise.texture:1.2 Tue Sep 3 06:14:47 2002
+++ gzz/gfx/libtexture/noise.texture Fri Nov 15 03:11:44 2002
@@ -2,46 +2,34 @@
#include <math.h>
#define FPARAM(name, default) float name = params->getFloat(#name, default);
+#define SFPARAM(name, default) name = params->getFloat(#name, default);
-/** Signed noise, Any number of components, with or without discontinuities.
- */
-static void std_noise(TextureParam *params, int width, int height, int depth,
int components, float *data) {
-
- FPARAM(freq, 5);
- FPARAM(discfreq, 0);
- FPARAM(scale, 1);
+typedef float (*FUNC)(float *p);
- int ind=0, i, j, k;
- for (k = 0; k < depth; k++) {
- for (j = 0; j < height; j++) {
- for (i = 0; i < width; i++) {
+float f_noise(float *p) {
+ return Perlin::noise3(p);
+}
- // 0..1
- float x = ((float)i)/(width-1);
- float y = ((float)j)/(height-1);
- float z = (depth==1?0:((float)k)/(depth-1));
-
- float org = 0;
- if(discfreq)
- org = Perlin::noise(discfreq*x, discfreq*y, 0.5+discfreq*z);
-
- for(int c = 0; c < components; c++) {
- data[ind+c] = Perlin::noise(freq*x, freq*y, freq*z +
- 8.5+ 50.1* ((c+(org>0))%components))*scale;
- }
- ind += components;
- }
- }
- }
+static float turbfreq = 1; // !! nasty global
+float f_turb(float *p) {
+ return Perlin::turbulence(p, turbfreq);
+}
+static int fbmoct = 1;
+static float fbmlacu = 1;
+static float fbmgain = 1;
+float f_fBm(float *p) {
+ return Perlin::fBm(p, fbmoct, fbmlacu, fbmgain);
+}
+float f_faBm(float *p) {
+ return Perlin::faBm(p, fbmoct, fbmlacu, fbmgain);
}
-/** Positive turbulence, Any number of components, with or without
discontinuities.
+/** Calculate and add a single cube of data to given array.
*/
-static void std_turb(TextureParam *params, int width, int height, int depth,
int components, float *data) {
+static void cube(FUNC f, float scale, TextureParam *params, int width, int
height, int depth, int components, float *data) {
FPARAM(freq, 5);
- FPARAM(scale, 1);
int ind=0, i, j, k;
for (k = 0; k < depth; k++) {
@@ -49,13 +37,16 @@
for (i = 0; i < width; i++) {
// 0..1
- float x = ((float)i)/(width-1);
- float y = ((float)j)/(height-1);
- float z = (depth==1?0:((float)k)/(depth-1));
+ float par[3] = {
+ freq * ((float)i)/(width-1)+.3,
+ freq * ((float)j)/(height-1)+.3,
+ freq * (depth==1?0:((float)k)/(depth-1))+.3
+ };
+
for(int c = 0; c < components; c++) {
- float par[3] = { x, y, 8.5 + 28*c + z };
- data[ind+c] = Perlin::turbulence(par, freq)*scale;
+ data[ind+c] += f(par) * scale;
+ par[2] += 21.419;
}
ind += components;
}
@@ -64,7 +55,6 @@
}
-
inline float mix(float t, float a, float b) {
//return t*a + (1-t)*b;
@@ -76,16 +66,23 @@
}
void GENERATE(TextureParam *params, int width, int height, int depth, int
components, float *data) {
- int tilewidth = (int)(width * .25);
- int tileheight = (int)(height * .25);
- int tiledepth = (int)(depth * .25);
+ int tilewidth = (int)(width * .5);
+ int tileheight = (int)(height * .5);
+ int tiledepth = (int)(depth * .5);
FPARAM(bias, 0);
+ FPARAM(scale, 1);
+
+ SFPARAM(turbfreq, 100);
+ SFPARAM(fbmoct, 5);
+ SFPARAM(fbmlacu, 1.94);
+ SFPARAM(fbmgain, 0.5);
float *data0 = new float[(width + tilewidth) *
(height + tileheight) *
(depth + tiledepth) * components];
+ FUNC f;
switch(params->getStringEnum("type", 0,
"normal",
"turbulence",
@@ -93,19 +90,22 @@
"faBm",
0)) {
case 1:
- std_turb(params, width + tilewidth, height + tileheight,
- depth + tiledepth, components, data0);
+ f = f_turb;
break;
case 2:
+ f = f_fBm;
break;
case 3:
+ f = f_faBm;
break;
default:
case 0:
- std_noise(params, width + tilewidth, height + tileheight,
- depth + tiledepth, components, data0);
+ f = f_noise;
break;
}
+
+ cube(f, scale, params, width + tilewidth, height + tileheight,
+ depth + tiledepth, components, data0);
#define D0(x, y, z, c) data0[((x) + (y)*(width+tilewidth) + \
Index: gzz/gfx/libutil/Perlin.hxx
diff -u gzz/gfx/libutil/Perlin.hxx:1.4 gzz/gfx/libutil/Perlin.hxx:1.5
--- gzz/gfx/libutil/Perlin.hxx:1.4 Thu Sep 5 07:19:33 2002
+++ gzz/gfx/libutil/Perlin.hxx Fri Nov 15 03:11:44 2002
@@ -11,6 +11,7 @@
* No license has been specified in this code or on the web page,
* so I'm assuming it's freely distributable and including it here.
* If this is not the case, please inform me and I will remove it promptly.
+ * <p>
*/
namespace Perlin {
float bias(float a, float b) ;
@@ -48,5 +49,6 @@
inline float smooth_step(float t, float low, float high) {
return smooth_step( (t-low) / (high-low) );
}
+
}
#endif
Index: gzz/gfx/libutil/perlin.cxx
diff -u gzz/gfx/libutil/perlin.cxx:1.3 gzz/gfx/libutil/perlin.cxx:1.4
--- gzz/gfx/libutil/perlin.cxx:1.3 Wed Aug 7 05:50:43 2002
+++ gzz/gfx/libutil/perlin.cxx Fri Nov 15 03:11:44 2002
@@ -6,6 +6,8 @@
* No license has been specified in this code or on the web page,
* so I'm assuming it's freely distributable and including it here.
* If this is not the case, please inform me and I will remove it promptly.
+ *
+ * The code has been slightly modified for C++.
*/
#include <stdlib.h>
Index: gzz/gfx/libutil/saveanim.py
diff -u gzz/gfx/libutil/saveanim.py:1.2 gzz/gfx/libutil/saveanim.py:1.3
--- gzz/gfx/libutil/saveanim.py:1.2 Wed Oct 16 03:46:39 2002
+++ gzz/gfx/libutil/saveanim.py Fri Nov 15 03:11:44 2002
@@ -1,16 +1,23 @@
-# A module for saving an image frame from the current front buffer
+# Saving demo sequences
-from java.io import FileOutputStream
+from gzz.util import saveimage
from gzz.gfx.gl import GL
import os
-def save():
+def saveframe(filename, win):
x,y = 0,0
s = win.getSize()
- colors = win.readPixels(0, 0, s.width, s.height)
+ pix = win.readPixels(0, 0, s.width, s.height)
+ saveimage.save(filename, pix, s.width, s.height)
def savesequence(win, filebase, vs1, vs2, n):
for frame in range(0, n+1):
fract = frame / (n+0.0)
win.renderAnim(vs1, vs2, fract, 0, 1)
saveframe(filebase + "%03d"%frame + ".jpg", win)
+
+def encodefilm(globpat, outfilm):
+ mencoder = "/BIG/MPlayer-0.90pre8/mencoder"
+ os.system("%(mencoder)s %(globpat)s -lavcopts vcodec=mpeg4 -mf on:fps=25
-ovc lavc -o %(outfilm)s"
+ % locals())
+
Index: gzz/gzz/util/saveimage.py
diff -u gzz/gzz/util/saveimage.py:1.1 gzz/gzz/util/saveimage.py:1.2
--- gzz/gzz/util/saveimage.py:1.1 Wed Oct 16 03:50:48 2002
+++ gzz/gzz/util/saveimage.py Fri Nov 15 03:11:44 2002
@@ -2,9 +2,13 @@
from java.io import FileOutputStream
import os
+# A module for saving an image frame from the current front buffer
+
def save(filename, pixels, w, h):
+ """Save an int[] array of pixel values.
+ """
f = FileOutputStream("img.tmp")
SaveImage.writeBytesRGB(f, pixels)
f.close()
- os.system("rawtoppm %(w)s %(h)s img.tmp | pnmtopng >%(filename)s" %
locals())
+ os.system("rawtoppm %(w)s %(h)s img.tmp | convert - %(filename)s" %
locals())
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz ./TODO Documentation/Manuscripts/gzigzag.bi...,
Tuomas J. Lukka <=