• What are you working on? V2
    2,001 replies, posted
[QUOTE=s0ul0r;16337465] Edit: Also, what would be the best datatype to load a 1mb+ text file (well not really text but obj. is just plain text) into? I was thinking about string[].[/QUOTE] Why not parse it line by line (or more simply, float by float)?
I made a really crude .obj loader once. It only worked for bare models without fancy materials and stuff but it worked. And to solve your quad problem, when you export the obj you can triangulate the model.
Nvm I'm almost done with the basic geometry parser: (That cube under the green triangle,it actually intersects) [IMG]http://img200.imageshack.us/img200/7011/parserworking.png[/IMG] was parsed from this obj file: [code] v 1 1 1 v 1 1 -1 v 1 -1 1 v 1 -1 -1 v -1 1 1 v -1 1 -1 v -1 -1 1 v -1 -1 -1 f 1 3 4 2 f 5 7 8 6 f 1 5 6 2 f 3 7 8 4 f 1 5 7 3 f 2 6 8 4 [/code]
[QUOTE=nullsquared;16337822]Why not parse it line by line (or more simply, float by float)?[/QUOTE] Not sure if I am getting ya right but... That would be slower. You should probably cache the file into a structure so you aren't parsing it when you want to render it. A structure of floats will be much faster to access then a text file :P.
[QUOTE=high6;16339040]Not sure if I am getting ya right but... That would be slower. You should probably cache the file into a structure so you aren't parsing it when you want to render it. A structure of floats will be much faster to access then a text file :P.[/QUOTE] What? It's a text file. To get a text file into memory, you need to read all of it. Instead of doing that, then parsing that, you can parse [i]while[/i] you read it (therefore, parse float-by-float).
[QUOTE=nullsquared;16339074]What? It's a text file. To get a text file into memory, you need to read all of it. Instead of doing that, then parsing that, you can parse [i]while[/i] you read it (therefore, parse float-by-float).[/QUOTE] Well say parsing the textfile takes 4 seconds. Would you want to parse the file right before rendering? I would imagine you would want to parse it into a structure before rendering...
Jeah I parsed it line by line, loading the vars directly into the triangle list and its really fast, BUT I have a problem. The reading of the lines works fine, just the conversion is fucked up. f.e. one vertex number is "2.92452" with the use of: Convert.ToInt16() it converts to 292452.0 ...
[QUOTE=s0ul0r;16339572]Jeah I parsed it line by line and its really fast, BUT I have a problem. The reading of the lines works fine, just the conversion is fucked up. f.e. one vertex number is "2.92452" with the use of: Convert.ToInt16() it converts to 292452.0 ...[/QUOTE] Int16 doesn't store decimals. Use float/double instead.
[QUOTE=high6;16339040]Not sure if I am getting ya right but... That would be slower. You should probably cache the file into a structure so you aren't parsing it when you want to render it. A structure of floats will be much faster to access then a text file :P.[/QUOTE] Actually it's alot faster, because you don't store the whole file in the memory, you only store one line at a time. From there you can parse line by line, which is incredibly fast. [editline]01:52AM[/editline] [QUOTE=high6;16339581]Int16 doesn't store decimals. Use float/double instead.[/QUOTE] Oh I just noticed that was not the problem, I looked at the conversion for the faces. It converts the face numbers to ints. The conversion for the double numbers (vertecies) uses Convert.ToDouble... and THAT does not work [editline]01:55AM[/editline] Found the problem: Convert.ToDouble takes commas as , not .
[QUOTE=s0ul0r;16339594]Actually it's alot faster, because you don't store the whole file in the memory, you only store one line at a time. From there you can parse line by line, which is incredibly fast.[/QUOTE] Reading say, 1000 bytes from disk as one chunk is a LOT faster than reading it, for example, 100 bytes, 10 times. Same goes for write operations. That, combined with the fact that the amount of parsing remains the same, reading a file as several chunks is only recommended when you don't have a lot of memory avaivable, or the file is really large.
So are you agreeing with me or not? Don't quite get it. Anyway, fully implemented (without materials ofc.) my obj. parser (I don't know why part of the hammer head is missing, but I just think the model is like that, found it somewhere on the net) [IMG]http://img401.imageshack.us/img401/7011/parserworking.png[/IMG]
[QUOTE=jA_cOp;16339787]Reading say, 1000 bytes from disk as one chunk is a LOT faster than reading it, for example, 100 bytes, 10 times. Same goes for write operations. That, combined with the fact that the amount of parsing remains the same, reading a file as several chunks is only recommended when you don't have a lot of memory avaivable, or the file is really large.[/QUOTE] .NET probably buffers 1000 bytes just like fread :P.
[QUOTE=jA_cOp;16339787]Reading say, 1000 bytes from disk as one chunk is a LOT faster than reading it, for example, 100 bytes, 10 times. Same goes for write operations. That, combined with the fact that the amount of parsing remains the same, reading a file as several chunks is only recommended when you don't have a lot of memory avaivable, or the file is really large.[/QUOTE] OK, now let's all optimize our .obj loaders to load the text data in large chunks instead of doing it the readable, understandable way - after all, we really need to save those 2 microseconds.
[QUOTE=nullsquared;16339934]OK, now let's all optimize our .obj loaders to load the text data in large chunks instead of doing it the readable, understandable way - after all, we really need to save those 2 microseconds.[/QUOTE] Time is money. xD No seriously I totally agree..
[QUOTE=nullsquared;16339934]OK, now let's all optimize our .obj loaders to load the text data in large chunks instead of doing it the readable, understandable way - after all, we really need to save those 2 microseconds.[/QUOTE] I was just clearing things up, he was saying that loading the whole file into memory was slower. And when dealing with big files, we're talking seconds, not microseconds. edit: And did you read my post? I was advocating reading it as one, big chunk.
Right so, any advice on how to improve the performance? Probably rendering it in multiple thread, ok but that would only divide the time it takes to render by 2 (with 2 cores) right? So I think there are probably no really effective ways to improve that pure software rendering. I mean if the GPU would do that, it would probably be alot faster... since, my little duck here with only 7000 polys rendered almost 20 minutes.... [IMG]http://img43.imageshack.us/img43/1741/renderduck.png[/IMG]
[QUOTE=s0ul0r;16340274]Right so, any advice on how to improve the performance? Probably rendering it in multiple thread, ok but that would only divide the time it takes to render by 2 (with 2 cores) right? So I think there are probably no really effective ways to improve that pure software rendering. I mean if the GPU would do that, it would probably be alot faster... since, my little duck here with only 7000 polys rendered almost 20 minutes.... [url]http://img43.imageshack.us/img43/1741/renderduck.png[/url][/QUOTE] Threading wont help you with computations though... Also imageshit is slow as shit.
[QUOTE=Spartan117;16330682]The thing is I have given this to my friend and have put it on my work laptop and both have worked fine. So the DLL's are not the problem...[/QUOTE] I just tried reinstalling Net Framework 3.5 and I get a setup error, but I just checked and I do have 3.5 so I don't know.
Gonna start working on this raytracer a bit again. Got it working with SFML and now it works on linux. Next to implement is transparency, textures, and beers law. [img]http://returnnull.dyndns.org/img/raytracer.png[/img]
Someone should make a proper CUDA powered raytracer. :buddy:
[QUOTE=Robber;16343611]Someone should make a proper CUDA powered raytracer. :buddy:[/QUOTE] Nvidia already have one. :D
[QUOTE=blankthemuffin;16344279]Nvidia already have one. :D[/QUOTE] Released?
Good question... Yes. [url]http://www.nvidia.com/page/gz_home.html[/url]
Bought some books! [img]http://img268.yfrog.com/img268/6707/zcjq.jpg[/img]
Good lord, [i]hardbacks.[/i]
[QUOTE=garry;16345689]Bought some books! *picture*[/QUOTE] I'm thinking of buying some books (GPU Gems is one of them). I guess you haven't done much reading yet but how is it compared to read things on the internet, are you planning to actually read the whole book or just use it to look things up?
I'll probably flick through, I'd say it's a lot better than online stuff.. since with online stuff you kind of have to know what you're looking for. GPU Gems seems to be showing you specific techniques, RTR seems to be really more in depth, tons of little useful things. Haven't looked at the video game one yet.
You bought GPU Gems 3? [url]http://http.developer.nvidia.com/GPUGems3/gpugems3_part01.html[/url]
[QUOTE=nullsquared;16347049]You bought GPU Gems 3? [url]http://http.developer.nvidia.com/GPUGems3/gpugems3_part01.html[/url][/QUOTE] Not everyone wants to read walls of text on a monitor.
[QUOTE=nullsquared;16347049]You bought GPU Gems 3? [url]http://http.developer.nvidia.com/GPUGems3/gpugems3_part01.html[/url][/QUOTE] I did see that, I much prefer a book though
Sorry, you need to Log In to post a reply to this thread.