[QUOTE=Dehodson;31076071]In other news, why is garry using the VB .net icon for the programming subforum? ([img]http://www.facepunch.com/fp/forums/240.png[/img])
Is he trying to make us angry[/QUOTE]
I don't think in the grand scheme of things it really matters that much
Thanks Robo and Bladezor, those are both very helpful and will improve my games atmosphere a bunch :)
[QUOTE=layla;31069883]Plane lump is 40 bytes.
normalized vector
distance
type (for axial checks)[/QUOTE]
12 for a Vector (4 per float), 4 for distance float, 4 for an int.
12 + 4 + 4 = 20.
If I divide it by 40, it cuts off ~3 planes that have data in them.
[code]
// planes (x&~1) and (x&~1)+1 are always opposites
struct dplane_t
{
DECLARE_BYTESWAP_DATADESC();
Vector normal;
float dist;
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
};[/code]
Or is the DECLARE_BYTESWAP_DATADESC() macro adding more?
[QUOTE=SupahVee;31075796][media][URL]http://www.youtube.com/watch?v=kC97EZ6rEu0[/URL][/media][/QUOTE]
I enjoy watching these videos :)
[QUOTE=Lord Ned;31077202]12 for a Vector (4 per float), 4 for distance float, 4 for an int.
12 + 4 + 4 = 20.
If I divide it by 40, it cuts off ~3 planes that have data in them.
[code]
// planes (x&~1) and (x&~1)+1 are always opposites
struct dplane_t
{
DECLARE_BYTESWAP_DATADESC();
Vector normal;
float dist;
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
};[/code]
Or is the DECLARE_BYTESWAP_DATADESC() macro adding more?[/QUOTE]
yeah sorry, for some reason i did 8 * 5 in my head. I don't know what that macro does, I don't use it.
If you're not getting the correct amount of planes then make sure the length and offset of the lump is correct.
It looks correct, I can't tell. They look like legitimate lump lengths/offsets.
[csharp]
//Read the Binary File's Header
#region BSP Header
dheader_t header;
using (BinaryReader reader = new BinaryReader(new MemoryStream(data,false)))
{
header.ident = reader.ReadInt32();
header.version = reader.ReadInt32();
header.lumps = new lump_t[64];
for(int i = 0; i < 64; i++)
{
header.lumps[i].fileofs = reader.ReadInt32();
header.lumps[i].filelength = reader.ReadInt32();
header.lumps[i].version = reader.ReadInt32();
header.lumps[i].fourCC = new char[4];
for (int k = 0; k < 4; k++)
{
header.lumps[i].fourCC[k] = reader.ReadChar();
}
}
//Read the mapRevision
header.mapRevision = reader.ReadInt32();
}
#endregion
//Now, load all of the planes from the map (Lump #1)
#region BSP Planes
int numPlanes = header.lumps[1].filelength / 40; //40 Bytes per plane-struct
dplane_t[] mapPlanes = new dplane_t[numPlanes];
using (BinaryReader reader = new BinaryReader(new MemoryStream(data, header.lumps[1].fileofs, header.lumps[1].filelength)))
{
for (int i = 0; i < numPlanes; i++)
{
dplane_t plane = new dplane_t();
Vector3 newNormal = new Vector3();
byte[] normalInBytes = reader.ReadBytes(12);
newNormal.X = BitConverter.ToSingle(normalInBytes, 0);
newNormal.Y = BitConverter.ToSingle(normalInBytes, 4);
newNormal.Z = BitConverter.ToSingle(normalInBytes, 8);
plane.Normal = newNormal;
plane.dist = BitConverter.ToSingle(reader.ReadBytes(4), 0);
plane.type = reader.ReadInt32();
mapPlanes[i] = plane;
}
}
#endregion
[/csharp]
I get the correct header.mapRevision (20), so I think I filled the lumps correctly.
Some random bugs:
[img]http://img40.imageshack.us/img40/4466/unleduta.jpg[/img]
[img]http://img638.imageshack.us/img638/6511/unled2zn.jpg[/img]
[QUOTE=Lord Ned;31077867]It looks correct, I can't tell. They look like legitimate lump lengths/offsets.
[csharp]
//Read the Binary File's Header
#region BSP Header
dheader_t header;
using (BinaryReader reader = new BinaryReader(new MemoryStream(data,false)))
{
header.ident = reader.ReadInt32();
header.version = reader.ReadInt32();
header.lumps = new lump_t[64];
for(int i = 0; i < 64; i++)
{
header.lumps[i].fileofs = reader.ReadInt32();
header.lumps[i].filelength = reader.ReadInt32();
header.lumps[i].version = reader.ReadInt32();
header.lumps[i].fourCC = new char[4];
for (int k = 0; k < 4; k++)
{
header.lumps[i].fourCC[k] = reader.ReadChar();
}
}
//Read the mapRevision
header.mapRevision = reader.ReadInt32();
}
#endregion
//Now, load all of the planes from the map (Lump #1)
#region BSP Planes
int numPlanes = header.lumps[1].filelength / 40; //40 Bytes per plane-struct
dplane_t[] mapPlanes = new dplane_t[numPlanes];
using (BinaryReader reader = new BinaryReader(new MemoryStream(data, header.lumps[1].fileofs, header.lumps[1].filelength)))
{
for (int i = 0; i < numPlanes; i++)
{
dplane_t plane = new dplane_t();
Vector3 newNormal = new Vector3();
byte[] normalInBytes = reader.ReadBytes(12);
newNormal.X = BitConverter.ToSingle(normalInBytes, 0);
newNormal.Y = BitConverter.ToSingle(normalInBytes, 4);
newNormal.Z = BitConverter.ToSingle(normalInBytes, 8);
plane.Normal = newNormal;
plane.dist = BitConverter.ToSingle(reader.ReadBytes(4), 0);
plane.type = reader.ReadInt32();
mapPlanes[i] = plane;
}
}
#endregion
[/csharp]
I get the correct header.mapRevision (20), so I think I filled the lumps correctly.[/QUOTE]
Just curious but what documentation/reference are you using for Source's bsp? That format changes so much it's ridiculous.
[QUOTE=Bladezor;31078488]Just curious but what documentation/reference are you using for Source's bsp? That format changes so much it's ridiculous.[/QUOTE]
Actually it's pretty consistant... Amazingly, it's a bit different than Quake's! :v:
[url]http://developer.valvesoftware.com/wiki/Source_BSP_File_Format[/url]
[b]Edit:[/b]
Yes, individual lumps change formats between games, but you can't blame them... It's sort of required to add new features the way they do.
Anybody got an XNA 2D Normal Mapping sample?
Why are delegates and events so confusing?
Actually, would it be easier to make normal maps for each of my images or build a shader to generate normal maps on the fly?
[url]http://i.imgur.com/nmFUl.png[/url]
Took long enough to get the basics done, hopefully I can actually get started on the gameplay now.
[QUOTE=Loli;31079611]Actually, would it be easier to make normal maps for each of my images or build a shader to generate normal maps on the fly?[/QUOTE]
Eh, it depends. Generating normal maps on the fly is usually sufficient but doesn't always give the prettiest results, especially for really noisy textures. I'd generate them and see what the final pass looks like. If it looks good, leave it, otherwise make your own normal map for that particular texture.
[editline]12th July 2011[/editline]
Really noisy normal map + parallax mapping = shag carpet
[QUOTE=Loli;31079611]Actually, would it be easier to make normal maps for each of my images or build a shader to generate normal maps on the fly?[/QUOTE]
You can't generate good normals from diffuse/color information. Normals contain information about [i]geometry[/i], whereas your main texture contains info about [i]color[/i]. These are two very different properties, and if you generate one from the other using a simple script you aren't adding any useful information about the material. Just looking at this from the perspective of a player, I tend to turn off anything that doesn't clarify the details of my surroundings. If the normal maps aren't good, that would probably be one of the first things I would try to disable and/or replace.
Even generating normals from depth is iffy. The best way to do it is to bake the normals from the high resolution source model onto the low-resolution ingame mesh. I would imagine it's a trivial task with most modelling software, I've done it in Blender before without difficulty.
[QUOTE=ROBO_DONUT;31080491]You can't generate good normals from diffuse/color information.[/QUOTE]
[url]http://www.crazybump.com/[/url]
i'm sure a simplified, less accurate version is possible in a shader
[QUOTE=icantread49;31080545][url]http://www.crazybump.com/[/url]
i'm sure a simplified, less accurate version is possible in a shader[/QUOTE]
Like I said, you can't generate [i]good[/i] normals from diffuse information.
[QUOTE=ROBO_DONUT;31080569]Like I said, you can't generate [i]good[/i] normals from diffuse information.[/QUOTE]
wait, did you take a look at crazybump? those look like pretty [i]good[/i] normals to me :v:
or are you saying that you can't generate [i]good[/i] normals in a shader? i don't think it's entirely impossible
[QUOTE=icantread49;31080631]wait, did you take a look at crazybump? those look like pretty [i]good[/i] normals to me :v:[/QUOTE]
Most people can't look at a raw normalmap and tell whether it's good or bad -- humans aren't built to decompose images in that way. The flaws usually become obvious when you're lighting objects in an interactive setting.
I've seen some heightmaps that crazybump has put out which are quite obviously wrong. I'm not saying crazybump is bad, I'm just saying it's doing it's best on what is essentially an unsolvable problem.
You can't generate [i]geometry[/i] from a single image containing only [i]color[/i] information. With stereo photographic images you might be able to reconstruct geometry from the parallax between them, but with a single image you are limited to lighting cues (which is woefully inaccurate). Consider what would happen if you were to put an image of the Mona Lisa through Crazy Bump. It would generate normals that don't exist there in real life. The canvas is totally flat, but the program would take the variances in light intensity as indications of depth. There are lots of places where you have variations in color which do not indicate a change in depth or changes in depth without a corresponding change in light intensity.
Sorry if I seem like I'm taking this a little too seriously. Poor texturing is one of my peeves.
[QUOTE=ROBO_DONUT;31080569]Like I said, you can't generate [i]good[/i] normals from diffuse information.[/QUOTE]
Those look pretty damn good to me. For models sure you should bake them from a high-res model but for stuff like rocks or textures which you don't have the source model for this is a perfectly viable and sufficient option. In fact, I'm not sure I can think of a better way to generate a normal for something like rocks.
Like I said earlier, it really depends on your source texture. If it's extremely noisy, your normals will be garbage.
[editline]12th July 2011[/editline]
[QUOTE=icantread49;31080631]wait, did you take a look at crazybump? those look like pretty [i]good[/i] normals to me :v:
or are you saying that you can't generate [i]good[/i] normals in a shader? i don't think it's entirely impossible[/QUOTE]
You wouldn't need to generate them in a shader. I'd just do it once and cache them into their own texture file on disk.
[QUOTE=Bladezor;31080867]Those look pretty damn good to me. For models sure you should bake them from a high-res model but for stuff like rocks or textures which you don't have the source model for this is a perfectly viable and sufficient option. In fact, I'm not sure I can think of a better way to generate a normal for something like rocks.
Like I said earlier, it really depends on your source texture. If it's extremely noisy, your normals will be garbage.[/QUOTE]
It's [i]less[/i] bad for things like rocks because rocks tend to be one color. Even for things like rocks there are some pretty big problems though. In order for you to get a good normal out of the photograph there needs to be lots of lighting information there to begin with, this means there should be only one source of collimated light (i.e. the sun) at a shallow angle from the surface, but not so far as to produce shadows. This is, however, the [i]exact opposite[/i] of what you want in a diffuse map. In a diffuse map you want pure color without excessive lighting information so as not to layer more in-game lighting on top of the static lighting in the texture itself.
In a perfect world, you'd take stereo photographs or use laser scanning methods to generate the geometry information that a regular photograph lacks. This is, however, often prohibitively cost- or labor-intensive, especially for hobbyists, modders, or independent devs. (I, myself would totally appreciate the effort if bigger devs started doing it, I think it's well worth the effort)
On the few occasions where I've had to make such textures (not necessarily for rocks, but for manhole covers, bricks, etc), I actually make a heightmap, by hand (although I might get the finer details by selectively blending in pieces of a high-pass of the original image), which represents the actual depths you would find on such an object and turn that into a normalmap. The idea here is that an artist can fill in the missing geometrical data from their own knowledge.
At this point there's really no good compromise. It becomes an issue of a knowledgable texture artist choosing the least bad approximation. Sometimes that is software like Crazy Bump, but only if your source material is conducive to such methods of faux-normal map generation.
to be quite honest i think you're nitpicking what seems to be a non-issue :v: i don't think anyone else would look at the crazy bump demonstration and think, "wow, that normal map was really bad" but maybe that's just me
[editline]13th July 2011[/editline]
[QUOTE=Bladezor;31080867]
You wouldn't need to generate them in a shader. I'd just do it once and cache them into their own texture file on disk.[/QUOTE]
well actually that's a good idea too
[QUOTE=ROBO_DONUT;31082307]In a perfect world, you'd take stereo photographs or use laser scanning methods to generate the geometry information that a regular photograph lacks. This is, however, often prohibitively cost- or labor-intensive, especially for hobbyists, modders, or independent devs. (I, myself would totally appreciate the effort if bigger devs started doing it, I think it's well worth the effort)
On the few occasions where I've had to make such textures (not necessarily for rocks, but for manhole covers, bricks, etc), I actually make a heightmap, by hand (although I might get the finer details by selectively blending in pieces of a high-pass of the original image), which represents the actual depths you would find on such an object and turn that into a normalmap. The idea here is that an artist can fill in the missing geometrical data from their own knowledge.
At this point there's really no good compromise. It becomes an issue of a knowledgable texture artist choosing the least bad approximation. Sometimes that is software like Crazy Bump, but only if your source material is conducive to such methods of faux-normal map generation.[/QUOTE]
I agree completely, this is essentially what I was saying all along. I'm confident Loli is capable of judging whether or not the generated normals are sufficiently accurate for the textures on a case-case basis.
[QUOTE=icantread49;31082608]to be quite honest i think you're nitpicking what seems to be a non-issue :v: i don't think anyone else would look at the crazy bump demonstration and think, "wow, that normal map was really bad" but maybe that's just me[/QUOTE]
Only because they're [i]very, very careful[/i] about what sorts of textures they demonstrate.
Here's an example:
[url]http://www.youtube.com/watch?v=ZFAjRg-IG2o&feature=related[/url]
Any way you cut it, that diamond plate looks like absolute poop.
The height map it generates makes me cringe.
A timer I made because I wanted to go to bed, but also wanted to keep downloading updates for a game and not stay up all night waiting for it to finish (also, if I keep my computer on overnight it gets really hot in my room).
[img]http://filesmelt.com/dl/timer.png[/img]
Basically, you say a time, like 20 minutes used in the above examples, and it gives a list of things to choose from to execute at the future time specified. It's only got a couple of options right now, but it's just what I personally need, so, eh.
Then it starts counting down.
P.S. The Loop timer thing you can choose from means it will do it every increment you specify, so for example, if you pick 20 minutes and say loop timer, it will execute those things you choose from every 20 minutes (sans restart and shut down lol)
I love making things to make my life easier.
[editline]13th July 2011[/editline]
I don't know why I have a question mark in the first part
christarp18:
Idea: Find a way to detect overall system network activity. Use that to detect a dramatic decrease in network activity (accurate to within about 5 minutes) to trigger sleep mode or shutdown. Boom, instant overnight download shutdown power saving app thingy. Works with Steam, Firefox, iexplore, cURL, Eve, WoW, etc.
Would be interesting to see how this is done in different operating systems. I'm tempted to just do this myself. Hopefully before someone posts a link to an open source project that already does this...found [url=http://sourceforge.net/projects/jetroget/]this[/url], but I can't find source code for it anywhere.
Extra credit: Scan all open window captions for the symbol "%" to check for completion and use a list form to allow users to tick which ones to check for completion/close.
That's a pretty badass idea. It would probably take a fair amount of work to get it perfectly, but once complete it would be great.
[editline]13th July 2011[/editline]
I've always wondered why operating systems don't have these sort of things built in, like auto shut down / sleep / restart timers and bandwidth monitors for shutdown and such. They're really useful features.
Damn,
I really need to start working on my programming again i get so pumped seeing everything people are making but my work takes to much time !
[QUOTE=Lord Ned;31077867]It looks correct, I can't tell. They look like legitimate lump lengths/offsets.
[/QUOTE]
Looks like you're reading in the correct amount of data. Maybe try printing out your lump offsets, lengths and how many elements it's saying there is in a lump and I'll check against mine.
[QUOTE=Murkrow;31069660]Okay then
I just got an idea for a mildly useful application/extension, if anybody wants something to do, do read.
Basically it's a notepad that can only edit the hosts file[/QUOTE]
Slightly related, but when I'm doing web development, I have this set up in my hosts file:
website.com -> Live Site
website.com.local -> local server
Sorry, you need to Log In to post a reply to this thread.