Thread: RuneScape's Rendering and Animation System

Results 1 to 6 of 6
  1. #1 RuneScape's Rendering and Animation System 
    Registered Member
    The Wanderer's Avatar
    Join Date
    Mar 2010
    Posts
    596
    Thanks given
    44
    Thanks received
    152
    Rep Power
    196
    Wasn't sure if this is the right section as this is more informative than tutorial-like.

    Animation Skins:
    Let's start with TSKINS, VSKINS1, and PRI:. Let's start with the easiest of the three, PRI:. PRI: stands for priorities. This is how the client knows what to show over another object. This is why sometimes items will glitch in RuneScape because either the priorities are wrong, or it is nearly impossible to get the priorities to match with every single item. Sometimes a cape will show over a plate body, or plate legs on top of a plate body. The higher the value the more it will show over top of. Like the chest piece of a armor is PRI: 3, and the platelegs are PRI:2.

    Next we will do VSKINS. VSKINS is how you group each vertice in a model. If a vertex requires a numerical value of more than 100, e.g., gloves, you must make two separate objects. One labeled VSKINS1: and the other labeled VSKINS2:. Say you wanted the vertex to be grouped as 180. You would set that vertex's value to be 100 on VSKINS1: and 80 on VSKINS2:. Then DatMaker would combine the values and read it as 180 when converting to a .dat file extension. If you have ever played on a RSPS where when you walk your item glitches all up, this is because the VSKINS aren't correct. Basically they allow animation to be set to the model.

    Next we have TSKINS. TSKINS are used for changing alpha values.

    You can think of it this way. You have a bone O-----O. At the end are two O's. These stand for your VSKINS. The ------- stands for your priorities. And the TSKIN would go around the bone. Now let's say that the O on the left's value is 6 and the O on the right is 7. That bone cannot bend because there isn't a weight in between it. O--O----O. This bone could move. The order of the weights would go 6, 7, 8, from left to right. Generally as you get closer to the edge of a model, the VSKIN values increase.

    Rendering System:
    The max number of triangles with a priority value (excluding flags) that will be rendered in an unaltered client is 2000. If the model exceeds 2000 triangles with priority animation data, then the model will be returned as a null and will appear invisible.

    The max number of triangles, period, rendered in an unaltered client is 4096. That means if a model contains 4097 triangles, it will be returned as a null and appear invisible.

    That max model extents, meaning the maximum x,y,z value is +/-1024... sqrt(1024²*1024²) = 1448.1546 (RuneScape uses 1500 just to make sure).

    When rendering a model, the client uses fixed point arithmatic (Fixed Point Arithmetic) which basically means any vertices less than 4 units in distance will end up at the same point on the screen. That is why if you ever try loading a high polygon-count model into the RuneScape client, the rendering will be shit.

    Animations (::emote):
    An unedited client can't load animation files with data chunks greater than 2^16 bytes long, neither can RSPoser (program by MrPotatoHead to make animations for a 317 client). RSPoser can, but then it crashes. The 474 and 508 animation files hold data in different locations; the frame duration in the 317 is in the file, in the 474, it's in seq.dat. Same with frame IDs.

    Some notes and help from MrPotatoHead:
    Quote Originally Posted by MrPotatoHead
    - take a look at the player equipment for old and new models, i was wondering why they used the tskin data they way they do on alot of models, it's pretty useless data in reality as it's only there for changing alpha values.
    Use the false color buton on datmaker and inspect the VSKIN and TSKIN values.

    - could do with some help "mapping" the relationships, but as usual i'll probably end up doing it myself so just point out anything interesting you might find.

    Code:
    The false colors in datmaker show that the TSKIN colors and VSKIN numbers
    have a direct relationship in that where the colors meet the VSKIN number
    always changes to a number that is a direct property of the colors in the
    triangles that use that vertex.
    So in reality only a TSKIN needs to be made.
    
    the tskin color to vskin scheme does NOT follow for ALL models.
    It is however good enough for player and equiptment.
    also some points are manually edited.... 
    
    general arrangement for trousers.
    
    tskin 21 only 	vskin = 38
    tskin 21+20 	vskin = 37
    tskin 20 only 	vskin = 36
    tskin 20+23 	vskin = 35
    tskin 23 only 	vskin = 43
    tskin 22 only 	vskin = 41
    tskin 22+23 	vskin = 40
    tskin 17 only 	vskin = 30
    tskin 17+22 	vskin = 29
    tskin 24 only 	vskin = 44
    tskin 22+24 	vskin = 42
    tskin 22+23+24 	vskin = 39
    tskin 24+19 	vskin = 34
    tskin 19 only 	vskin = 33
    tskin 18 only 	vskin = 32
    tskin 18+19 	vskin = 31

    Quote Originally Posted by MrPotatoHead
    This is the vertex skin list from the 317 client for the character model, it is used to animate the model.
    format is :- (description) type animation_type list vertex_skin_values.

    Animation types are 0,1,2,3,5 (there is no 4)
    0 sets the reference point
    1 is translation
    2 is rotation
    3 is scale
    5 is set transparency (uses triangle skin numbers instead - obviously)

    I'm posting this for 2 reasons,
    1) CJ will find it very very interesting
    2) it needs completing, (fill in the text in brackets) just by attempting to complete it you might start to understand why the character parts have to have certain vertex skins. Just a quick read should show you the left shoulder has to be 25. Or that when you rotate the right arm and hand you rotate the whip as well, even if your not holding a whip.

    Copy and past the code to notepad++ or something so you can view it better.

    If anyone does complete this by christmas, please post it here.
    You'll see why i put the vskin checkbox into datmaker now

    P.S. some NPC skin lists are very different to this one.

    Code:
    (Base Tri) type 0 list 0  
    (V1_to_V129) type 1 list 1 3 2 8 4 5 19 17 26 23 22 20 21 25 28 27 50 51 56 52 53 65 54 66 30 29 41 39 40 42 37 38 35 31 32 34 47 46 48 45 6 7 9 10 11 12 13 14 15 16 18 24 33 36 43 44 49 55 57 58 59 60 61 62 63 64 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129  
    (V1_to_V129) type 2 list 1 3 2 8 4 5 19 17 26 23 22 20 21 25 28 27 50 51 56 52 53 65 54 66 30 29 41 39 40 42 37 38 35 31 32 34 47 46 48 45 6 7 9 10 11 12 13 14 15 16 18 24 33 36 43 44 49 55 57 58 59 60 61 62 63 64 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
    (Neck) type 0 list 3 2 
    (Head) type 2 list 1 3 
    () type 0 list 29 
    () type 1 list 1 3 2 8 19 17 26 23 22 20 21 25 28 27 50 51 56 52 53 65 54 66 9 10 11 12 13 14 15 16 18 24 49 55 58 59 60 61 62 63 64 69 72 86 91 92 93 94 109 110 111 112 113 114 115 116 117 118 119 120 121 123 129
    () type 2 list 1 3 2 8 4 5 19 17 26 23 22 20 21 25 28 27 50 51 56 52 53 65 54 66 30 29 6 9 10 11 12 13 14 15 16 18 24 49 55 58 59 60 61 62 63 64 67 68 69 72 86 91 92 93 94 109 110 111 112 113 114 115 116 117 118 119 120 121 123 129
    () type 0 list 40 101 102
    () type 2 list 40 37 38 35 47 46 36 43 57 76 81 82
    () type 0 list 37 35
    () type 2 list 37 38 47 46 36 76 82
    () type 0 list 47
    () type 2 list 46
    () type 0 list 42 103 122
    () type 2 list 42 31 32 34 48 45 33 44 77 80 83 126 127
    () type 0 list 31 34
    () type 2 list 31 32 48 45 33 77 83
    () type 0 list 48 
    () type 2 list 45
    (left shoulder) type 0 list 25
    (left arm full) type 1 list 26 23 22 25 28 24 68
    (left arm full) type 2 list 26 23 22 25 28 24 68
    (left elbow) type 0 list 23
    (left lower arm) type 2 list 22 28 68
    (left hand) type 0 list 28
    (left hand) type 1 list 28
    (left hand) type 2 list 28
    (right shoulder) type 0 list 21
    (right arm full) type 1 list 19 17 20 21 27 50 51 56 52 53 65 54 66 18 55 61 62 63 64 67 70 87 88 123
    (right arm full) type 2 list 19 17 20 21 27 50 51 56 52 53 65 54 66 18 55 61 62 63 64 67 70
    (right elbow) type 0 list 17
    (right lower arm) type 2 list 19 27 50 51 56 52 53 65 54 66 55 61 62 63 64 67 70 123 129
    (right hand) type 0 list 27
    (right hand) type 1 list 27 50 51 56 52 53 65 54 66 55 61 62 63 64 129
    (right hand) type 2 list 27 50 51 56 52 53 65 54 66 55 61 62 63 64 70 129
    () type 0 list 10
    () type 2 list 9 11 12 13 14 15 16 109 
    () type 0 list 9 
    () type 2 list 12 13 14 15 16 
    () type 0 list 14 
    () type 2 list 12 13 15 
    () type 0 list 13 
    () type 2 list 12
    () type 0 list 6
    () type 2 list 7
    () type 0 list 27 
    () type 1 list 50 51 56 52 53 65 54 66 55 61 62 63 64 87 88
    () type 2 list 50 51 52 53 65 54 66 55 61 62 63 64 
    () type 0 list 108 
    () type 2 list 95 98 104 108
    () type 0 list 98 104
    () type 2 list 95 98
    () type 0 list 107
    () type 2 list 96 97 99 100 105 106 107
    () type 0 list 100 106
    () type 2 list 96 97 100
    () type 0 list 98 99 100
    () type 3 list 95 96 97 98 99 100 104 105
    () type 0 list 130
    () type 1 list 130 131 132
    () type 2 list 130 131 132
    () type 0 list 96 97 100
    () type 1 list 96 97 100
    () type 0 list 1 3 2 8 4 5 19 17 26 23 22 20 28 27 30 29 41 39 40 42 37 38 35 31 32 34 0 47 46 48 45 6 7 9 10 11 12 13 14 33 36 69 94 109
    () type 3 list 1 3 2 8 4 5 19 17 26 23 22 20 21 25 28 27 50 51 56 52 53 65 54 66 30 29 41 39 40 42 37 38 35 31 32 34 0 47 46 48 45 6 7 9 10 11 12 13 14 15 16 18 24 33 36 43 44 49 55 57 58 59 60 61 62 63 64 67 68 69 73 74 75 76 77 78 79 80 81 82 83 84 85 86 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
    () type 0 list 5 30 29
    () type 3 list 41 39 40 42 37 38 35 31 32 34 47 46 48 45 7 12 13 14 15 16 33 36 43 44 76 77 79 80 81 82 83 95 96 97 98 99 100 101 102 103 104 105 106 107 108
    () type 5 list 0 1 4 2 10 14 12 9 11 13 16 15 29 28 30 17 22 21 20 23 18 19 24 27 26 25 3 5 6 7 8 31 32 33 34 35 36 37 38 39 40 41 42 43
    () type 5 list 44
    () type 3 list 130
    () type 0 list 111
    () type 2 list 112 113 114 115 116
    () type 0 list 114
    () type 2 list 112 113 116
    () type 0 list 112
    () type 2 list 113
    () type 0 list 110
    () type 2 list 117 118 119 120 121
    () type 0 list 119
    () type 2 list 117 118 121
    () type 0 list 117
    () type 2 list 118
    () type 0 list 111
    () type 3 list 112 113 114 115 116
    () type 0 list 110
    () type 3 list 117 118 119 120 121
    (whip handle) type 0 list 50
    (whip all) type 3 list 50 51 56 52 53 65 54 66 55 61 62 63 64 87 88
    (whip) type 0 list 51
    (whip) type 2 list 56 52 53 65 54 66 55
    (whip) type 0 list 53
    (whip) type 2 list 56 53 65 54 66 55 61 62 63 64 87 88
    (whip) type 0 list 54
    (whip) type 2 list 56 54 66 55 61 62 63 64 87 88
    (whip) type 0 list 56 66 55
    (whip) type 2 list 56
    (whip) type 0 list 64
    (whip) type 2 list 61 62 63 87
    (whip) type 0 list 63
    (whip) type 2 list 61 62
    (whip) type 0 list 62
    (whip) type 2 list 61
    () type 0 list 38 35 32 34 47 46 48 45
    () type 3 list 38 32 47 46 48 45
    () type 0 list 35 31
    () type 3 list 37 38 31 32 47 46 48 45
    () type 0 list 39
    () type 3 list 39 40 42 37 38 35 31 32 34 47 46 48 45
    () type 5 list 45 46 47 48 49 50 51 52
    () type 0 list 9
    () type 3 list 12 13 14 15 16
    () type 0 list 1 3 2 8 4 5 19 17 26 23 22 20 21 25 28 27 30 29 41 39 40 42 37 38 35 31 32 34 0 47 46 48 45 6 7 9 10 11 12 13 14 18 24 49 133 130
    () type 2 list 1 3 2 8 4 5 19 17 26 23 22 20 21 25 28 27 50 51 56 52 53 65 54 66 30 29 41 39 40 42 37 38 35 31 32 34 0 47 46 48 45 6 7 9 10 11 12 13 14 15 16 18 24 33 36 43 44 49 55 57 58 59 60 61 62 63 64 67 68 69 70 71 72 74 73 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
    () type 1 list 1 3 2 8 4 5 19 17 26 23 22 20 21 25 28 27 50 51 56 52 53 65 54 66 30 29 41 39 40 42 37 38 35 31 32 34 0 47 46 48 45 6 7 9 10 11 12 13 14 15 16 18 24 33 36 43 44 49 55 57 58 59 60 61 62 63 64 67 68 69 70 71 72 85 84 76 77 78 79 80 81 82 83 75 74 73 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 131 130 129 132 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
    Texture support in DatMaker written in Delphi by MrPotatoHead:
    Code:
    unit trig;
    
    interface
    
    uses
      Windows, OpenGL,SysUtils, FileRSM, OpenGl1x, Math;
    
    type
     Tex3Vx2UV = array[0..2] of TVector2d;
    
    function SinRule(lenb,angA,angB : Double) : Double;
    function len3D(x1,y1,z1,x2,y2,z2 : Integer) : Double;
    function CosRule(len1,len2,len3 : Double) : Double;
    procedure DoStuff;
    
    var
      UV: array of Tex3Vx2UV;
    
    implementation
    
    
    // procedure to calculate all of the UV coordinates in the model file
    // Call after loading the model and before displaying
    
    procedure DoStuff;
    var
    ti,i,k,testflag,s0,su,sv : Integer;
    lenau,lenaq,lenuq,lenus,lenav,lenvq,lentv : Double;
    Angle_U,Angle_V,U_number,V_number,Angle_A,Angle_B : Double;
    Error_Angle : Double;
    begin
    
    SetLength(UV, 0); SetLength(UV, GNumTriangles);
    
    // for each triangle in model
    for i := 0 to high(F) do
    begin
     testflag := 0;
    //for each point in model triangle.
    for k := 0 to 2 do
      begin
    
        if M[i] >1 then
    
            begin    //E1
    
            ti := ( (M[i] + 2) div 4) -1;
            lenau := len3D(V[Tex[ti][0]][0], V[Tex[ti][0]][1], V[Tex[ti][0]][2], V[Tex[ti][2]][0], V[Tex[ti][2]][1], V[Tex[ti][2]][2]) ;
            lenaq := len3D(V[Tex[ti][0]][0], V[Tex[ti][0]][1], V[Tex[ti][0]][2], V[F[i][k]][0], V[F[i][k]][1], V[F[i][k]][2]) ;
            lenuq := len3D(V[Tex[ti][2]][0], V[Tex[ti][2]][1], V[Tex[ti][2]][2], V[F[i][k]][0], V[F[i][k]][1], V[F[i][k]][2]) ;
            lenav := len3D(V[Tex[ti][0]][0], V[Tex[ti][0]][1], V[Tex[ti][0]][2], V[Tex[ti][1]][0], V[Tex[ti][1]][1], V[Tex[ti][1]][2]) ;
            lenvq := len3D(V[Tex[ti][1]][0], V[Tex[ti][1]][1], V[Tex[ti][1]][2], V[F[i][k]][0], V[F[i][k]][1], V[F[i][k]][2]) ;
    
    
    
            Error_angle := 0;
    //get angle A and B  for error correction.
            If (lenaq <> 0) AND (lenau <> 0) AND (lenav <> 0) AND (lenaq <> 0) then
            begin
              Angle_A := CosRule(lenaq,lenau,lenuq) ;
              Angle_B := CosRule(lenav,lenaq,lenvq) ;
              Error_angle := (Angle_A + Angle_B) - 90;
            end;
    
    
    //calculate U number
    
    if (lenau = lenaq ) AND (lenuq = 0) then U_number := 1.0
    else if (lenaq = 0) OR (lenau-lenaq = 0 ) then U_number := 0.0
     else
     begin
     Angle_U := CosRule(lenau,lenuq,lenaq) ;
     lenus := SinRule(lenuq,(90-Angle_U - Error_Angle),90) ;
    If lenau <> 0 then U_number := (lenau - lenus) * (1 / lenau)
    else MessageBox(0, PChar('division by Zero'), PChar('NaN'), MB_OK);
     end;
    
    //calculate V_number
    
    if (lenav =lenaq) AND (lenvq = 0)  then V_number := 1.0
    else if (lenaq = 0) OR (lenav-lenaq = 0) then V_number := 0.0
    else
     begin
     Angle_V := CosRule(lenvq,lenav,lenaq);
     lentv := SinRule(lenvq, (90 - Angle_V - Error_Angle), 90);
    If lenav <> 0 then  V_number := (lenav - lentv) * (1 / lenav)
    else MessageBox(0, PChar('division by Zero'), PChar('NaN'), MB_OK);
     end;
    
    
    
     UV[i][k][0] := V_number;
     UV[i][k][1] := 1-U_number;
    
    end else       //end E1
    begin
    //for when no texture is used
    UV[i][k][0] := 0;
    UV[i][k][1] := 0;
    end ;
    
    end;  //end of k loop
    
    
    
    end; //end of i loop
    
    end;  //end of procedure
    
    
    function len3D(x1,y1,z1,x2,y2,z2 : Integer) : Double;
    begin
    Result := Sqrt( ((x1-x2)*(x1-x2))+ ((y1-y2)*(y1-y2))+ ((z1-z2)*(z1-z2)) );
    end;
    
    
    function CosRule(len1,len2,len3 : Double) : Double;
    var
    temp1, radtemp : Double;
    // len1 = a, len2 = b, len3 = c
    begin
    If (len1 <= 0) OR (len2 <= 0) then  MessageBox(0, PChar('division by Zero'), PChar('NaN'), MB_OK);
    temp1 := ((len1*len1)+(len2*len2)-(len3*len3))/(2*len1*len2);
    if (temp1 < 1.0) AND (temp1 > -1.0) then begin
    //if (temp1 < 1.0) then begin
    radtemp := ArcCos(temp1);
    Result := RadToDeg(ArcCos(temp1));
    end else if (temp1 >= 1.0) then Result := 0
    else if (temp1 <= -1.0) then result := 180;
    
    //Result := ArcCos(temp1);
    end;
    
    function SinRule(lenb,angA,angB: Double) : Double;
    var
    temp1, radtemp : Double;
    begin
    // a / Sin(A) = b / Sin(B)
    // therefore a = (b * Sin(A))/ Sin(B)
            if (Sin(DegToRad(angB))) <= 0 then MessageBox(0, PChar('division by Zero in sin'), PChar('NaN'), MB_OK);
    Result := (lenb * Sin(DegToRad(angA)) ) / (Sin(DegToRad(angB)));
    end;
    
    end.
    "But men may construe things after their fashion,. Clean from the purpose of the things themselves" - Shakespeare
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Registered Member
    Tamatea's Avatar
    Join Date
    Aug 2010
    Posts
    1,317
    Thanks given
    401
    Thanks received
    357
    Rep Power
    2457
    thank you i think this is in the wrong section though.
    Spoiler for sig too large:


    Attached image
    Attached image
    Reply With Quote  
     

  4. #3  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    I think informative threads is a better location for this, thanks for the info though.
    Reply With Quote  
     

  5. #4  
    Registered Member
    Join Date
    Dec 2010
    Age
    29
    Posts
    1,186
    Thanks given
    513
    Thanks received
    340
    Rep Power
    35
    Thanks, I think this is more of an informative thread :L
    I like how you explained by using O-----O
    Reply With Quote  
     

  6. #5  
    Registered Member
    Join Date
    Nov 2009
    Posts
    3,052
    Thanks given
    112
    Thanks received
    838
    Rep Power
    740
    finally, i understand the animating sht. thx
    Reply With Quote  
     

  7. #6  
    Registered Member
    The Wanderer's Avatar
    Join Date
    Mar 2010
    Posts
    596
    Thanks given
    44
    Thanks received
    152
    Rep Power
    196
    I did not see the informative section. Guess I must be blind. A mod is free to move this anywhere.
    "But men may construe things after their fashion,. Clean from the purpose of the things themselves" - Shakespeare
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Runescape's new hit system
    By 'Mystic Flow in forum Snippets
    Replies: 23
    Last Post: 07-09-2011, 07:45 PM
  2. New Animation ID System
    By Palidino in forum Help
    Replies: 2
    Last Post: 02-18-2010, 12:51 AM
  3. [pic] new rendering system (beat this zee best)
    By Clienthax in forum Show-off
    Replies: 18
    Last Post: 01-11-2009, 12:24 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •