code logs -> 2011 -> Thu, 08 Sep 2011< code.20110907.log - code.20110909.log >
--- Log opened Thu Sep 08 00:00:51 2011
00:01 Derakon [chriswei@Nightstar-f68d7eb4.ca.comcast.net] has quit [[NS] Quit: leaving]
00:16
< gnolam>
McMartin: hah
00:41 shade_of_cpux is now known as cpux
00:43 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has joined #code
00:43 Derakon[AFK] is now known as Derakon
01:06 Attilla [Some.Dude@Nightstar-f29f718d.cable.virginmedia.com] has quit [[NS] Quit: ]
01:32 Thaqui [Thaqui@27B34E.D54D49.F53FA1.6A113C] has quit [Ping timeout: 121 seconds]
02:17 gnolam [lenin@Nightstar-202a5047.priv.bahnhof.se] has quit [[NS] Quit: Z?]
02:43 Kindamoody[zZz] is now known as Kindamoody
02:50 Rhamphoryncus [rhamph@Nightstar-14eb6405.abhsia.telus.net] has quit [Client exited]
03:42 Kazriko [kaz@4CA975.462904.08E9A2.992A2D] has quit [Connection closed]
04:28 cpux is now known as shade_of_cpux
04:32 * Tarinaky hmms.
04:33
<@Tarinaky>
How do I draw a sphere in a procedural way when I'm not allowed to use anything like the opengl function for it :/
04:38 Kazriko [kaz@4CA975.462904.08E9A2.992A2D] has joined #code
04:43
< Vornicus>
coords = [[(math.cos(k * math.pi / detail - math.pi/2) * math.sin(j * 2 * pi / detail), math.sin(k * math.pi / detail - math.pi / 2), math.cos(k * pi / detail - pi/2) * math.cos(j * 2 * pi / detail)) for j in range(detail)] for k in range(detail)]
04:44
< Vornicus>
There's your coordinates.
04:44
< Vornicus>
That will give you a radius 1 sphere centered on the origin, with the poles in the y direction.
04:45
< Vornicus>
In the alternative: you could geodesate an object like an icosahedron; I used that to good effect once.
05:35
<@Tarinaky>
It took me an entire day to get http://i55.tinypic.com/2aag9c7.png >.<
05:35
<@Tarinaky>
I'm aweful, lol.
05:35
<@Tarinaky>
And yeah. I finally found something on google and an icosahedron that's subdivided looks like the way to go.
05:35 Vash [Vash@Nightstar-f03c5637.sd.cox.net] has joined #code
05:41 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
05:49
< Vornicus>
I've got spectacularly horrible C++ code that does subdivisions.
05:50
< Vornicus>
of an icosahedron that is.
05:57
<@Tarinaky>
Heh.
06:06
< Vornicus>
(it's bad.)
06:08
<@Tarinaky>
The next problem is how I should adapt the heightmap generator.
06:08
<@Tarinaky>
But I guess starting with just a plain sphere is enough to start with >.>
06:08
< Vornicus>
Yeah.
06:09
< Vornicus>
THe hm generator - what are you using, subdivide with random perturbation?
06:09
<@Tarinaky>
diamond-square.
06:10
< Vornicus>
Yeah, that thing. okay.
06:10
<@Tarinaky>
I'll probably change it to something more advanced later but for now it's fine.
06:10
< Vornicus>
diamond-square works nicely.
06:13
< Vornicus>
though with the icosahedral thing you'll want something that works on triangles, not squares.
06:16
<@Tarinaky>
Yeah,
06:43 Derakon is now known as Derakon[AFK]
07:36 Kindamoody is now known as Kindamoody|out
07:57 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
08:52 Vash [Vash@Nightstar-f03c5637.sd.cox.net] has quit [[NS] Quit: BWAHAHAHAHHA! ]
09:05 Vornicus is now known as Vornicus-Latens
09:14 You're now known as TheWatcher
09:23
<@Tarinaky>
I'm struggling to work out how textures are stored/written/converted/whatever for non-rectangular shapes.
09:24
<@Tarinaky>
Anyone care to give me a hand?
09:30
< Vornicus-Latens>
Sphere again?
09:31
< Vornicus-Latens>
Or more generally?
09:31
<@jerith>
A hand is a pretty complicated shape to texture...
09:31
< TheWatcher>
Tarinaky: Textures are always rectangular, you use UV mapping to map bits of geometry to points on the texture
09:31
< Vornicus-Latens>
Hooray, UV mapping
09:32
< Vornicus-Latens>
(I made, once, a map projection that reduced stretching artifacts on the sphere. I never got around to writing out the actual UV mapping function)
09:33
<@Tarinaky>
Ahah.
09:35
<@Tarinaky>
And yeah, I'm thinking of the sphere again since it's a height map.
09:36
<@Tarinaky>
I was having a hard time getting my head around what a height map of a sphere looks like in memory.
09:36
<@Tarinaky>
:p
09:39 * Vornicus-Latens should put the images back up on that lj post.
09:41
< Vornicus-Latens>
http://www.flickr.com/photos/7861878@N06/3558750328/in/photostream but here's the upshot.
09:43
< Vornicus-Latens>
http://en.wikipedia.org/wiki/Dymaxion_map there's also this which may give you different ideas.
09:47
<@Tarinaky>
Yes. While I was walking my brothers the Dymaxion map was what I was thinking of.
09:49
<@Tarinaky>
Since it makes sense if I'm representing the sphere as an icosohedron and just performing sub divisions to interpolate the surface when you look at it.
09:49
< TheWatcher>
"walking your brothers"... not sure I want to know.
09:49
<@Tarinaky>
I had to walk them to school.
09:49
< TheWatcher>
Aaah
09:49
<@Tarinaky>
They just started a new school.
09:50
<@Tarinaky>
But I have no idea how I go about generating a triangle and mapping it to a polygon.
09:50
<@Tarinaky>
Or whatever I mean
09:53
<@Tarinaky>
If I understand UV mapping correctly, if we were applying it to a triangle... You'd have more data for the top corner and less data describing the bottom corners, yes?
10:00
< TheWatcher>
depends how you map it. For example: http://fleet.starforge.co.uk/images/triangle.jpg has the bottom left half of the square mapped onto a triangle (show in red)
10:02
<@Tarinaky>
404
10:02
< TheWatcher>
doh, http://fleet.starforge.co.uk/images/triangle.png
10:04
<@Tarinaky>
I guess, but cropping isn't very useful in my case.
10:05
<@Tarinaky>
Since then the pieces won't fit.
10:06
< TheWatcher>
Reuse the other half for something else. Or better, have a whole bunch of triangle-friendly pieces on one big texture, as swapping texture units is a significant overhead
10:07
<@Tarinaky>
I'm drawing it procedurally so I'm trying to understand it conceptually as much as possible rather than the semantics of how many pixel buffers I'm using >.>
10:07
<@Tarinaky>
Self-similarity ftw.
10:08
<@Tarinaky>
Does it not matter that that example is for a right-angled triangle but an icosohedron is a tessilation of equilateral triangles?
10:09
<@Tarinaky>
Or is that just a case of setting up the mapping to mangle it in the right way?
10:09
< TheWatcher>
Just set your map up appropriately, yes
10:11 * Tarinaky draws a picture to see if he understands how UV mapping works.
10:16
<@Tarinaky>
http://fleet.starforge.co.uk/images/triangle.png
10:17
<@Tarinaky>
Err
10:17
<@Tarinaky>
Come on, copy you silly thing.
10:17
<@Tarinaky>
http://i53.tinypic.com/243i6f4.png here
10:18
<@Tarinaky>
So I set the coordinates in red to the texture and the shape.
10:18
<@Tarinaky>
And it'll know how to mangle it, aye?
10:19
< Vornicus-Latens>
Note: UV mapped tirangles don't have to use whole number coordinates; you can stuff many different things into a single texture.
10:20 * Vornicus-Latens has clowns.
10:20
<@Tarinaky>
I was just using units because maths.
10:20
< Vornicus-Latens>
(Minecraft for instance uses a single large texture for all the terrain.)
10:21 * Tarinaky will shortly be a maths dual hons, if you ask me to think of two numbers they'll be 0 and 1 :p
10:21
< Vornicus-Latens>
heh
10:23
<@Tarinaky>
Okay. So. Having established that I can create the maps as squares still and just transform them to fit. How the hell do I tessilate this thing :/
10:23 * Tarinaky goes get a d20.
10:26
< Vornicus-Latens>
Trying to do an icosahedron in a texture can be painful
10:26
< Vornicus-Latens>
And it won't necessarily match your heightmap.
10:26
<@Tarinaky>
What do you mean?
10:28
< Vornicus-Latens>
What I mean is
10:28
< Vornicus-Latens>
If you've got a heightmap that you're stuffing onto a sphere, that heightmap won't, um
10:28
<@Tarinaky>
I don't currently have a heightmap.
10:29
<@Tarinaky>
I will have a heightmap, when I choose to generate one at run time.
10:29
<@Tarinaky>
If that's what you mean?
10:29
< Vornicus-Latens>
The edges of the heightmap will not line up with straight lines of the texture. YOu'll have to have extra space around your UV maps for diagonal texture lines so that you don't get strange overlap.
10:30
< Vornicus-Latens>
(because if you don't have that extra space, because the net isn't perfect, you'll have non-adjacent edges being next to each other, and you'll get contamination.)
10:31
<@Tarinaky>
I'm still not quite following.
10:32
< Vornicus-Latens>
Imagine that you've UV-mapped your icosahedron such that there are two triangles next to each other on the texture, but not on the actual map, and that these two triangles share a diagonal line on the texture.
10:32
< Vornicus-Latens>
Now: color one of those faces blue, and the other red.
10:32
<@Tarinaky>
A diagonal line?
10:32
< Vornicus-Latens>
As opposed to one that's vertical or horizontal. On the 2d texture.
10:33
< Vornicus-Latens>
What you'll get is, along one of the edges of the blue face, some red.
10:34
<@Tarinaky>
Oh, I see.
10:34
<@Tarinaky>
And there's no way of arranging the faces of the texture so there're no non-neighbours?
10:34
< Vornicus-Latens>
None.
10:34
< Vornicus-Latens>
Note: if you turn on non-nearest-neighbor filtering, you'll get the same problem even on straight lines.
10:35
<@Tarinaky>
Okay. So what do you suggest?
10:36
< Vornicus-Latens>
(which is why there's no option to do so in Minecraft; since it's doing picking from a single texture, turning on filtering would make things show up weird)
10:37
<@Tarinaky>
There're an even number of faces so I can pair off all the faces into squares. So that's 10 textures.
10:39
< Vornicus-Latens>
You could do any of the following, all of which I have actually seen done: texture mapping by height instead of lat/long, or in addition to lat/long, using a 3d texture (Populous: the Beginning). Mapping several textures to the world (I don't know one that does this really, but it should work. You could also do ad-hoc texturing, with different textures for each "kind" of terrain and do fades
10:39
< Vornicus-Latens>
between them instead of trying to draw it all on one texture.
10:40
< Vornicus-Latens>
Sim City 3 also used the 3d texture technique; the height-alone texture gives plains of solid color.
10:40
<@Tarinaky>
What does by height mean?
10:41
<@Tarinaky>
Also, strictly speaking this is displacement mapping rather than texture mapping.
10:41
< Vornicus-Latens>
Ah, you're just working on the displacement yet.
10:41
<@Tarinaky>
Yeah.
10:42 AnnoDomini [annodomini@60F158.737D66.CA1918.CC7562] has joined #code
10:43
< Vornicus-Latens>
Okay, you're going to want, I believe, the 10 texture thing, for that.
10:43
<@Tarinaky>
10 seperate textures?
10:43
<@Tarinaky>
Also, I'm still not sure if all the pairs are adjacent >..
10:45
< Vornicus-Latens>
What do you mean?
10:46
<@Tarinaky>
As in I'm not sure there're 10 pairs of adjacent faces.
10:46
< Vornicus-Latens>
You cycle around a single corner as the pole.
10:46
<@Tarinaky>
There're 5 faces at each pole.
10:46
< Vornicus-Latens>
Your squares then extend past the equator to the opposite, um, "tropic"
10:47
<@Tarinaky>
Oh wait.
10:47
<@Tarinaky>
DERP.
10:47
<@Tarinaky>
Thanks for tht.
10:47
<@Tarinaky>
I'm a right spoon sometimes :p
10:57 Attilla [Some.Dude@Nightstar-f29f718d.cable.virginmedia.com] has joined #code
11:05 AnnoDomini [annodomini@60F158.737D66.CA1918.CC7562] has quit [[NS] Quit: Time for more reading.]
11:07
< Vornicus-Latens>
SPOOOOOOOON
11:08
< Vornicus-Latens>
Yeah. Anyway you may wish to use (in the 256x256 case) 1/512 and 511/512 as your UVs when you map textures to your heightfield; that's the centers of the texels.
11:09
< Vornicus-Latens>
This will avoid certain categories of pain - your textures will mesh up nicely at the edges.
11:09
< Vornicus-Latens>
On the other hand they will fall out of phase with the heightfield toward the middle.
11:09
<@Tarinaky>
I don't understand what 1/512 means?
11:09
< Vornicus-Latens>
As opposed to 0.
11:10
<@Tarinaky>
I'm not actually generating a texture though.
11:10
<@Tarinaky>
Oh wait, misread.
11:10
<@Tarinaky>
Why 512?
11:10
< Vornicus-Latens>
Because 1/512th is half a pixel.
11:11
<@Tarinaky>
Oh I see.
11:12
< Vornicus-Latens>
(though that meshing thing only really works wi-- wait, remembering something)
11:12
< Vornicus-Latens>
Ignore my previous advice, it's a damn lie
11:13
<@Tarinaky>
Will do.
11:13
<@Tarinaky>
To be honest, I'm currently expecting to bake the colour maps using some built in render to texture stuff.
11:14
< Vornicus-Latens>
You can, in addition to the actual "texture data", specify "border data" that goes beyond the edge of the texture. Set that to whatever's adjacent to your squares and then 1. filtering meshes nicely and 2. non-filtering meshes nicelt and 3. stuff in the middle lines up again.
11:15
<@Tarinaky>
I'll worry about that later :p
11:15
< Vornicus-Latens>
Of course.
11:15
<@Tarinaky>
Right now I've got to figure out how to specify vertex data for an iscosohedron.
11:15
< Vornicus-Latens>
Twenty triangles.
11:15
<@Tarinaky>
Yes, but what points define those triangles :p
11:16
<@Tarinaky>
BRB, food and stuff.
11:16
< Vornicus-Latens>
If you need the actual corner coordinates, cyclic permutations of <0, 1, golden ratio>
11:22
<@Tarinaky>
Right. Chips are in.
12:04 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
12:15 Rhamphoryncus [rhamph@Nightstar-14eb6405.abhsia.telus.net] has joined #code
13:46 gnolam [lenin@9D46A2.F4E9D7.E4B4CF.2072AD] has joined #code
14:32 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has joined #code
14:57
< kwsn>
so i'm turning into a jack of all trades it seems at my work o-o;;
15:03
< gnolam>
Oh?
15:25
< Simon_Shine>
in Haskell, there's a function called const. is there one that works the opposite way? that is, introduces a variable that'll never get called.
15:26
< Simon_Shine>
instance Sizeable (Tree a) where
15:26
< Simon_Shine>
size = treefold (\_ acc -> acc + 1) 0
15:26
< Simon_Shine>
I'm trying to make a lambda-free expression for the folding function.
15:26
< Simon_Shine>
whoops. I just realized that I'm calculating it wrong. but I'm still curious.
16:32
< gnolam>
http://www.smbc-comics.com/index.php?db=comics&id=2362
16:34
< ToxicFrog>
Simon_Shine: what does const do?
17:01
< Simon_Shine>
ToxicFrog, const evaluates to the first argument of a function that takes two arguments
17:01
< Simon_Shine>
const f a b = a
17:02
< ToxicFrog>
What's the use case?
17:04
< Simon_Shine>
ToxicFrog, well, I wanted to rewrite (\_ acc -> acc + 1) in terms of standard combinators
17:05 Kindamoody|out is now known as Kindamoody
17:08
< Simon_Shine>
oh, a usecase where const is useful.
17:47 * ToxicFrog successfully commits edits to a Backloggery entry using his client!
17:50 AnnoDomini [annodomini@60F158.737D66.CA1918.CC7562] has joined #code
18:22 AnnoDomini [annodomini@60F158.737D66.CA1918.CC7562] has quit [Ping timeout: 121 seconds]
19:30 Omega [omegaboot@Nightstar-10752b3e.il.comcast.net] has joined #code
19:31 Alek [omegaboot@Nightstar-10752b3e.il.comcast.net] has quit [Ping timeout: 121 seconds]
19:31 Omega is now known as Alek
19:55 Kindamoody is now known as Kindamoody[zZz]
20:41 Alek [omegaboot@Nightstar-10752b3e.il.comcast.net] has quit [Ping timeout: 121 seconds]
20:45 Alek [omegaboot@Nightstar-10752b3e.il.comcast.net] has joined #code
20:46 Kazriko [kaz@4CA975.462904.08E9A2.992A2D] has quit [Connection closed]
20:50 Vash [Vash@Nightstar-f03c5637.sd.cox.net] has joined #code
20:50 Omega [omegaboot@Nightstar-10752b3e.il.comcast.net] has joined #code
20:51 Alek [omegaboot@Nightstar-10752b3e.il.comcast.net] has quit [Ping timeout: 121 seconds]
20:51 Kazriko [kaz@4CA975.462904.08E9A2.992A2D] has joined #code
20:56 Omega [omegaboot@Nightstar-10752b3e.il.comcast.net] has quit [Ping timeout: 121 seconds]
20:57 celticminstrel is now known as celmin|away
21:02 Alek [omegaboot@Nightstar-10752b3e.il.comcast.net] has joined #code
21:13 celmin|away is now known as celticminstrel
21:57 Omega [omegaboot@Nightstar-10752b3e.il.comcast.net] has joined #code
21:57 Alek [omegaboot@Nightstar-10752b3e.il.comcast.net] has quit [NickServ (GHOST command used by Omega)]
21:57 Omega is now known as Alek
21:59 Omega [omegaboot@Nightstar-10752b3e.il.comcast.net] has joined #code
22:00 Seraph [omegaboot@Nightstar-10752b3e.il.comcast.net] has joined #code
22:01 Derakon [chriswei@Nightstar-f68d7eb4.ca.comcast.net] has joined #code
22:01
< Derakon>
Funny how functions can bloat...
22:01 Alek [omegaboot@Nightstar-10752b3e.il.comcast.net] has quit [NickServ (GHOST command used by Seraph)]
22:01 Seraph is now known as Alek
22:01
< Derakon>
I created a new function to determine exposure timings for our cameras awhile back, to make room for some new functionality we needed.
22:02
< Derakon>
It now has a 23-line comment preamble explaining how it works, complete with ASCII time diagram.
22:03 Omega [omegaboot@Nightstar-10752b3e.il.comcast.net] has quit [Ping timeout: 121 seconds]
22:19 Vash [Vash@Nightstar-f03c5637.sd.cox.net] has quit [[NS] Quit: BWAHAHAHAHHA! ]
22:40
< Derakon>
That's weird.
22:41
< Derakon>
Pre-Python 3.0, the standard threadsafe queue class is stored in the Queue module, instead of the queue module.
23:14
< Derakon>
Hrm. Irritating. I was really hoping this was an already-solved problem with a readily-accessible Python implementation, but I haven't turned up anything yet.
23:15
< Derakon>
Problem: for a given 3D array of data, project that array down to 2D by taking the maximum value along each of a series of rays in parallel projection.
23:16
< Derakon>
The only advice I've gotten so far is to look up Amanatides & Woo, which is a fairly simple voxel raytracer, but still that's a lot of implementation and optimization.
23:18 You're now known as TheWatcher[T-2]
23:18
< Derakon>
Night, TW.
23:22 You're now known as TheWatcher[zZzZ]
23:37
< ToxicFrog>
Ok.
23:37
< ToxicFrog>
Still have no idea why I can't load images from disk on windows, but at least it has a fallback now so it looks and works ok on windows.
23:38
< ToxicFrog>
Now I just need to sort out the issue where the tree contents are appearing in basically random order, but only on windows.
23:38
<@McMartin>
o_O
23:38
<@McMartin>
Aren't you using a cross-platform widget library?
23:40
< ToxicFrog>
Yes!
23:41
< ToxicFrog>
However, the documentation is positively coated in annotations like "not available on Motif or Windows" or "on windows, set <property> before attempting to use this method" or "transparency only supported on GTK"
23:41
< Derakon>
What widget library are you using? *blink*
23:42
< ToxicFrog>
iup
23:42
< ToxicFrog>
Which I chose on the grounds that it has prebuilt binaries for both linux and windows and is a very small and simple toolkit that uses native widgets.
23:43
< Derakon>
And the fact that it uses Lua had nothing to do with it, eh?
23:43
< ToxicFrog>
Unfortunately it seems one of the drawbacks of that is that it can't hide differences in native windowing APIs across platforms as well as, say, Qt.
23:43
< ToxicFrog>
Well, I could also plausibly have chosen from GTK+, Qt, FLTK, TekUI, wx, and Tk.
23:43
< ToxicFrog>
At least.
23:44
< ToxicFrog>
And those are just the ones with Lua bindings.
23:44
< ToxicFrog>
So...no, it really didn't.
23:44
< Derakon>
I was just going off of Wikipedia's introductory paragraph.
23:45
<@McMartin>
"Uses native widgets" is a bug, not a feature.
23:52
< ToxicFrog>
AFAICT so is "doesn't use native widgets"
23:53
<@McMartin>
I'm not actually convinced that "write your view N times for N operating systems" isn't actually the most efficient technique. -_-
23:54
< ToxicFrog>
In conclusion, fuck GUI design and implementation in the eye~
23:54
<@McMartin>
The best part is that's it's the closest thing consumer-grade development has to a Solved Problem~
23:57
< Derakon>
McM: the most efficient technique may also be "Slap everything on an OpenGL canvas and handle your own events", for that matter.
23:57
< Derakon>
But then you toss nativity right out the window.
23:57
< Derakon>
So to speak.
23:57
< ToxicFrog>
Been there, done that, never doing it again, this is still less frustrating.
23:58
<@Namegduf>
Are there OpenGL widget libraries?
23:58
< Derakon>
Every game developer with a lick of sense is either using one or wrote their own, so yeah.
23:59 * Derakon vanishes.
23:59 Derakon [chriswei@Nightstar-f68d7eb4.ca.comcast.net] has quit [[NS] Quit: leaving]
--- Log closed Fri Sep 09 00:00:06 2011
code logs -> 2011 -> Thu, 08 Sep 2011< code.20110907.log - code.20110909.log >

[ Latest log file ]