• What are you working on? v16
    5,004 replies, posted
Just keep refreshing until you get something like this [img]http://dl.dropbox.com/u/2014606/math.png[/img]
Why are my shadows off? [img_thumb]http://f.anyhub.net/20En[/img_thumb] [cpp] Shadow::Shadow(Renderer* pRenderer, Light* pLight, Vertex* pVertices, unsigned int Count) : Engine::Rendition::Renderable(pRenderer) { m_VerticesCount = 0; unsigned int Start = 0, End = Count; bool* VerticesBackFacing = new bool[Count]; // Calculate which direction vertices are facing. for(unsigned int i = 0; i < Count; ++i) { // Get the next point. int Next = (i + 1) & (Count - 1); // Calculate the normal, and distance Engine::Math::Vector3D Light = pLight->GetPosition(); Light.z = 0.0f; Engine::Math::Vector3D Normal = Engine::Math::Vector3D(pVertices[i].y - pVertices[Next].y, pVertices[i].x - pVertices[Next].x, 0.0f); Engine::Math::Vector3D Distance = Light - Engine::Math::Vector3D((pVertices[i].x + pVertices[Next].x) * 0.5f, (pVertices[i].y + pVertices[Next].y) * 0.5f, 0.0f); // If the dot product is > 0 then it's front facing float DotProduct = Normal.DotProduct(Distance); if(DotProduct > 0.0f) VerticesBackFacing[i] = false; else VerticesBackFacing[i] = true; } // Calculate the shadow boundries. for(unsigned int i = 0; i < Count; ++i) { // Get the next point. int Next = (i + 1) & (Count - 1); // Ending boundry. if(VerticesBackFacing[i] && !VerticesBackFacing[Next]) End = i; // Starting boundry. else if(!VerticesBackFacing[i] && VerticesBackFacing[Next]) Start = i; } delete[] VerticesBackFacing; // Calculate the amount of vertices in shadow. if(End > Start) m_VerticesCount = End - Start + 1; else m_VerticesCount = Count - Start + End + 1; // Create a triangle strip for the shadow. m_pVertices = new Vertex[m_VerticesCount * 2]; unsigned int VerticesCount = 0; for(unsigned int i = Start; i < m_VerticesCount; ++i) { Engine::Math::Vector3D VertexPos = Engine::Math::Vector3D(pVertices[i].x + pVertices[i].x, pVertices[i].y + pVertices[i].y, pVertices[i].z); // One vertex on the polygon. m_pVertices[VerticesCount].x = VertexPos.x; m_pVertices[VerticesCount].y = VertexPos.y; m_pVertices[VerticesCount].z = VertexPos.z; m_pVertices[VerticesCount].Color = D3DCOLOR_ARGB(255, 0, 0, 0); VerticesCount++; // One vertex extruded by the light. VertexPos = VertexPos - pLight->GetPosition(); VertexPos.Normalise(); VertexPos = pLight->GetPosition() + VertexPos * 9000; m_pVertices[VerticesCount].x = VertexPos.x; m_pVertices[VerticesCount].y = VertexPos.y; m_pVertices[VerticesCount].z = VertexPos.z; m_pVertices[VerticesCount].Color = D3DCOLOR_ARGB(255, 0, 0, 0); VerticesCount++; } } [/cpp]
[QUOTE=Apple Pi;28428706][img_thumb]http://gyazo.com/e37701924bcf684214c1bbf04da376df.png[/img_thumb] Yeah, I'd rather not.[/QUOTE] the derivative would be 12cos(4x), the answer would be 12.
Working on an FTP server for AnyHub. The FTP protocol is awful. [img]http://cl.ly/011E112G2F3N0f3d0232/content[/img]
Oh excellent. All of the stuff I did that I thought would improve performance had no impact.
I've been working on a FPS camera for my engine, here's the result. [media]http://www.youtube.com/watch?v=vtETLzXidhg[/media]
[QUOTE=HiredK;28432213]I've been working on a FPS camera for my engine, here's the result. [media]http://www.youtube.com/watch?v=vtETLzXidhg[/media][/QUOTE] Might want to raise the view height a little
[QUOTE=Wubstep;28432230]Might want to raise the view height a little[/QUOTE] Right now the ghost object of the camera is very small (to fit the kakariko model), the height can be modified directly from an INI file.
Wait a minute, my optimizations actually did have a small effect, it was just obscured by the ~20s it took to render and save the output. But then how did accidentally breaking the maze generation halve the time when it ended up making it need to draw more? Weird.
never copy things from tutorials, or even rewrite them... figure out what's going on then write your own version. Otherwise you'll end up unintentionally copying something over that's not applicable to your code, causing the entire thing to break. I spent about 30 minutes figuring out that a change from GL11.GL_FIXED to GL11.GL_FLOAT was the reason everything was broken.
I just spent my afternoon playing ZZT. Despite ZZT-OOP's simplicity, it's quite difficult :saddowns:
[QUOTE=robmaister12;28427667]minecraft textures are 16x16 pixels, 24bits per pixel (8 bits per channel), and it's possible to swap the texture pack out for one where the tiles are 32x32 pixels, but still 24bpp. size != bits. The total number of bits in a single 16x16 tile is 6,144, and 24,576 bits in a 32x32 tile, in case you were curious. [editline]4th March 2011[/editline] also, I somehow managed to segfault in Java.. [img_thumb]http://i.imgur.com/QW5pp.png[/img_thumb][/QUOTE] Actually, at least terrain.png includes an alpha channel and therefore has 32 bits per pixel. :smug:
[QUOTE=knighty;28408354]I suspected it'd be huge. I imagine most of the cost is in the vertex buffers though. A 32x32x32 chunk is only 32kb (You ought to be using bytes for this). 8x8x8 of them adds up to 16mb. I don;t know how many chunks you have but I can't imagine they add up a lot themselves. However the vertex buffers are gonna be huge. 2 million vertices, where I assume you have positions, normals and uvs are going to add up to 64mb. Some ideas for decreasing size: Smaller vertices. No idea what you're currently using, but since your world is quantized you can easily get away with 16bit positions. Normals are one of 3 directions, so can be packed into a single byte, and uvs should be easily compressable too. Run length encoding for chunks too. Will make it hard to index into but since you probably only iterated over it for the VB, it should be doable. edit: It just occured to me you probably don't have normals anyway. So ignore that. edit2: Hadn't realised you'd posted exact counts. 750 * 32 * 32 * 32 = 24mb if each block is 8bits. How on earth have you managed to use 550mb? :P[/QUOTE] The latest test showed some large improvements. instead of 1.4GB, a 3800-chunk (18 chunks, or 608 blocks end to end, including up/down) world now only uses 500 MB. Instead of 550 MB dedicated to the chunks, they only use around 270 MB. I've also improved the hidden-face detection algorithm. And in addition I have yet to improve the vertices. I've also made progress with the game elements. Now the main interactive features are fully functional. You can place and remove blocks whereever you want. I should get a video up and going once I make some more progress in the world generation.
[QUOTE=Matte;28435443]The latest test showed some large improvements. instead of 1.4GB, a 3800-chunk (18 chunks, or 608 blocks end to end, including up/down) world now only uses 500 MB. Instead of 550 MB dedicated to the chunks, they only use around 270 MB. I've also improved the hidden-face detection algorithm. And in addition I have yet to improve the vertices. I've also made progress with the game elements. Now the main interactive features are fully functional. You can place and remove blocks whereever you want. I should get a video up and going once I make some more progress in the world generation.[/QUOTE] Do faces which are on the same plane & same texture etc merge?
[QUOTE=Dotmister;28436042]Do faces which are on the same plane & same texture etc merge?[/QUOTE] They merge in the way that they are on the same vertex buffer, yeah. Wait, let me get a picture to show you. Here you can see, it only draws the faces that are visible from the outside of the world. I am standing inside a mountain in this picture. [IMG]http://i747.photobucket.com/albums/xx120/Azzi777/Untitled6.png[/IMG]
[QUOTE=Matte;28436122]They merge in the way that they are on the same vertex buffer, yeah. Wait, let me get a picture to show you. Here you can see, it only draws the faces that are visible from the outside of the world. I am standing inside a mountain in this picture. [img_thumb]http://i747.photobucket.com/albums/xx120/Azzi777/Untitled6.png[/img_thumb][/QUOTE] Ah, I mean like. Say you had a large flat expanse of land. Maybe 5x5 or something, instead of drawing 25 faces you draw one larger one. Too be honest I'm only mentioning this because it gets brought up a lot when talking about Minecraft optimisations, I'm not sure exactly how much of a benefit it'd produce
[QUOTE=Dotmister;28436182] Too be honest I'm only mentioning this because it gets brought up a lot when talking about Minecraft optimisations, I'm not sure exactly how much of a benefit it'd produce[/QUOTE] Little/no benefit most probably. Minecraft is cpu locked as far as I can tell.
Made this if anyone wants a new background. [img_thumb]http://img101.imageshack.us/img101/2659/backgroundxwi.png[/img_thumb] I'll stop with the maze stuff now.
[QUOTE=HiredK;28432213]I've been working on a FPS camera for my engine, here's the result. [media]http://www.youtube.com/watch?v=vtETLzXidhg[/media][/QUOTE] Nostalgia blast. [editline]5th March 2011[/editline] [QUOTE=Matte;28436122]They merge in the way that they are on the same vertex buffer, yeah. Wait, let me get a picture to show you. Here you can see, it only draws the faces that are visible from the outside of the world. I am standing inside a mountain in this picture. [img_thumb]http://i747.photobucket.com/albums/xx120/Azzi777/Untitled6.png[/img_thumb][/QUOTE] I can't really see that it would offer much performance benefit tbh. I mean backface culling will be doing 90% of the work for you most of the time anyway. I suppose perhaps if you looked up at a cliff it would save a few quads from being drawn. Unless you mean it doesn't render the blocks on the inside in which case how will you handle caves?
[QUOTE=Dotmister;28436182]Ah, I mean like. Say you had a large flat expanse of land. Maybe 5x5 or something, instead of drawing 25 faces you draw one larger one. Too be honest I'm only mentioning this because it gets brought up a lot when talking about Minecraft optimisations, I'm not sure exactly how much of a benefit it'd produce[/QUOTE] No, they don't merge in that way. I don't know how much performance you'd gain considering you have to calculate all the texture and vertex positions and probably a good deal on top of that just to figure out what faces to merge, if any.
Made a tree branch thingie. [IMG]http://i.imgur.com/fZ8ZM.gif[/IMG]
[QUOTE=ZomBuster;28436594]Made a tree branch thingie. [img_thumb]http://i.imgur.com/fZ8ZM.gif[/img_thumb][/QUOTE] That looks like the blood vessel that expands on the House MD intro.
Does anybody here use Bucky's tutorials on YouTube to learn to program languages like Objective C? He's really good at teaching the things he teaches. If you guys have never heard of him [url=http://www.youtube.com/user/thenewboston]here's a link to his channel[/url]
[QUOTE=Apple Pi;28436654]Does anybody here use Bucky's tutorials on YouTube to learn to program languages like Objective C? He's really good at teaching the things he teaches. If you guys have never heard of him [url=http://www.youtube.com/user/thenewboston]here's a link to his channel[/url][/QUOTE] Learning a programming language from YouTube is just wrong.
[QUOTE=Robber;28437091]Learning a programming language from YouTube is just wrong.[/QUOTE] What? No. How is it any worse than reading a book, having someone tutor you or reading documentation? (It's not)
Making my own memory manager, so far it beats the shit out of the standard malloc/free stuff. It allocates a big chunk of memory when it is created, and then hands out smaller bits from that, keeping track of free/locked memory blocks as it goes.
People learn all different ways. The "right" way to learn something is the way that you are most comfortable with and helps you the most.
[QUOTE=polkm;28437853]People learn all different ways. The "right" way to learn something is the way that you are most comfortable with and helps you the most.[/QUOTE] How is that planet game of your going?
Yay!, my texture packer actually seems to be somewhat efficient with space.(751 pictures) NOTE:I do not own or claim the copyright for those sprites. [URL=http://img828.imageshack.us/i/statuse.png/][IMG]http://img828.imageshack.us/img828/9228/statuse.th.png[/IMG][/URL] Now the hard part: Making a gui that people will actually like.
Some improvements [img]http://i.imgur.com/6CJye.gif[/img]
Sorry, you need to Log In to post a reply to this thread.