Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Fri Feb 23, 2024 9:37 am
All times are UTC + 0
Show and Tell: Game-like Voxel Rendering
Moderators: Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 1 of 1 [5 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
Droke
Scorpion Sniper


Joined: 18 May 2004
Location: CA, USA

PostPosted: Sat Jul 15, 2023 8:23 pm    Post subject:  Show and Tell: Game-like Voxel Rendering Reply with quote  Mark this post and the followings unread

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:  794 Time(s)

vxl_rendering.png



_________________
"It's got that Droke style to it!"

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Sun Jul 16, 2023 12:46 am    Post subject: Reply with quote  Mark this post and the followings unread

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.



cdvxl.jpg
 Description:
 Filesize:  384.62 KB
 Viewed:  709 Time(s)

cdvxl.jpg



ra2vxl.jpg
 Description:
 Filesize:  917.05 KB
 Viewed:  709 Time(s)

ra2vxl.jpg



_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
Droke
Scorpion Sniper


Joined: 18 May 2004
Location: CA, USA

PostPosted: Sun Jul 16, 2023 1:41 am    Post subject: Reply with quote  Mark this post and the followings unread

G-E wrote:
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!"

Back to top
View user's profile Send private message
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Sun Jul 16, 2023 6:33 am    Post subject: Reply with quote  Mark this post and the followings unread

You know the VPL is meant to save a lot of the math right? And of course work in a much smaller bit space than RGB.

_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
Droke
Scorpion Sniper


Joined: 18 May 2004
Location: CA, USA

PostPosted: Sun Jul 16, 2023 10:11 am    Post subject: Reply with quote  Mark this post and the followings unread

...yes? I am using the VPL.

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!"

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
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


Powered by phpBB © phpBB Group

[ Time: 0.1636s ][ Queries: 16 (0.0162s) ][ Debug on ]