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 Apr 19, 2024 7:37 pm
All times are UTC + 0
Reading and parsing through vxl files...
Moderators: Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 2 of 2 [89 Posts] Mark the topic unread ::  View previous topic :: View next topic
Goto page: Previous 1, 2
Author Message
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Tue Jun 23, 2015 7:32 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hopefully this is what your asking...

All I am doing is...

voxel RGB color (R,G,B)

R + (normal*0.15)
G + (normal*0.15)
B + (normal*0.15)

If I do not multiply 0.15 the vxl is pretty much bleached white... I can show if you do not understand...



This could be interesting...
normal's facing section 25... I think...
I think this is the front facing...
http://zombapro.ppmsite.com/iniedit/voxelload/normals2.php
(left click hold rotates cam)

I wonder if i could edit normal values by doing some thing like this...

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

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


Joined: 09 Feb 2015

PostPosted: Tue Jun 23, 2015 8:46 pm    Post subject: Reply with quote  Mark this post and the followings unread

Yea normals mode 2 has fewer facings than mode 4.

Are you more interested in a fixed direction light on the model that turns with the viewport, or dynamic lighting that stays constant with the viewport?

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

Back to top
View user's profile Send private message
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Tue Jun 23, 2015 9:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

Make sure that Normal is a value between 0  and 1. Then, you should calculate it as (R * Normal, G * Normal, B * Normal).

Back to top
View user's profile Send private message Visit poster's website Skype Account
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Tue Jun 23, 2015 9:27 pm    Post subject: Reply with quote  Mark this post and the followings unread

Banshee wrote:
Make sure that Normal is a value between 0  and 1. Then, you should calculate it as (R * Normal, G * Normal, B * Normal).


This method sort of helped a lot!

Only problem is it was to dark... Confused when its between 0-1
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlmuiltnorm.php

So I just added 1 to my normal value (that was in between 0-1) So its around 1-2 i guess... seems odd, but it did worked...
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlplusone.php


Quote:
Yea normals mode 2 has fewer facings than mode 4.

Are you more interested in a fixed direction light on the model that turns with the viewport, or dynamic lighting that stays constant with the viewport?


What do you mean mode 2 or 4?

Ya I think a fixed direction light will be fine... At least is looked fine in the second link I posted...





Anyways some other fun... Not sure what to make out of this yet, but this is all 32 sections of the voxel.vpl animated...

http://zombapro.ppmsite.com/iniedit/voxelload/normals.php

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

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


Joined: 09 Feb 2015

PostPosted: Tue Jun 23, 2015 10:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

TS voxels used mode 2, RA2 voxels used mode 4... less directions, same total contrast just simpler afaik.

BTW why don't you increase the base RGB value a bit prior to doing the lighting/normals? I believe the game does some kind of adjustment using the Ambient (+Level) lighting values.

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

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


Joined: 07 Nov 2003

PostPosted: Wed Jun 24, 2015 12:29 am    Post subject: Reply with quote  Mark this post and the followings unread

G-E wrote:
TS voxels used mode 2, RA2 voxels used mode 4... less directions, same total contrast just simpler afaik.

BTW why don't you increase the base RGB value a bit prior to doing the lighting/normals? I believe the game does some kind of adjustment using the Ambient (+Level) lighting values.

Is mode 2 and 4 in the voxel.vpl file? meaning in should ignore mode 2? Is that a range of sections...?

And I did not know the game increased the base RGB values... Do you know what they are? Because I can do that. Because I do feel as thought the gtnk is still kind of dark...



In other works, I am also still trying to figure out the location and scale stuff...

http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlloc.php

As of right now this is just using the minBounds from the vxl file to locate the vxls... Is this correct? I thought this stuff was in the hva? Or is this some thing that could be in two locations... Because the problem I have is the barl is not located correct... Confused

Also it seems like maxBounds is an extra? scale of the vxl... Is there some kind of divide happening here? Because the numbers are very large... And If apply them to the the vxl that is being built with the vxl spacing of 0.083... they get huge...

and whats the point of Transform in the vxl file?

There just seems to be an unnecessary amount of numbers in play...

And if I look in a hva file its kind of odd...

http://zombapro.ppmsite.com/iniedit/voxelload/readhva2.php

this is the shad.hva... some of these numbers just look oddly huge... and just bad...

1.00,-0.00,0.00,-421.56,
0.00,1.00,0.00,-0.75,
0.00,0.00,1.00,342.48,

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

