Posted: Sat Jul 15, 2023 8:23 pm Post subject:
Show and Tell: Game-like Voxel Rendering
Hello all, it's been a while.
Just a little show and tell. I've recently started learning to code (python) and inevitably this process ended up steering itself towards Red Alert 2. After digging through about 20 year's worth of community posts (at least one useful post was dated 2003!) and many hours with my tutor buddy (ChatGPT) I can now render voxels as seen below.
The red one is mine, cyan is in-game. Please note that I set ExtraUnitLight=0 for the screenshot as imitating ExtaXXXLight= is not implemented into my renderer as of yet.
I am aiming to get as pixel accurate as possible. Definitely not there yet, but I am already closer than I expected! Some spots render rougher than the original, lighting isn't 100% accurate, and some sizes are a pixel or two off. I'm thinking that some of this might be related to small scaling or rounding differences.
Further limitations include that it currently only renders one section, has no concept of .hva files, and while shadows sometimes align correctly but are often off by a few pixels.
Anyways, I know this is nothing groundbreaking, but nobody I can share this to in person knows what the hell it is... so there.
Let me know what you think! If anyone has insight for improvements, I'm all ears.
vxl_rendering.png
Description:
Filesize:
90.37 KB
Viewed:
1482 Time(s)
_________________ "It's got that Droke style to it!" QUICK_EDIT
Well that's probably fun as an experiment, but if you want this to lead to something practical, you should aim for two things: better rendering and faster rendering.
For example ChronoDivide breaks up a voxel into planar sections based on colour and angle in a pre-pass stage, and final rendering/lighting is done on that. Now it is a browser game engine, so performance will always be far slower than what a local machine with access to multiple cores or SIMD/GPU instructions can do, but it's still quite efficient.
There are of course caveats to messing with things, first is that the VPL can be customized to change the tint as a colour lightens or darkens, so you can cleverly make something glossy more accurately reflect ambience, rather than a simple brightness slider. There's also a matter of sub-pixel blending when voxels are shrunk. And finally as you can see in the CD screenshot, to get the shadows to match the buildings in RA2, the light source for voxels has to be raised a lot.
All that is to say, if you can make a good rendering engine that isn't pixel perfect to the original, but produces good results and good performance, there are probably projects that could use it.
Well that's probably fun as an experiment, but if you want this to lead to something practical, you should aim for two things: better rendering and faster rendering.
Practicality is in the eye of the beholder. My target is to use this for template matching, so deviating from Red Alert 2 would be to my detriment. For me, better rendering is more game accurate rendering. Ideally, I would want to copy Westwood down to the tiniest error.
Faster is better, of course. I'll be looking into optimizing it some more at a later point, but I'm already at a tenable speed for my application. The worst cases that I have been able to find (native to the game) are the aircraft carrier and zeppelin, but both return in under a second for 8 facings. Most voxels are much faster than that, and results are cached. Not viable for rendering in real time, but I think it will do for my little project. _________________ "It's got that Droke style to it!" QUICK_EDIT
On initialization I calculate light direction/normal index/VPL section relations and cache it. By the time a voxel is being drawn it is a pretty direct transition from voxel data (color, normal) to RGB value.
Am I missing something? _________________ "It's got that Droke style to it!" QUICK_EDIT
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum