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 Tue Oct 15, 2024 10:41 pm
All times are UTC + 0
VXL Scale, Tranform, Bounds
Moderators: Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 1 of 1 [15 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
Zorbung
Soldier


Joined: 04 Jun 2021

PostPosted: Tue Nov 02, 2021 4:16 pm    Post subject:  VXL Scale, Tranform, Bounds Reply with quote  Mark this post and the followings unread

About .vxl files, can some expert here tell me the exact relationship between scale, transform and bounds? Any formula would also be really nice.

Back to top
View user's profile Send private message
Mig Eater
Defense Minister


Joined: 13 Nov 2003
Location: Eindhoven

PostPosted: Tue Nov 02, 2021 4:36 pm    Post subject: Reply with quote  Mark this post and the followings unread

Scale doesn't really do anything, it can be anything greater then 0 (RA2 voxels typically use 0.0833333358168602). If the voxel has multiple sections then all sections need to be the same though or it can cause problems.

The Transform matrix is used to control the voxel's position & rotation, its used in-conjunction with the HVA file to animate voxels.

Bounds are used to set the voxel's in-game render size & it's offset from the center point.

_________________



Back to top
View user's profile Send private message Visit poster's website ModDB Profile ID YouTube User URL Facebook Profile URL Twitter Channel URL
Zorbung
Soldier


Joined: 04 Jun 2021

PostPosted: Tue Nov 02, 2021 6:07 pm    Post subject: Reply with quote  Mark this post and the followings unread

Mig Eater wrote:
Scale doesn't really do anything


It seems high scale values are crashing the game, but lower values (like 0.01) affect where the other sections such as rotors are positioned, so I don't think it does nothing.

So far I'm guessing it works like this:
Bounds are building a scaling/translation matrix, then multiplied with the transform. The final matrix is then used as a base for multiplication with each .hva frame, or maybe each hva frame replaces it dunno. Scale doesn't affect object size but is somehow applied to position other voxels/sections, probably as a precalculated value.

Again, if anyone knows more details about how this works kindly share it here, thanks!

Back to top
View user's profile Send private message
Mig Eater
Defense Minister


Joined: 13 Nov 2003
Location: Eindhoven

PostPosted: Tue Nov 02, 2021 6:48 pm    Post subject: Reply with quote  Mark this post and the followings unread

Yes the scale effects the Transform matrix calculations, so if you modify the matrix from the default settings & then later change the scale it will cause problems.  

Most voxels dont use the Transform matrix & there is no reason to change the scale setting after you have initially created the voxel, so for the average person the scale is inconsequential.

There was an article written about 20 years ago explaining the file format in greater detail but I cant remember where it is now & who made it though.

_________________



Back to top
View user's profile Send private message Visit poster's website ModDB Profile ID YouTube User URL Facebook Profile URL Twitter Channel URL
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Tue Nov 02, 2021 7:55 pm    Post subject: Reply with quote  Mark this post and the followings unread

The most important thing to understand is that there is an _actual_ size as in the number of dots in any direction, and the _render_ size which is calculated by changing the bounds to be less than the actual size. I say less because if the bounds are larger than actual size, then the dots space themselves apart, and your voxel will become a point cloud instead of a solid.

When you should scale down something with bounds is not a straight answer, you have to draw the voxel with shrinkage in mind for best results, but you may not know if you want to shrink it before you make it either. The most common shrinkage I use is 80%, which means whatever the values you see in the bounds box after making (or resizing because it resets bounds) the voxel, you multiply them by 0.8 and replace the values. For the purposes of shrinkage, you are shrinking the canvas in its entirety, so don't worry about the resulting fractions, the game engine will figure it out.

Note VXLSE doesn't accurately center voxels unless they are an odd number wide and your object is slightly to the left (pretty sure left) so in any case, new or shrunken, HVA Builder will be necessary to properly re-center everything, using the voxel offset function.

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

Back to top
View user's profile Send private message
Zorbung
Soldier


Joined: 04 Jun 2021

PostPosted: Wed Nov 03, 2021 3:10 am    Post subject: Reply with quote  Mark this post and the followings unread

Thanks guys, but I'm not making voxels, I'm trying to make a 3D vxl/hva editor. It got pretty far already, load/save is bug free, rendering is almost done, same with the gizmos, viewport navigation etc but I need exact math to complete it.

@Mig Eater: you're probably talking about this:
https://ppmforums.com/viewtopic.php?t=29369&sid=12b41f85a5578715a87fc323bf834cca
Unfortunately not everything is explained, I guess I'll have to keep searching and testing things myself



3dvxlhva.jpg
 Description:
 Filesize:  150.66 KB
 Viewed:  2121 Time(s)

3dvxlhva.jpg



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


Joined: 09 Feb 2015

PostPosted: Wed Nov 03, 2021 3:30 am    Post subject: Reply with quote  Mark this post and the followings unread

The Scale field I believe is the theoretical dot size, it is nominally 1/12th because that seemed to correlate to 1 pixel on screen, and why there's no reason to change it.

The origin should be in the middle because all things in RA2/TS are based on either absolute center, except terrain objects that need an -15px offset. Ideally your ability to center the voxel automatically would be able to do fractional offsets (like 0.5px)...

The normals part is going to be the hardest tool to make, because there's no one right way, and often drawing a voxel will require 3-4 different sets of values for affecting the tool in VXLSE. Someone was working on another voxel editor and had tried to make a one-size fits all automatic normalizing, but from what I saw it only worked well on the smaller side of things, highlighting every edge of every step. Any normals tool would require lots of confguration choices open to user modification on the fly, the option of only normalizing newly drawn pixels, the ability to select pixels to clear of their normals value, etc. A normals smoother (and sharpener) brush would be nice to have, as would the ability to smooth along a plane only, so that any smoothing is done without influence from the perpendicular. I could go on about this for a while...

What's the goal here though, why are trying to make this? A lot of people have started and abandoned unfinished tools in the past, so what motivates you?

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

Back to top
View user's profile Send private message
Zorbung
Soldier


Joined: 04 Jun 2021

PostPosted: Wed Nov 03, 2021 3:50 pm    Post subject: Reply with quote  Mark this post and the followings unread

@G-E
It's not THAT difficult as you make it sound and I'm taking my time making it so it's not major effort for me, this is how I finish all my projects. Besides 3D is fun, just a vector play and much easier than 2D to be honest.

Making the final result show as expected ingame is the hardest part though that's why I need to know how the game engine transformations work to avoid things like rotors showing in the wrong places and such.

Manually adjusting to fix the current tools limitations is an unacceptable waste of time which can be better spent by doing actual modding... I'm also aiming for a friendly approach so artists won't have to do math or manual matrix setups...

The goal? Making the game I love better by supporting modders I guess, which usually returns a huge profit in play time  Very Happy

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


Joined: 09 Feb 2015

PostPosted: Wed Nov 03, 2021 4:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

Perhaps a better approach would be to use 3D to craft the model and then "render" it into a voxel? If you have the planes already defined by the surface shape, deriving normals from it is easy. In fact you could even keep the two editing modes in parallel to switch between, or at least preview the resulting voxel before you save. That approach hasn't been done before.

I mean I could suggest someone work on a voxel plugin for a modelling program like Blender or Max, in a sense bypassing the 3ds2vxl tool.

On the question of showing rotors in the wrong places, RA2 has a few conditions that determine voxel section dominance, a turret is always rendered over the hull for example. Under more normal circumstances the section that has its canvas closest to the viewer (even if it is just the corner of the canvas) is drawn over everything else, this is typically where rotor rendering fails, the rotor is made too small to encompass the corners of the main section. Sometimes it is unavoidable how a helicopter's tail is always going to be longer, and thus in approximately 1/3 of unit rotation will be closer to the viewer.

From my experience, it seems this dominance isn't a hierarchy, the game engine just picks 1 section to display over the others, the rest are occluded normally. I'm not sur ehow this helps you make the tool, it's more something the voxel creator has to understand.

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

Back to top
View user's profile Send private message
Zorbung
Soldier


Joined: 04 Jun 2021

PostPosted: Thu Nov 04, 2021 2:12 pm    Post subject: Reply with quote  Mark this post and the followings unread

Besides manual editing, there will be a function to autocreate voxels from renders (real stuff like Blender/3DS/Houdini/whatever), the artist provides top, bottom, left, right, back and front renders (6 pictures) and the voxel model is built on the spot. Polish the final result if needed and auto/manual paint normals, then switch to hva mode to adjust things and that's it.

Back to top
View user's profile Send private message
4StarGeneral
General


Joined: 14 Sep 2006
Location: Limbo

PostPosted: Thu Nov 04, 2021 2:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

The problem with that method is how would it handle hills and valleys in central parts only visible to 1 viewing angle though?

For example:



ex1.png
 Description:
 Filesize:  62.72 KB
 Viewed:  2039 Time(s)

ex1.png



_________________
"Don't beg for things; Do it yourself or you'll never get anything."

Back to top
View user's profile Send private message Send e-mail YouTube User URL
adamstrange
Cyborg Cannon


Joined: 07 Mar 2013

PostPosted: Fri Nov 05, 2021 3:45 pm    Post subject: Reply with quote  Mark this post and the followings unread

This was a question I was about to ask until a saw this post.
How do I make the grizzly take bigger to match my other tanks in size ?

I did manage by mistake to make it very small so I reloaded the VXL and saw where it says SIZE IN GAME and I added 10 to each of the first numbers so like where X is 29.8234100341797, I just made it 39.8234100341797

I did get to the size I wanted but it came out all messed up.

So what are the proper function in hva builder to make it bigger ?



gamemd 2021-11-05 11-13-16-57.png
 Description:
 Filesize:  101.88 KB
 Viewed:  2019 Time(s)

gamemd 2021-11-05 11-13-16-57.png



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


Joined: 09 Feb 2015

PostPosted: Fri Nov 05, 2021 4:49 pm    Post subject: Reply with quote  Mark this post and the followings unread

adamstrange wrote:
I did get to the size I wanted but it came out all messed up.

So what are the proper function in hva builder to make it bigger ?

Like I said, if you enlarge it past the number of actual dots they space themselves out. You need to add more actual dots.

You can use the "full resize" option which can double the voxel in every direction, but this results in a massive size, and blocky shape, which will then require you to go back and delete lots of unnecessary and unwated dots or even full layers.

A more useful approach is that you cut/copy and paste layers farther apart after just increasing the canvas size. You will have to expand your voxel in one direction, like say widen it, then expand it vertically or lengthwise, then the other. You still need to fix the resulting voxel, a round wheel won't look round with only a fractional increase in size, and it's likely any flat planes or vectored shapes like the tracks won't look right.

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

Back to top
View user's profile Send private message
Zorbung
Soldier


Joined: 04 Jun 2021

PostPosted: Sun Nov 07, 2021 3:34 pm    Post subject: Reply with quote  Mark this post and the followings unread

4StarGeneral wrote:
The problem with that method is how would it handle hills and valleys in central parts only visible to 1 viewing angle though?


it's true that only works correctly for convex shapes, but should be much easier to fix details manually rather than doing it all from scratch by hand

Back to top
View user's profile Send private message
XxpeddyxX
Commander


Joined: 03 Sep 2004

PostPosted: Mon Nov 08, 2021 7:44 am    Post subject: Reply with quote  Mark this post and the followings unread

You could actually make voxels exceed their bounds/transform in TS without separating them like in RA2 (as shown in adam's screenie), something was changed in how voxels are drawn along the way

_________________

ayylmao on Discord

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [15 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.2758s ][ Queries: 16 (0.0502s) ][ Debug on ]