Back to top
View user's profile Send private message Skype Account
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Wed Jun 24, 2015 1:08 am    Post subject: Reply with quote  Mark this post and the followings unread

Voxel Section Editor III uses an ambient color (0.2, 0.2, 0.2, 0) and diffuse color (0.8, 0.8, 0.Cool.

So, try the following formula with your color: (0.2 + (0.8 * R * Normal), 0.2 + (0.8 * G * Normal), 0.2 + (0.8 * B * Normal))


Bear in mind that R, G, B and Normal must be values between 0 and 1.

Back to top
View user's profile Send private message Visit poster's website Skype Account
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Wed Jun 24, 2015 1:35 am    Post subject: Reply with quote  Mark this post and the followings unread

The min and max bounds are relative to a notional center point of your 3D space. So if your voxel is 15 dots wide, you normally have a min-x around -7.5 and a max-x around +7.5, this means it is centered (not exactly though because it depends on odd/even sizes, the center falls on boundaries).

What this ALSO means, is you need to determine what the difference is to figure out your visible size. If your model has a min-z of -32 and max-z of 40, your visible length is 72, regardless what the actual size is on the z-axis.

Code:
   binary scan [read $of 16] {i i i f} lstart lend loffset lscale
   puts "Voxel Section $loopcnt: $lstart to $lend at offset $loffset"
   puts "Voxel Scale: $lscale"
   set dummy [read $of 48] ;# the transform float data
   binary scan [read $of 24] {f f f f f f} xmin ymin zmin xmax ymax zmax
   binary scan [read $of 4] {c c c c} xsize ysize zsize normals
   puts "Normals mode: $normals"
   puts "Section Dimensions:"
   puts "  Absolute Length: $xsize, Scaled: [expr $xmax - $xmin]"
   puts "  Absolute Width: $ysize, Scaled: [expr $ymax - $ymin]"
   puts "  Absolute Height: $zsize, Scaled: [expr $zmax - $zmin]"


Code:

Voxel Section 4: 26552 to 34232 at offset 41912
Voxel Scale: 0.833329975605011
Normals mode: 2
Section Dimensions:
  Absolute Length: 60, Scaled: 36.0
  Absolute Width: 32, Scaled: 18.0
  Absolute Height: 30, Scaled: 16.0

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

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


Joined: 07 Nov 2003

PostPosted: Wed Jun 24, 2015 3:02 am    Post subject: Reply with quote  Mark this post and the followings unread

So adding a RGB ambient light makes it even nicer!   Smile

http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlscale.php

And I guess I see the scale now. It does make since... So am am calculation it like that.

But this is what always bothered me about vxls... I though some were positioned using the scale (specifically westwoods)...  Because if I delete the hva's and let vxl edit make new ones the locations are still fine... So does that mean the location is one of the min/max values?

The current version locates off the minBounds and it looks good except the barl...

Were is the location coming from... its not the hva...?

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

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


Joined: 09 Feb 2015

PostPosted: Wed Jun 24, 2015 3:18 am    Post subject: Reply with quote  Mark this post and the followings unread

MadHQ wrote:
Were is the location coming from... its not the hva...?

Yes it means the voxel bounds are dictating where it's new center is.

But like I said, if the scale isn't the same as the actual size, then locating the actual size just off the minimum bounds won't yield the accurate result... you need to scale it.

When you make a turret, you do it with a positive minimum vertical bound, and a positive maximum bound, it could be a total of 7 pixels tall, floating 10 pixels off the ground. You choose the min relative to the underlying tank's height, AND where it centers. The tank's 3D space center is at ground level, the min-y is 0 or 0.5 or something like that.

If you want a turret on the Kirov, the Kirov's bounds center it in the 3D space (the rule for aircraft), so your turret offset would only have to move by half the height of the Kirov... makes sense?

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


Joined: 07 Nov 2003

PostPosted: Wed Jun 24, 2015 3:38 am    Post subject: Reply with quote  Mark this post and the followings unread


_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

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


Joined: 09 Feb 2015

PostPosted: Wed Jun 24, 2015 4:11 am    Post subject: Reply with quote  Mark this post and the followings unread

Start with the center of the 3D space, then offset the voxel relatively based on the min/max bounds (0 is center). This gives you a new voxel center. Then when you overlay a turret or a barrel, overlay the voxel on the same center point, then repeat the same bounds checking to offset it negatively or positively in each axis. Same for the barrel.

If it makes it easier, convert the scaled size into a percentage and multiply the model's dot spacing by it so the dots overlap. Just keep in mind that the scaling doesn't have to be equal on each axis, you could be 80% on Z but 92% on Y.

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

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


Joined: 07 Nov 2003

PostPosted: Wed Jun 24, 2015 3:46 pm    Post subject: Reply with quote  Mark this post and the followings unread

...

...

You know... I am very new to programming... I am senior undergraduate in computer science. And I have to tell you there are times were I really! REALLY! Hate programming...  Confused

I was using the wrong array index's... After going through this topic... I am starting to notice a tread in errors...  Confused

gtnk...
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlprogingsucks1.php

apoc...
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlprogingsucks2.php

Now those are not using hva data... Now I need to update it so it use's hva data...

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

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


Joined: 09 Feb 2015

PostPosted: Wed Jun 24, 2015 4:36 pm    Post subject: Reply with quote  Mark this post and the followings unread

Good job Smile

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

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


Joined: 07 Nov 2003

PostPosted: Wed Jun 24, 2015 7:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

alright...

Now it time to figure out the transformation data in the hva files...  Laughing

This just shows the X transformation problem... Y&Z not used yet...
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlshad.php


now this is all the data out of the shad hva...

http://zombapro.ppmsite.com/iniedit/voxelload/readhvashad.php

1st rotors frame 1 matrix....
TTransformMatrix = (
1.00,-0.00,0.00,-421.56,
0.00,1.00,0.00,-0.75,
0.00,0.00,1.00,342.48,
)

Last time I checked isnt -421.56 the X location? That is what I am using in the shad render... However they way to far away from were there meant to be... I am multiplying by vxl scale... and its just not enough... Is there some kind of matrix math I do not know...

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

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


Joined: 09 Feb 2015

PostPosted: Wed Jun 24, 2015 8:25 pm    Post subject: Reply with quote  Mark this post and the followings unread

Unless it's in leptons? I don't know...

Without adjusting for hva, where do the rotors end up?

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

Back to top
View user's profile Send private message
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Wed Jun 24, 2015 8:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

I've explained you in one of the PMs I've sent you some time ago, but I'll repeat it here: Westwood's coordinates are f*cked up... errr... I mean, are different. You need to convert them.

VXLSE III: X positive is right; Y positive is high; Z is towards the user (depth).

Westwood's: X is towards the user (depth); Y positive is right; Z positive is high.

By default, WebGL uses the same coordinate system as VXLSE III.

Back to top
View user's profile Send private message Visit poster's website Skype Account
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Wed Jun 24, 2015 9:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

Banshee wrote:
VXLSE III: X positive is right; Y positive is high; Z is towards the user (depth).

Westwood's: X is towards the user (depth); Y positive is right; Z positive is high.

Yea I caught that when I saw the log, that's why I changed my code to say Length instead of X...

However -485 is a large number on any axis, do you have to multiply it by 1/12th or what?

Back to top
View user's profile Send private message
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Wed Jun 24, 2015 9:22 pm    Post subject: Reply with quote  Mark this post and the followings unread

Yes, you have to multiply it by the Scale value (1/12).

Back to top
View user's profile Send private message Visit poster's website Skype Account
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Thu Jun 25, 2015 12:02 pm    Post subject: Reply with quote  Mark this post and the followings unread

AH! dividing by the scale (1/12) really helped! I would have never thought of that...

Now I am really close!!

I may not be doing the rotation transformation correct though...

The animations have been slowed down to get a better look...

The shad plus animation looks good!
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlshadanim.php

My small allied mech looks okay... Turret seems a little off...
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlsmmmch.php

Now my bigger allied mech not so much... There some kind of turret location issue...
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlody.php

Is there some kind of special handling when it comes to hva stuff?

I ask this because the larger mechs turret offset is only 16.00 (and not some large numbers like seen in the shad), now if I divide 16 the by 12 it doesn't move to the correct location...

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

Back to top
View user's profile Send private message Skype Account
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Thu Jun 25, 2015 4:07 pm    Post subject: Reply with quote  Mark this post and the followings unread

As far as I could look at your code, the way you detect the rotation is very.... very weird.

I think you need to re-think it conceptually from scratch.

Instead of using setPosition, you should try to use multiply with the whole matrix at once (make sure that the matrix is converted to your coordinate system already).

Back to top
View user's profile Send private message Visit poster's website Skype Account
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Thu Jun 25, 2015 6:26 pm    Post subject: Reply with quote  Mark this post and the followings unread

Thanks! So kind... Laughing

Okay, so I knew about the matrix stuff with three.js however... I just do not understand that stuff...

This is the best guess I can make about it... I still had to move the location manually...

With matrix action... as you can see not even close... Laughing My odd attempt was better. (link bellow)
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlmatrix.php

My crazed attempt at setting up that matrix stuff...Laughing

Code:
   function setHvaData2(x,v){
      var m = new THREE.Matrix4(1,0,0,0,
                0,1,0,0,
               0,0,1,0,
               0,0,0,1
               );

      //hvaDat[v][0] hvaDat[v][1] hvaDat[v][2] hvaDat[v][3]
      //hvaDat[v][4] hvaDat[v][5] hvaDat[v][6] hvaDat[v][7]
      //hvaDat[v][8] hvaDat[v][9] hvaDat[v][10] hvaDat[v][11]
      //0            0            0             1
      var m1 = new THREE.Matrix4(parseFloat(hvaDat[v][0]),parseFloat(hvaDat[v][1]),parseFloat(hvaDat[v][2]),parseFloat(hvaDat[v][3]),
                parseFloat(hvaDat[v][4]),parseFloat(hvaDat[v][5]),parseFloat(hvaDat[v][6]),parseFloat(hvaDat[v][7]),
               parseFloat(hvaDat[v][8]),parseFloat(hvaDat[v][9]),parseFloat(hvaDat[v][10]),parseFloat(hvaDat[v][11]),
               0,0,0,1
               );
      var m2 = new THREE.Matrix4(parseFloat(hvaDat[v][0]),parseFloat(hvaDat[v][1]),parseFloat(hvaDat[v][2]),parseFloat(hvaDat[v][3]),
                parseFloat(hvaDat[v][4]),parseFloat(hvaDat[v][5]),parseFloat(hvaDat[v][6]),parseFloat(hvaDat[v][7]),
               parseFloat(hvaDat[v][8]),parseFloat(hvaDat[v][9]),parseFloat(hvaDat[v][10]),parseFloat(hvaDat[v][11]),
               0,0,0,1
               );
      var m3 = new THREE.Matrix4(parseFloat(hvaDat[v][0]),parseFloat(hvaDat[v][1]),parseFloat(hvaDat[v][2]),parseFloat(hvaDat[v][3]),
                parseFloat(hvaDat[v][4]),parseFloat(hvaDat[v][5]),parseFloat(hvaDat[v][6]),parseFloat(hvaDat[v][7]),
               parseFloat(hvaDat[v][8]),parseFloat(hvaDat[v][9]),parseFloat(hvaDat[v][10]),parseFloat(hvaDat[v][11]),
               0,0,0,1
               );

      var alpha = 0;
      var beta = Math.PI;
      var gamma = Math.PI/2;

      m1.makeRotationX( alpha );
      m2.makeRotationY( beta );
      m3.makeRotationZ( gamma );

      m.multiplyMatrices( m1, m2 );
      m.multiply( m3 );

      voxelSection[x].applyMatrix(m);

      voxelSection[x].position.x = (parseFloat(hvaDat[v][3])/12) * voxelSpaceing ;
      voxelSection[x].position.y = (parseFloat(hvaDat[v][11])/12) * voxelSpaceing;
      voxelSection[x].position.z = (parseFloat(hvaDat[v][7])/12) * voxelSpaceing;

   }



But on a plus side, I did manage to figure out why turrets were not properly shifted (not including the z location problem)... I was not taking the scale into consideration when I was setting the origin location... Laughing

http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlshiftfix.php

Last edited by MadHQ on Thu Jun 25, 2015 6:35 pm; edited 1 time in total

Back to top
View user's profile Send private message Skype Account
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Thu Jun 25, 2015 6:34 pm    Post subject: Reply with quote  Mark this post and the followings unread

Bear in mind a couple of things:

1) The one at the right bottom corner of your hvaDat[v] matrix is supposed to be the Scale (1/12) instead of 1.

