Editing Rich Appearance Format (RAF)

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 7: Line 7:
=RAF structure=
=RAF structure=
See: [[CXML Containers]] page
See: [[CXML Containers]] page
=RAF tools=
==Rich Apparence Maker==
http://r.a.m.games-hack.fr/index.php
guide http://r.a.m.games-hack.fr/doc/Rich%20Appearance%20Maker%20-%20Quick%20Start%20Guide.pdf
R.A.M on PS3 News: http://www.ps3news.com/ps3-hacks-jailbreak/video-ps3-rich-appearance-maker-r-a-m-beta-is-now-open/
R.A.M on PSX Scene: http://psx-scene.com/forums/content/rich-appearance-maker-r-m-free-beta-now-open-dynamic-theme-maker-2161/
==PS3 Color Logo Creator V2.511==
PCLC Source: http://tizzyt-archive.blogspot.co.uk/2012/04/playstation-color-logo-creator-v2511.html
PCLC on PS3 News: http://www.ps3news.com/ps3-hacks-jailbreak/ps3-color-logo-creator-v2-50-v2-51-updates-now-available/
PCLC V2.511 Download: http://www.mediafire.com/download/zbb3e07wdx22jub


=RAF contents=
=RAF contents=
It must comply with these max restrictions :
 
It must comply with these restrictions :
  -Textures size max: 15 mb ( 15728640 Bytes ) ( on [[RSX]] local memory at run time )
  -Textures size max: 15 mb ( 15728640 Bytes ) ( on [[RSX]] local memory at run time )
  -Geometry & script size max: 1 mb ( 1048576 Bytes ) ( on main memory at run time )
  -Geometry & script size max: 1 mb ( 1048576 Bytes ) ( on main memory at run time )  
  -Actor size max: 1.25mb ( 1310720 Bytes ) ( in the intermediate buffer )
  -Actor size max: 1.25mb ( 1310720 Bytes ) ( in the intermediate buffer )  
   
  -Actor number max: 128
  -Cameras: 1 (perspective or orthographic)
  -Cameras: 1
  -Lights: 2 (ambient and/or point)
  -Lights: 2 (ambient + point)
  -Scripts: 1
  -Scripts: 1
  -Models: 64 (with 8 animations each model)
  -Actors: 128
  -Models: 64 per actor ?
  -Animations: 8 per model
  -Materials: 1 per actor ?
  -Textures: 4 per material ?


==RAF Scene (.XML)==
==RAF Scene (.XML)==
A RAF animation consists in an "scene" (think in it like a theatre performance), viewed from a "camera" (think in it as the frame of your TV), is visible because there are "lights" (lights are mandatory otherway the scene will be completly in darkness), and is performed using an "script" file (think in it like the theatre director)


The most important element of a scene are the "actors" that are composed by a "model" (for an human the model is his body surface, or parts of his body) and a "material" (for an human the material of his body is flesh, or clothes for some of his body parts)
==Models and Lights (.DAE)==
Models can be geometric 3D objects, or 3D light points
*Typical objects and names used:
**bg.dae
**ambient_light.dae
**point_light.dae
 
Models files contains references to the libraries that were used by the 3D app that build the object
*Typical entries found in models (3d objects)
**<asset>
**<library_physics_scenes>
**<library_images>
**<library_materials>
**<library_effects>
**<library_geometries>
**<library_visual_scenes>
**<scene>


The "model" is associated with an "animation" (otherway it will not move) and the "material" is associated with a "texture" (for an human the texture is his skin, think in the textures as stickers you place over the model surface)
*Typical entries found in models (3d lights)
**<asset>
**<library_physics_scenes>
**<library_lights>
**<library_visual_scenes>
**<scene>


So an "actor" is composed by one or several "model" (associated with an "animation"), and a "material" (associated with a "texture")
==Textures ==
See [[Multimedia_Formats_and_Tools|Multimedia Formats and Tools page]]


