Hi Ken,
My name is Cosmin, I'm from Romania (so don't be mad if I make mistakes), and I'm eighteen. I'm a two years programmer. I decided a few months ago I want to make an engine as close as possible to your Build Engine. I began to program the tools and the engine itself (I made a Wolfenstein-Rise of the Triad engine with a few improvements a few months ago). I decided I would like to add voxel rendering in my engine but I'm stuck in a few rendering ideas problems. How do you designed the rendering process of the voxels for use with games like Blood and Shadow Warrior? I thought I could simply choose the voxels with the facing vector at <=90 degrees of the player facing vector (normal) and possibly use a ZBuffer for interior voxels. But I know this is a very bad idea because of the great speed amounts it would eat out of my engine. I hope you real programmer guys don't start laughing at me :oops: . I want to become as good as possible but I'm a beginner in 3D Graphics and Engines field.
And another two questions: I don't have very good knowledge in ASM programming but I want to improve my engine speed (I'm programming for the first time in Open Watcom, 32bit DOS). Do you know any links to good tutorials on ASM, and optimizations? And which is better: TASM or WASM?
I hope I don't bother you with silly questions and I know you don't have time but please help me.
Awesoken at
I thought I could simply choose the voxels with the facing vector at <=90 degrees of the player facing vector (normal) and possibly use a ZBuffer for interior voxels. But I know this is a very bad idea because of the great speed amounts it would eat out of my engine.
Here are some optimization hints: First of all, you should only render surface voxels. Using normals for culling is good, but be sure to treat voxels as having 6 faces. If you use an averaged normal per voxel, you will have gaps. You only need to consider visible faces. You can draw voxels fast using bounded rectangles. If you are writing a 4dof engine, be sure to render vertical columns in your inner loop - this allows you to share lots of calculations, such as the left and right edge. You can turn vector multiplies into vector adds by maintaining a current grid location. You don't need a Z-buffer if you draw in back-to-front order. Voxel objects don't usually have much overdraw. Since your voxels are on a regular grid, you can sort voxels in back-to-front order without the need for a temporary buffer - for a 4dof engine, it turns out to be 9 cases of 'for' loops.
Do you know any links to good tutorials on ASM, and optimizations?
3rd-party bible: http://www.agner.org/optimize/ Cool tricks: http://home.sch.bme.hu/~ervin/codegems.html More tricks in C&ASM: http://www.azillionmonkeys.com/qed/tech.shtml MMX/SSE stuff: http://www.tommesani.com/Docs.html SSE stuff: http://x86.ddj.com/articles/sse_pt1/simd1.htm CPU info: http://www.sandpile.org/ Intel's reference: http://www.google.com/search?hl=en&q=24319102.PDF
And which is better: TASM or WASM?
I am only familiar with WASM. It used to have some parsing bugs, but these have probably been fixed by now. Since you're using OpenWatcom, you should consider inline assembler rather than linking a separate ASM file. You can use either #pragma style or _asm style. If you use _asm style, your code will be compatible with Visual C.
Apprentice at
Thanks a lot for the tips Ken. You're awesome.
Zardalu at
Re: How basic voxel rendering works?
Apprentice said
And which is better: TASM or WASM?
I don't like BASM, MASM, NASM, TASM, etc. at all. Way too much editing and "start", "end start", "assume" and so on required. I have been a registered user of A86/A386/D86/D386 (http://www.eji.com/a86/index.htm) for more than 10 years. The only thing that is a bit of a pain sometimes is getting it to assemble code written for those other assemblers. Eric Isaacson actually spends a lot of time explaining the differences and how to "port" things, and lots of times, no "porting" is actually needed at all, but sometimes it's still a bit of a pain, but it's still way superior to those other assemblers. And as for writing assembly from scratch, once you've tried that with A86/A386, you will never want to go back to those other assemblers.
Just my opinion. I'm not a salesperson for A86/A386.