2) You don't need to have m1, m2 and m3. You just need to apply hvaDat[v] at VoxelSection[x].

Back to top
View user's profile Send private message Visit poster's website Skype Account
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Thu Jun 25, 2015 6:57 pm    Post subject: Reply with quote  Mark this post and the followings unread

...I do not know if matrix's work right... in three.js

I did swap hvaDat[v][11] & hvaDat[v][7] to fix the difference in ra2 and webgl...

Code:
   function setHvaData2(x,v){
      var scale = 1/12;
      var m = new THREE.Matrix4().set(parseFloat(hvaDat[v][0]),parseFloat(hvaDat[v][1]),parseFloat(hvaDat[v][2]),parseFloat(hvaDat[v][3]),
                parseFloat(hvaDat[v][4]),parseFloat(hvaDat[v][5]),parseFloat(hvaDat[v][6]),parseFloat(hvaDat[v][11]),
               parseFloat(hvaDat[v][8]),parseFloat(hvaDat[v][9]),parseFloat(hvaDat[v][10]),parseFloat(hvaDat[v][7]),
               0,0,0,scale
               );

      voxelSection[x].applyMatrix(m);
      voxelSection[x].updateMatrix();

   }



lol.jpg
 Description:
 Filesize:  61.93 KB
 Viewed:  2304 Time(s)

