Half life software rendering




















I know software renderers are pretty redundant nowadays, but I''ve written one for my game anyway as a way of learning about stuff and understanding the concepts and so on. When I compare my renderer to Half-Life, playing in software mode, my renderer is very much slower.

On my machine, Half-Life can handle x still running at acceptable framerates, whereas with my renderer you pretty much have to go down to x So I''m wondering what things the professionals do or did, before hardware acceleration took over in order to make their renderers so much faster. I''ve timed the various stages of rendering, and the conclusion is that the biggest time user is the rasterization stage, by a factor of at least 10, so that seems like the place to start.

I figured if I wrote the inner loops of the rasteriser in assembler, that might speed it up. But I tried a simple test without texturing and shading a while back, writing the inner loops in inline assembler, and it didn''t seem to make much difference. If assembler is the answer, what is it that assembler would do exactly that a bit of compiled c code wouldn''t? Here''s an example of my C code for a scanline of a flat colour triangle. In more complex rendering modes, other attributes like colour and texture co-ordinates are interpolated in the same way as the z value is.

Cancel Save. Heart of Evil Renegade. Palidine Start by optimizing those areas that are the worst. Ravyne Google for fast screen clear. A good place to look for stuff on software rasterizers are old computer programming books, DOS-era stuff. They may be old but theory still applies. For a newer book, you could look at LaMothes newer 3D rendering book, though I personally hate the coding style, it has alot of good info. Finally, read anything you can get your hands on by Michael Abrash.

He''s pretty myuch the god of software rendering, he co-wrote UT2k3 and 2k4''s software renderer probably HL''s as well if I remember correctly its actually middleware, but was liscensed for use in unreal. Do you have optimizations on? Building in Release mode? Is this scanline code by itself in a function? Miserable It might make some difference with non-trivial iterators, but with basic types there should be no measurable difference at all.

Anyway, ensuring that the function is getting inlined might help. You might also want to look into unrolling the loop - it''s going to be run an awful lot of times. Maybe Duff''s Device would be useful? Of course, the best way is always to attempt to improve algorithms do you rasterise more than you really need? Fail to cull occluded surfaces? The Corner of Misery Artwork and writing. Matei Are you sure that the draw triangle function is what's really slowing you down?

Perhaps you're doing something else, like not blitting to the screen smartly, or some problem with your geometry transformation code. I wrote a software renderer in Java, and it runs pretty comfortably even on x Also thanks to id Software for open-sourcing Quake engine code which helped massively. Skip to content.

Star 2. Branches Tags. Could not load branches. Could not load tags. Latest commit. Git stats 35 commits. Failed to load latest commit information. View code. The project is made up from several static libraries and executables. Name Purpose Docs appfw Utility library the provides dev console, platform info. I already have a CRT for gaming even modern 3.

Now my game is limited to 60 fps in fullscreen mode and 72 in windowed. Wierd thing is that my monitor's refresh rate is 72Hz, so in fullscreen what I would normally be playing it is just a wierd hard cap to 60 fps and in windowed it is VSync.

It's also off in GPU settings. You can override refresh rate through DGVoodoo. Go into the setup for your HL profile and check the box "Enumerate refresh rates". Then apply. Damn dude you rock, thanks. Duckilous View Profile View Posts. Originally posted by Hoovyspenser :. Per page: 15 30 Date Posted: 9 Sep, pm.



0コメント

  • 1000 / 1000