The camera and lights are a bit special, there are different 2 ways to integrate them in the scene because are not visible (is imposible to see the camera because you are looking at the scene from inside of the camera) and lights are just light rays (the emitter is not visible, only the rays)... For this reason camera and lights can be completly defined in the scene.xml (so no need to create 3D object for them)... but they also admits to be defined as 3D objects (for this method is needed to create 3D objects for them, this allows for more complex lights animations or cinematic effects like camera travellings)
Before compiling, only .dds and jpeg are supported.


{{Boxcode|code=<syntaxhighlight lang="xml">
After compiling, '''G'''raphics '''T'''exture '''F'''ormat (GTF) (is a container for storing one or multiple textures, "pack GTF", data in a layout that can be used as is by [[RSX]]).
<?xml version='1.0' encoding="UTF-8"?>


<raf angle_unit="radian/degree">
==Script==
=== .JS ===
script.js (an PlayStation JavaScript, known as PSJS, based on ECMA-262)


<model id="model" file="model.dae" vertex_color="disable/enable" >
ECMA-262: several well-known implementations such as JavaScript, JScript and ActionScript.
<animation id="animation" file="animation.dae" start="1" end="100" sampling_rate="1" />
</model>


<material id="material" effect="pure_texture/pure_texture_alpha_0_depth_1/pure_texture_alpha_1_depth_0/pure_texture_alpha_0_depth_0/basic_lighting/basic_lighting_alpha_0/basic_lighting_edge_lit/basic_lighting_edge_lit_alpha_0/basic_lighting_alpha_add" >
Some examples of PS3 theme using PSJS:
<texture file="texture.jpg/texture.dds" type="color_map/normal_map/specular_map/tangent_normal_map" />
</material>


<actor id="actor" model="model" material="material" position="x,y,z" rotation="x,y,z" scale="x,y,z" color="r,g,b,a" uv_scale="u,v" uv_offset="u,v" anim_weight="anim0, anim1, anim2, anim3" anim_speed="anim0, anim1, anim2, anim3" anim_time="anim0, anim1, anim2, anim3" />
*http://www.studio-output.com/case_study/the-studio/


<camera id="camera" file="camera.dae" type="perspective/orthographic" yfov="1" ymag="1" znear="1" zfar="1" position="x,y,z" direction="x,y,z" up="x,y,z" />
=== .JSX ===
The script.js is later on compiled into an intermediate code (.jsx) with a magic header "VSMX".


<light id="light" file="light.dae" type="ambient/point" color="r,g,b" position="x,y,z" direction="x,y,z" attenuation="1,1,1" />
*http://endlessparadigm.com/forum/showthread.php?tid=21485: VSMX file format


<script file="script.js" />
Virtual Script Machine Instructions (VSMX) file layout (naming sould be wikifyed):
<pre>
VSMX header
Compiled code/instructions
Data/String constants
(method) name table/Object property
global symbols/Variable/function names
</pre>


</raf>
==== Header ====
</syntaxhighlight>}}
*Notes
**The maximum length of the string that can be specified to the id attribute of an element is 31 characters
**Time is in seconds
**A vector (in code) is composed by a group of datas, the number or the type of this datas can be different:
***For 3D space "x, y, z" are the values of the axis that defines a point, rotation, scale, a direction etc...
***For colors "r, g, b, a" are red, green, blue channels, and alpha for transparency
***For textures "u, v" represents displacement in the x and y axis when the texture is applyed over a 2D surface