lol.jpg



_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

Back to top
View user's profile Send private message Skype Account
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Thu Jun 25, 2015 7:56 pm    Post subject: Reply with quote  Mark this post and the followings unread

So if I manually set the location and not include it in the matrix... It kind of becomes clear as to whats going on...

Code:
   function setHvaData2(x,v){
      var scale = 1/12;

      var m = new THREE.Matrix4().set(parseFloat(hvaDat[v][0]),parseFloat(hvaDat[v][1]),parseFloat(hvaDat[v][2]),/*parseFloat(hvaDat[v][3])*/0,
                parseFloat(hvaDat[v][4]),parseFloat(hvaDat[v][5]),parseFloat(hvaDat[v][6]),/*parseFloat(hvaDat[v][7])*/0,
               parseFloat(hvaDat[v][8]),parseFloat(hvaDat[v][9]),parseFloat(hvaDat[v][10]),/*parseFloat(hvaDat[v][11])*/0,
               0,0,0,scale
               );

      voxelSection[x].applyMatrix(m);
      voxelSection[x].updateMatrix();

      voxelSection[x].position.x = (parseFloat(hvaDat[v][3])/12) * voxelSpaceing ;
      voxelSection[x].position.y = (parseFloat(hvaDat[v][11])/12) * voxelSpaceing;
      voxelSection[x].position.z = (parseFloat(hvaDat[v][7])/12) * voxelSpaceing;

   }


