|
| 1 | +# Aange Renderer |
| 2 | + |
| 3 | +This project is responsible for rendering previews of the user profile and wearables used on the Decentraland Marketplace, Authentication screen, Profile page, and the builder. |
| 4 | + |
| 5 | +It builds as a Web target, uses WebGPU as it's rendering backend, and shares the Toon and Scene shaders with the Explorer client so we get the same visual representation as the users will see in the game |
| 6 | + |
| 7 | +## Usage |
| 8 | + |
| 9 | +Primarily the renderer will fetch it's configuration from URL parameters passed to it, but can also be configured dynamically after initial load via a SendMessage call. |
| 10 | + |
| 11 | +The renderer can run in three different modes, depending on it's usage: Marketplace, Authentication, Profile, Builder |
| 12 | + |
| 13 | +## Parameters |
| 14 | + |
| 15 | +* `mode`: Which mode we run as. Possible values: |
| 16 | + * `marketplace` (default) |
| 17 | + * `authentication` |
| 18 | + * `profile` |
| 19 | + * `builder` |
| 20 | +* `profile`: The id (wallet address) of the profile to use or one of the default profiles (`default1` - `default15`) |
| 21 | +* `emote`: The default emote that the avatar will play. Only used if no emote override is present. Possible values: |
| 22 | + * `idle` (default) |
| 23 | + * `clap` |
| 24 | + * `dab` |
| 25 | + * `dance` |
| 26 | + * `fashion` |
| 27 | + * `fashion-2` |
| 28 | + * `fashion-3` |
| 29 | + * `fashion-4` |
| 30 | + * `love` |
| 31 | + * `money` |
| 32 | + * `fist-pump` |
| 33 | + * `head-explode` |
| 34 | +* `urn`: An URN address of a wearable or emote to load. It will override any existing wearable in the same category already present on the profile that has been loaded. |
| 35 | +* `background`: The background color to use for the renderer. It must be in hex and not include the leading # (e.g. `ff00ff`). It may include alpha for a transparent background. Default is transparent. |
| 36 | +* `skinColor`: The color to use for the skin of the character. It must be in hex and not include the leading # (e.g. `ff00ff`). |
| 37 | +* `hairColor`: The color to use for the hair of the character. It must be in hex and not include the leading # (e.g. `ff00ff`). |
| 38 | +* `eyeColor`: The color to use for the eyes of the character. It must be in hex and not include the leading # (e.g. `ff00ff`). |
| 39 | +* `bodyShape`: The body shape to use. Possible values: |
| 40 | + * `urn:decentraland:off-chain:base-avatars:BaseMale` |
| 41 | + * `urn:decentraland:off-chain:base-avatars:BaseFemale` |
| 42 | +* `upperBody`: The URN address of the upper body wearable to load. |
| 43 | +* `lowerBody`: The URN address of the lower body wearable to load. |
| 44 | +* `hair`: The URN address of the hair wearable to load. |
| 45 | +* `facialHair`: The URN address of the facial hair wearable to load. |
| 46 | +* `projection`: The projection to use for the camera. Possible values: |
| 47 | + * `perspective` (default) |
| 48 | + * `orthographic` |
| 49 | +* `base64`: A base64 encoded definition of a wearable or emote to load. |
| 50 | +* `contract`: The contract address of a wearable or emote to load. |
| 51 | +* `item`: The item id of a wearable or emote to load. |
| 52 | +* `token`: The token id of a wearable or emote to load. |
| 53 | +* `env`: The environment to use for API calls. Possible values: |
| 54 | + * `prod` (default) - uses ORG |
| 55 | + * `dev` - uses ZONE |
| 56 | + |
| 57 | + |
| 58 | +## Modes |
| 59 | + |
| 60 | +Depending on the mode, not all parameters are used. These are the valid parameters in each mode: |
| 61 | + |
| 62 | +### Marketplate |
| 63 | +* `background` |
| 64 | +* `profile` |
| 65 | +* `urn` or `contract` & `item` or `contract` & `token` |
| 66 | +* `emote` |
| 67 | + |
| 68 | +### Profile |
| 69 | +* `background` |
| 70 | +* `profile` |
| 71 | +* `emote` |
| 72 | + |
| 73 | +### Authentication |
| 74 | +* `background` |
| 75 | +* `profile` |
| 76 | +* `emote` |
| 77 | + |
| 78 | +### Builder |
| 79 | +* `background` |
| 80 | +* `bodyShape` |
| 81 | +* `eyeColor` |
| 82 | +* `hairColor` |
| 83 | +* `skinColor` |
| 84 | +* `hair` |
| 85 | +* `facialHair` |
| 86 | +* `upperBody` |
| 87 | +* `lowerBody` |
| 88 | +* `emote` |
| 89 | +* `base64` |
| 90 | + |
| 91 | +## Dynamic configuration |
| 92 | + |
| 93 | +Most properties can be set dynamically after the renderer is already running by calling `SendMessage('JSBridge', 'MethodName', 'value'` on the `unityInstance` object returned after initialization. |
| 94 | + |
| 95 | +Example usage: |
| 96 | + |
| 97 | +```javascript |
| 98 | +unityInstance.SendMessage('JSBridge', 'SetEmote', 'clap'); |
| 99 | +unityInstance.SendMessage('JSBridge', 'SetSkinColor', 'ff0000'); |
| 100 | +``` |
| 101 | + |
| 102 | +Every call of this function will trigger a reload of the entire avatar. |
| 103 | +For a full list of available functions check [JSBridge](Assets/Scripts/JSBridge.cs). |
0 commit comments