{| class="wikitable"
{| class="wikitable" style="text-align: center;"
|+ <raf>
|-
! Attribute !! Description
| style="background-color:#56534D58; color:#000FFF;" |'''Offset'''
| style="background-color:#56534D58; color:#000FFF;" |'''Size'''
| style="background-color:#56534D58; color:#000FFF;" |'''Example (h)'''
| style="background-color:#56534D58; color:#000FFF;" |'''Value (conversion)'''
| style="background-color:#56534D58; color:#000FFF;" |'''Notes'''
|-
| 0x00 || 0x04 || 0x56534D58 || "VSMX" || Magic
|-
| 0x04 || 0x04 || 0x00000200 || 0002.0000 || Version?
*v1.0 on PSP RCO RCOs (from video/music UMDs and two lftv RCOs in the PSP's flash0/vsh/ressource/.)?
*V2.0 on PS3 PSJS (.jsx)
|-
| 0x08 || 0x04 || 0x34000000 || 0x34 (52) || header length
|-
| 0x0C || 0x04 || - ||  || length of compiled code/instructions section
|-
| 0x10 || 0x04 || - ||  || offset of data section
|-
| 0x14 || 0x04 || - ||  || length of data
|-
| 0x18 || 0x04 || - ||  || number of data(seen: 1 or 2)
|-
| 0x1C || 0x04 || - ||  || offset of name table
|-
| 0x20 || 0x04 || - ||  || length of name
|-
| 0x24 || 0x04 || - ||  || number of name
|-
| 0x28 || 0x04 || - ||  || offset of global symbols
|-
| 0x2C || 0x04 || - ||  || length of global symbols
|-
| 0x30 || 0x04 || - ||  || number of global symbols
|-
|-
| angle_unit  ||  Unit of angles in the scene file (radian/degree)
|}
|}


*Angles values conversions notes goes here ???
==== Compiled instructions ====


===Model===
*Instructions length: 8 bytes
{| class="wikitable"
 
|+ <model>
HEX code format should be wikifyed, may be table moved to (later).
! Attribute !! Description
 
{| class="wikitable sortable"
|-
! '''Hex Code (short)'''
! '''Instruction Name'''
! '''Note1'''
! '''Note2'''
|-
| 0x00 || NOP || - || -
|-
| 0x01 || ASSGN || - || -
|-
| 0x02 || ADD || - || -
|-
| 0x03 || SUB || - || -
|-
| 0x04 || MUL || - || -
|-
| 0x05 || DIV || - || -
|-
| 0x06 || MOD || - || -
|-
| 0x07 || TO_NUMBER || - || -
|-
| 0x08 || CSIGN || - || -
|-
| 0x09 || NOT || - || -
|-
| 0x0A || INC || - || -
|-
| 0x0B || DEC || - || -
|-
| 0x0C || POST_INC || - || -
|-
| 0x0D || POST_DEC || - || -
|-
| 0x0E || CMPEQ || - || -
|-
| 0x0F || CMPNEQ || - || -
|-
| 0x10 || CMPSEQ || - || -
|-
| 0x11 || CMPSNEQ || - || -
|-
| 0x12 || CMPLT || - || -
|-
| 0x13 || CMPLE || - || -
|-
| 0x14 || CMPGE || - || -
|-
| 0x15 || CMPGT || - || -
|-
| 0x16 || INSTANCEOF || - || -
|-
| 0x17 || IN || - || -
|-
| 0x18 || TYPEOF || - || -
|-
| 0x19 || BIT_AND || - || -
|-
| 0x1A || BIT_XOR || - || -
|-
| 0x1B || BIT_OR || - || -
|-
| 0x1C || BIT_NOT || - || -
|-
| 0x1D || LSHIFT || - || -
|-
|-
| id  || String accessed as the model attribute of the <actor> element
| 0x1E || S_RSHIFT || - || -
|-
|-
| file || Path to the model's .dae file exported by the DCC tool
| 0x1F || U_RSHIFT || - || -
|-
|-
| vertex_color || Usage (or lack) of color regarding each vertex
| 0x20 || COPY || - || -
*enable/disable
|-
|}
| 0x21 || SWAP || - || -
 
|-
====Animation====
| 0x22 || REMOVE || - || -
{| class="wikitable"
|-
|+ <animation>
| 0x23 || PUSH_UNDEFINED || - || -
! Attribute !! Description
|-
| 0x24 || PUSH_NULL || - || -
|-
| 0x25 || PUSH_BOOL || - || -
|-
| 0x26 || PUSH_INT || - || -
|-
| 0x27 || PUSH_INT || - || -
|-
| 0x28 || PUSH_STRING || - || -
|-
| 0x29 || PUSH_OBJECT || - || -
|-
| 0x2A || PUSH_FUNC || - || -
|-
|-
| id || String accessed by scripts
| 0x2B || PUSH_ARRAY || - || -
|-
|-
| file || Path to the animation's .dae file exported by the DCC tool
| 0x2C || PUSH_THIS || - || -
|-
|-
| start || Start time
| 0x2D || PUSH_LOCAL || - || -
|-
|-
| end || End time
| 0x2E || PUSH_GLOBAL || - || -
|-
|-
| sampling_rate || Sampling rate
| 0x2F || GETATTR || - || -
|}
 
===Material===
{| class="wikitable"
|+ <material>
! Attribute !! Description
|-
|-
| id  || String accessed as the material attribute of the <actor> element
| 0x30 || GETATTR_KEEPOBJ || - || -
|-
|-
| effect || String specifying the effect. Effects are selected from the preset values in the system software.
| 0x31 || SETATTR || - || -
* pure_texture : No lighting. Display the texture as is.
* pure_texture_alpha_0_depth_1 : Remove alpha from pure_texture
* pure_texture_alpha_1_depth_0 : Remove depth from pure_texture
* pure_texture_alpha_0_depth_0 : Remove alpha and depth from pure_texture
* basic_lighting : Basic lighting
* basic_lighting_alpha_0 : Remove alpha from basic_lighting
* basic_lighting_edge_lit : Throw light on object's edges in addition to basic_lighting
* basic_lighting_edge_lit_alpha_0 : Remove alpha from basic_lighting_edge_lit
* basic_lighting_alpha_add : Derive blending of basic_lighting by addition calculation
* sce01 : internal/reserved ? (used in coldboot.raf compiled with raf tools v1.00)
|}
 
====Texture====
{| class="wikitable"
|+ <texture>
! Attribute !! Description
|-
|-
| file || Path to the texture file
| 0x32 || DELATTR || - || -
|-
|-
| type || String specifying the texture map method. This is selected from the preset values in the system software:
| 0x33 || APPEND_ATTR || - || -
*color_map : Color (RGBA)
*normal_map : Normal in object space (RGB)
*specular_map : Specular strength (G)
*tangent_normal_map : Normal in tangent space, valid only for models with TEXTANGENT (RGB)
|}
 
===Actor===
{| class="wikitable"
|+ <actor>
! Attribute !! Description
|-
|-
| id || String accessed by scripts
| 0x34 || GETITEM || - || -
|-
|-
| model || String that accesses the id attribute of the <model> element
| 0x35 || GETITEM_KEEPOBJ || - || -
|-
|-
| material || String that accesses the id attribute of the <material> element
| 0x36 || SETITEM || - || -
|-
|-
| position || Vector to the initial position (x, y, z)
| 0x37 || DELITEM || - || -
|-
|-
| rotation || Vector to the initial rotation angle (x, y, z)
| 0x38 || APPEND_ITEM || - || -
|-
|-
| scale || Vector to the initial scale (x, y, z)
| 0x39 || JUMP || - || -
|-
|-
| color || Vector to the initial color (r, g, b, a)
| 0x3A || JUMPT || - || -
|-
|-
| uv_scale || Vector to the texture coordinates' initial scale (u, v)
| 0x3B || JUMPF || - || -
|-
|-
| uv_offset || Vector to the texture coordinates' initial offset (u, v)
| 0x3C || CALL_FUNC || - || -
|-
|-
| anim_weight || Vector to the animation's initial blend weights (anim0, anim1, anim2, anim3)
| 0x3D || CALL_METHOD || - || -
|-
|-
| anim_speed || Vector to the animation's initial speed (anim0, anim1, anim2, anim3)
| 0x3E || CALL_CONSTRUCTOR || - || -
|-
|-
| anim_time || Vector to the animation's initial time (anim0, anim1, anim2, anim3)
| 0x3F || RET || - || -
|-{{cellcolors|lightgrey}}
| zsort || String indicating the z sort type (unspecified/back to front/front to back) <!-- mandatory in raf format v1.02... not mandatory/inexistant in raf format v1.00 -->
|}
 
*'''zsort''' was not supported in raf tools v1 (the version used to build [[coldboot.raf]]), it was implemented in later versions of the raf tools, because this reason the "actors" in coldboot.raf doesnt uses zsort, see [[Coldboot.raf#Scene]]
 
===Camera===
{| class="wikitable"
|+ <camera>
! Attribute !! Description
|-
|-
| id || String accessed by scripts
| 0x40 || THROW || - || -
|-{{cellcolors|lightgrey}}
| file || Path to the camera's .dae file exported by the DCC tool (if .dae is used)
|-
|-
| type || String indicating the camera type (perspective/orthographic)
| 0x41 || TRYBLK_IN || - || -
|-
|-
| yfov || Scalar indicating the field-of-view in the vertical direction (perspective only)
| 0x42 || TRYBLK_OUT || - || -
|-
|-
| ymag || Scalar indicating the magnification in the vertical direction (orthographic only)
| 0x43 || CATCH_FINALLYBLK_IN || - || -
|-
|-
| znear || Scalar indicating the near clip plane
| 0x44 || CATCH_FINALLYBLK_OUT || - || -
|-
|-
| zfar || Scalar indicating the far clip plane
| 0x45 || HALT || - || -
|-
|-
| position || Vector to the initial position (x, y, z)
| 0x46 || DEBUG_FILE || - || -
|-
|-
| direction || Vector to the initial direction (x, y, z)
| 0x47 || DEBUG_LINE || - || -
|-
|-
| up || Vector to the initial up direction (x, y, z)
| 0x48 || GETITEM_KEEPOBJNAME || - || -
|}
 
===Light===
{| class="wikitable"
|+ <light>
! Attribute !! Description
|-
|-
| id || String accessed by scripts
| 0x49 || PUSH_VECTOR || - || -
|-{{cellcolors|lightgrey}}
| file || Path to the light's .dae file exported by the DCC tool (if .dae is used)
|-
|-
| type || String indicating the light type (ambient/point)
| 0x4A || GET_VECTOR_ELEMENT || - || -
|-
|-
| color || Vector to the initial color (r, g, b)
| 0x4B || GET_VECTOR_ELEMENT_KEEPVECTOR || - || -
|-
|-
| position || Vector to the initial position (x, y, z)
| 0x4C || ASSGN_VECTOR_ELEMENT || - || -
|-
|-
| direction || Vector to the initial direction (x, y, z)
| 0x4D || SETATTR_VECTOR_ELEMENT || - || -
|-
|-
| attenuation || Vector to the initial attenuation (zero-order, first-order, second-order)
| 0x4E || SETITEM_VECTOR_ELEMENT || - || -
|}
 
===Script===
{| class="wikitable"
|+ <script>
! Attribute !! Description
|-
|-
| file || Path to the script file
|}
|}
==Lights, Camera, Models, Animations (.DAE)==
Dae files are geometric 3D objects, generated by collada plugin from one of the collada supported 3D tools (blender, maya, 3dmax, etc...)
The raf scene.xml takes .dae files as inputs, this files are converted to .edge and .skel (both seems raw geometric vertex info) and .anim (probably containing raw geometric vertex info + time keyframes)
Dae files are xml based, and contains references to the libraries that were used by the 3D tool that build the object, this info is a collada standard and most of it is ignored when converted to .skel and .edge... in other words, most of the .dae info is lost when the .dae file is stored inside the .raf file (though is supposed to have some relationship with the graphic libraries availables in ps3 firmware)
*Typical entries found in models (3d objects)
**<asset>
**<library_physics_scenes>
**<library_images>
**<library_materials>
**<library_effects>
**<library_geometries>
**<library_visual_scenes>
**<scene>
*Typical entries found in models (3d lights)
**<asset>
**<library_physics_scenes>
**<library_lights>
**<library_visual_scenes>
**<scene>
==Textures (.JPG .DDS)==
See [[Multimedia_Formats_and_Tools|Multimedia Formats and Tools page]]
Before compiling, only .DDS and .JPG are supported.
After compiling, .DDS files are converted to .GTF. And .JPG files are stored as .JPG without conversion
GTF ('''G'''raphics '''T'''exture '''F'''ormat) is a container for storing one or multiple textures, the stored textures uses the same layout than if there was stored in PS3 RAM, this way is posible to make a direct copy of the textures to ram without any conversion to make them available for [[RSX]] as soon as possible
==Script (.JS)==
The raf scene.xml takes as input an script with file extension .js written in [[PlayStation_JavaScript|PlayStation JavaScript]] language
This script is converted into an intermediate .jsx file in [[VSMX|VSMX]] format, and then stored inside the .raf file.
*Some examples of PS3 theme using PSJS:
**http://www.studio-output.com/case_study/the-studio/
=RAF tools=
==Rich Apparence Maker==
http://r.a.m.games-hack.fr/index.php
guide http://r.a.m.games-hack.fr/doc/Rich%20Appearance%20Maker%20-%20Quick%20Start%20Guide.pdf
R.A.M on PS3 News: http://www.ps3news.com/ps3-hacks-jailbreak/video-ps3-rich-appearance-maker-r-a-m-beta-is-now-open/
R.A.M on PSX Scene: http://psx-scene.com/forums/content/rich-appearance-maker-r-m-free-beta-now-open-dynamic-theme-maker-2161/
==PS3 Color Logo Creator V2.511==
PCLC Source: http://tizzyt-archive.blogspot.co.uk/2012/04/playstation-color-logo-creator-v2511.html
PCLC on PS3 News: http://www.ps3news.com/ps3-hacks-jailbreak/ps3-color-logo-creator-v2-50-v2-51-updates-now-available/
PCLC V2.511 Download: http://www.mediafire.com/download/zbb3e07wdx22jub


=Links=
=Links=
*RAF pages in other wiki/s
*RAF pages in other wiki/s
**https://web.archive.org/web/20141027141848/http://dudu.clx.free.fr/wiki/index.php?title=PS3RAF
**http://dudu.clx.free.fr/wiki/index.php?title=PS3RAF
**http://ps3.duduclx.fr/index.php?title=Th%C3%A8mes_dynamiques_PS3
**http://ps3.duduclx.fr/index.php?title=Th%C3%A8mes_dynamiques_PS3
**https://web.archive.org/web/20141119010210/http://dudu.clx.free.fr/wiki/index.php?title=PS3Them
**http://dudu.clx.free.fr/wiki/index.php?title=PS3Them
*Interesting info about Animations/3D support in themes https://web.archive.org/web/20141119010206/http://www.ps3hax.net/showthread.php?t=28426
*Interesting info about Animations/3D support in themes http://www.ps3hax.net/showthread.php?t=28426
*See also: [[Qt Resource Container (QRC)]]
*See also: [[Qt Resource Container (QRC)]]


Please note that all contributions to PS3 Developer wiki are considered to be released under the GNU Free Documentation License 1.2 (see PS3 Developer wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To protect the wiki against automated edit spam, we kindly ask you to solve the following hCaptcha:

Cancel Editing help (opens in new window)