Its looks like its kind of adding the matrix's... Now I need to find out how to reset them...

plus the rotation axis is not correct... Confused I am not sure how to fix that...

http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlhardlocset.php

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

Back to top
View user's profile Send private message Skype Account
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Thu Jun 25, 2015 8:37 pm    Post subject: Reply with quote  Mark this post and the followings unread

I hope this VXLSE III code inspire you:

http://svn.ppmsite.com/filedetails.php?repname=OS+Voxel+Tools&path=%2Fvxlseiii14x%2Fsource%2Fdocument%2FHVA.pas
Code:
procedure THVA.WestwoodToOpenGLCoordinates;
var
   i : integer;
   Temp: single;
begin
   for i := Low(TransformMatrices) to High(TransformMatrices) do
   begin
      Temp := TransformMatrices[i][1][1];
      TransformMatrices[i][1][1] := TransformMatrices[i][2][2];
      TransformMatrices[i][2][2] := TransformMatrices[i][3][3];
      TransformMatrices[i][3][3] := Temp;
      Temp := TransformMatrices[i][1][2];
      TransformMatrices[i][1][2] := TransformMatrices[i][2][3];
      TransformMatrices[i][2][3] := TransformMatrices[i][3][1];
      TransformMatrices[i][3][1] := Temp;
      Temp := TransformMatrices[i][1][3];
      TransformMatrices[i][1][3] := TransformMatrices[i][2][1];
      TransformMatrices[i][2][1] := TransformMatrices[i][3][2];
      TransformMatrices[i][3][2] := Temp;
      Temp := TransformMatrices[i][1][4];
      TransformMatrices[i][1][4] := TransformMatrices[i][2][4];
      TransformMatrices[i][2][4] := TransformMatrices[i][3][4];
      TransformMatrices[i][3][4] := Temp;
   end;
end;


And yes, you have to remove your voxelSection[x].position instructions.

Back to top
View user's profile Send private message Visit poster's website Skype Account
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Thu Jun 25, 2015 8:53 pm    Post subject: Reply with quote  Mark this post and the followings unread

BTW don't forget a lot of units use TurretOffset in art.ini Smile

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

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


Joined: 07 Nov 2003

PostPosted: Fri Jun 26, 2015 5:02 pm    Post subject: Reply with quote  Mark this post and the followings unread

Unless I messed up the swap, witch I do not think i did... I think I am going to have to ditch the matrix4 approach... Because now, I can not find the vxls anywhere in the scene... Laughing

So i think I am going to try and figure this out by hand... Laughing

Code:
      //hvaDat[v][0] hvaDat[v][1] hvaDat[v][2] hvaDat[v][3]
      //hvaDat[v][4] hvaDat[v][5] hvaDat[v][6] hvaDat[v][7]
      //hvaDat[v][8] hvaDat[v][9] hvaDat[v][10] hvaDat[v][11]

      //var m = new THREE.Matrix4().set(parseFloat(hvaDat[v][0]),parseFloat(hvaDat[v][1]),parseFloat(hvaDat[v][2]),/*parseFloat(hvaDat[v][3])*/0,
      //          parseFloat(hvaDat[v][4]),parseFloat(hvaDat[v][5]),parseFloat(hvaDat[v][6]),/*parseFloat(hvaDat[v][7])*/0,
      //         parseFloat(hvaDat[v][8]),parseFloat(hvaDat[v][9]),parseFloat(hvaDat[v][10]),/*parseFloat(hvaDat[v][11])*/0,
      //         0,0,0,scale
      //         );

      //hvaDat[v][5] hvaDat[v][6] hvaDat[v][4] hvaDat[v][7]
      //hvaDat[v][9] hvaDat[v][6] hvaDat[v][8] hvaDat[v][11]
      //hvaDat[v][1] hvaDat[v][2] hvaDat[v][0] hvaDat[v][3]

      var m = new THREE.Matrix4().set((parseFloat(hvaDat[v][5]),parseFloat(hvaDat[v][6]),parseFloat(hvaDat[v][4]),/*parseFloat(hvaDat[v][7])*/0,
                parseFloat(hvaDat[v][9]),parseFloat(hvaDat[v][6]),parseFloat(hvaDat[v][8]),/*parseFloat(hvaDat[v][11])*/0,
               parseFloat(hvaDat[v][1]),parseFloat(hvaDat[v][2]),parseFloat(hvaDat[v][0]),/*parseFloat(hvaDat[v][3])*/0,
               0,0,0,scale
               ));


My matrix coding by hand it way is not that far off...

Note* my animation was not that great for this mecha...
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlcen.php

the back right leg is upside down oddly...

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

Back to top
View user's profile Send private message Skype Account
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Fri Jun 26, 2015 5:52 pm    Post subject: Reply with quote  Mark this post and the followings unread

You've made a mistake with your matrix on SetHvaDat2. The second element of the second line is hvaDat[v][10] instead of hvaDat[v][6]. Then you can use applyMatrix and remove the setPositions.

It's either that or the matrix is:

5 9 1 13
6 10 2 14
4 1 0 12
3 7 11 15

Where 3, 7, 11 would be 0 and 15 is the scale.

Back to top
View user's profile Send private message Visit poster's website Skype Account
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Fri Jun 26, 2015 6:42 pm    Post subject: Reply with quote  Mark this post and the followings unread


_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

Back to top
View user's profile Send private message Skype Account
Banshee
Supreme Banshee


Also Known As: banshee_revora (Steam)
Joined: 15 Aug 2002
Location: Brazil

PostPosted: Fri Jun 26, 2015 7:01 pm    Post subject: Reply with quote  Mark this post and the followings unread

I guess you should try the other matrix that I've mentioned in my last post.

Back to top
View user's profile Send private message Visit poster's website Skype Account
G-E
Defense Minister


Joined: 09 Feb 2015

PostPosted: Fri Jun 26, 2015 7:14 pm    Post subject: Reply with quote  Mark this post and the followings unread

I would assume that being as the voxel format has the axes all different to WW's (although completely arbitrary), either WW didn't assign the axes in the generally accepted directions, or they had no instructions as to which side was up or forward and just picked them.

But it's pretty obvious your legs are walking sideways now, so some values are being loaded on the wrong axis. You did have it working earlier so it has to be your code...

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

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


Joined: 07 Nov 2003

PostPosted: Fri Jun 26, 2015 7:14 pm    Post subject: Reply with quote  Mark this post and the followings unread

Code:
      var m = new THREE.Matrix4().set(parseFloat(hvaDat[v][5]),parseFloat(hvaDat[v][9]),parseFloat(hvaDat[v][1]),/*parseFloat(hvaDat[v][some number])*/0,
                parseFloat(hvaDat[v][6]),parseFloat(hvaDat[v][10]),parseFloat(hvaDat[v][2]),/*parseFloat(hvaDat[v][some number])*/0,
               parseFloat(hvaDat[v][4]),parseFloat(hvaDat[v][1]),parseFloat(hvaDat[v][0]),/*parseFloat(hvaDat[v][some number])*/0,
               0,0,0,scale
               );


Laughing As the frames cycle the sections start to scale...  Laughing

http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlshrink.php

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

Back to top
View user's profile Send private message Skype Account
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Fri Jun 26, 2015 7:40 pm    Post subject: Reply with quote  Mark this post and the followings unread

MadHQ wrote:
Damn I did mess up the index... Laughing

... Well at least it keeps it in the view port now...  Laughing Still just not sure about this... Laughing

It looks as though all sections need to be rotated 90deg....  Confused

http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxllol.php


How would I rotate this matrix by 90 on the axis thats needed...

Dont I just flip the the signs.?

none rotated...
m00 m01 m02
m10 m11 m12
m20 m21 m22

rotated some degree...
m00 -m01 m02
-m10 m11 m12
m20 m21 m22

On top of that problem I do not understand why it keeps incriminating/adding the rotation... I cant find anything about resting the applymatrix...

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

Back to top
View user's profile Send private message Skype Account
MadHQ
Commander


Joined: 07 Nov 2003

PostPosted: Sat Jun 27, 2015 2:24 am    Post subject: Reply with quote  Mark this post and the followings unread

Best version I have so far... With hard coding the hva animations...

Still some location offsets to work on...

But i do not think its all that bad...

Ah and you have to turn on animations in the top right controllers box thing...
http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlgtnk.php

http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlody2.php

http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlcomch.php

http://zombapro.ppmsite.com/iniedit/voxelload/muiltivxlp51.php

Also added a hva edit 2.1 comparison... So Im not to far off... I add image as I thought the p51's rotor was not correct... as it looks... it looks like it should...



hvaedit21.png
 Description:
 Filesize:  32.71 KB
 Viewed:  2184 Time(s)

hvaedit21.png



_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

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


Joined: 09 Feb 2015

PostPosted: Sat Jun 27, 2015 3:08 am    Post subject: Reply with quote  Mark this post and the followings unread

You'll have to convert the FLH into leptons to be useable Smile

Good progress though!

PS. your helicopter one is drifting as it turns, it appears to be that you're still using the outer edge to locate the section instead of finding center...

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

Last edited by G-E on Sat Jun 27, 2015 3:15 am; edited 1 time in total

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


Joined: 07 Nov 2003

PostPosted: Sat Jun 27, 2015 3:15 am    Post subject: Reply with quote  Mark this post and the followings unread

G-E wrote:
You'll have to convert the FLH into leptons to be useable Smile

Good progress though!


Whats the leptons conversion? Because I think I will have to do that for a turret offset as well...

_________________
MadHQ's Graveyard - Click here!
(Permissions) - (F.A.Q.)

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


Joined: 09 Feb 2015

PostPosted: Sat Jun 27, 2015 3:25 am    Post subject: Reply with quote  Mark this post and the followings unread

Thing is the lepton offset is independent of voxel scale/bounds, it is an absolute position from the center of the 3D space... or more specifically the FLH is an absolute offset from the center of the turret, which is an absolute offset from the center of the unit.

Assuming your unit is centered in a tile, the very edge of the tile is 256 leptons away.

The values for TurretOffset: positive is forward, negative is rearward. However I believe they use 128 to the tile edge like DockingOffset (256 per tile length), not 256 like FLH (512 per tile length).

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

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


Joined: 13 Nov 2003
Location: Eindhoven

PostPosted: Mon Jun 29, 2015 7:26 am    Post subject: Reply with quote  Mark this post and the followings unread


_________________



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
Display posts from previous:   
Post new topic   Reply to topic Page 2 of 2 [89 Posts] Goto page: Previous 1, 2
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.2380s ][ Queries: 15 (0.0148s) ][ Debug on ]