├── .gitignore ├── LICENSE ├── Makefile ├── README.md ├── genoview.c └── resources ├── Geno.bin ├── Geno.fbx ├── Geno.mb ├── Geno_bind.bvh ├── Geno_bind.fbx ├── Geno_stance.bvh ├── Geno_stance.fbx ├── basic.fs ├── basic.vs ├── blur.fs ├── bvh.py ├── export_animations.py ├── export_geno.py ├── fxaa.fs ├── lighting.fs ├── post.vs ├── quat.py ├── shadow.fs ├── shadow.vs ├── skinnedBasic.vs ├── skinnedShadow.vs └── ssao.fs /.gitignore: -------------------------------------------------------------------------------- 1 | genoview.exe 2 | *__pycache__* 3 | resources/GenoAnimated.mb -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Daniel Holden 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PLATFORM ?= PLATFORM_DESKTOP 2 | BUILD_MODE ?= DEBUG 3 | DEFINES = -D _DEFAULT_SOURCE -D RAYLIB_BUILD_MODE=$(BUILD_MODE) -D $(PLATFORM) 4 | PLATFORM_OS ?= $(shell uname) 5 | 6 | ifeq ($(PLATFORM),PLATFORM_DESKTOP) 7 | 8 | CC = gcc 9 | 10 | ifeq ($(findstring MINGW,$(PLATFORM_OS)),MINGW) 11 | EXT = .exe 12 | RAYLIB_DIR = C:/raylib 13 | INCLUDE_DIR = -I ./ -I $(RAYLIB_DIR)/raylib/src -I $(RAYLIB_DIR)/raygui/src 14 | LIBRARY_DIR = -L $(RAYLIB_DIR)/raylib/src 15 | ifeq ($(BUILD_MODE),RELEASE) 16 | CFLAGS ?= $(DEFINES) -Wall -mwindows -D NDEBUG -O3 $(INCLUDE_DIR) $(LIBRARY_DIR) 17 | else 18 | CFLAGS ?= $(DEFINES) -Wall -g $(INCLUDE_DIR) $(LIBRARY_DIR) 19 | endif 20 | LIBS = -lraylib -lopengl32 -lgdi32 -lwinmm 21 | endif 22 | 23 | ifeq ($(findstring Linux,$(PLATFORM_OS)),Linux) 24 | EXT= 25 | RAYLIB_DIR = ~/raylib 26 | INCLUDE_DIR = -I ./ -I $(RAYLIB_DIR)/raylib/src -I $(RAYLIB_DIR)/raygui/src 27 | LIBRARY_DIR = -L $(RAYLIB_DIR)/raylib/src 28 | ifeq ($(BUILD_MODE),RELEASE) 29 | CFLAGS ?= $(DEFINES) -Wall -Wno-format-truncation -D NDEBUG -O3 $(INCLUDE_DIR) $(LIBRARY_DIR) 30 | else 31 | CFLAGS ?= $(DEFINES) -Wall -Wno-format-truncation -g $(INCLUDE_DIR) $(LIBRARY_DIR) 32 | endif 33 | LIBS = -lraylib -lGL -lm -ldl -lpthread 34 | endif 35 | endif 36 | 37 | .PHONY: all 38 | 39 | all: genoview 40 | 41 | genoview: genoview.c 42 | $(CC) -o $@$(EXT) genoview.c $(CFLAGS) $(LIBS) 43 | 44 | clean: 45 | rm genoview$(EXT) 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | https://github.com/user-attachments/assets/70311b6e-9f32-4b9e-8007-4b362102b770 6 | 7 | # GenoView 8 | 9 | GenoView is a really basic example raylib application that can be used to view skeletal animation data in a way that is clear and highlights any artefacts. It uses a simple Deferred Renderer that supports shadow maps and Screen Space Ambient Occlusion, as well as a procedural grid shader as a texture. This makes common artefacts such as foot sliding and penetrations easy to see on a skinned character even on low-end devices, without the complexity of a full rendering engine. 10 | 11 | Included are some simple scripts for exporting characters and animation data into a binary format that can be easily loaded by the application. These scripts are made for the Geno character from the following datasets: 12 | 13 | * [LaFAN resolved](https://github.com/orangeduck/lafan1-resolved) 14 | * [ZeroEGGS retargeted](https://github.com/orangeduck/zeroeggs-retarget) 15 | * [Motorica retargeted](https://github.com/orangeduck/motorica-retarget) 16 | * [100STYLE retargeted](https://github.com/orangeduck/100style-retarget) 17 | 18 | However they can likely be adapted to new characters, or the normal raylib-supported file formats can be loaded too. 19 | 20 | # Getting Started 21 | 22 | Here are the steps to viewing any of the animation data linked above in this viewer. 23 | 24 | 1. Download the BVH files for the animation dataset you want to view. 25 | 2. Place any bvh files you want to view in the `resources` folder. 26 | 3. Edit the `bvh_files` variable in the `resources/export_animations.py` script to contain the bvh files you want to view - then run the `export_animations.py` script. 27 | 4. Edit the line in `genoview.c` where `testAnimation` is loaded to load the animation you want to view instead. 28 | -------------------------------------------------------------------------------- /genoview.c: -------------------------------------------------------------------------------- 1 | #include "raylib.h" 2 | #include "raymath.h" 3 | #define RAYGUI_IMPLEMENTATION 4 | #include "raygui.h" 5 | #include "rlgl.h" 6 | 7 | #include 8 | 9 | //---------------------------------------------------------------------------------- 10 | // Camera 11 | //---------------------------------------------------------------------------------- 12 | 13 | // Basic Orbit Camera with simple controls 14 | typedef struct { 15 | 16 | Camera3D cam3d; 17 | float azimuth; 18 | float altitude; 19 | float distance; 20 | Vector3 offset; 21 | 22 | } OrbitCamera; 23 | 24 | static inline void OrbitCameraInit(OrbitCamera* camera) 25 | { 26 | memset(&camera->cam3d, 0, sizeof(Camera3D)); 27 | camera->cam3d.position = (Vector3){ 2.0f, 3.0f, 5.0f }; 28 | camera->cam3d.target = (Vector3){ -0.5f, 1.0f, 0.0f }; 29 | camera->cam3d.up = (Vector3){ 0.0f, 1.0f, 0.0f }; 30 | camera->cam3d.fovy = 45.0f; 31 | camera->cam3d.projection = CAMERA_PERSPECTIVE; 32 | 33 | camera->azimuth = 0.0f; 34 | camera->altitude = 0.4f; 35 | camera->distance = 4.0f; 36 | camera->offset = Vector3Zero(); 37 | } 38 | 39 | static inline void OrbitCameraUpdate( 40 | OrbitCamera* camera, 41 | Vector3 target, 42 | float azimuthDelta, 43 | float altitudeDelta, 44 | float offsetDeltaX, 45 | float offsetDeltaY, 46 | float mouseWheel, 47 | float dt) 48 | { 49 | camera->azimuth = camera->azimuth + 1.0f * dt * -azimuthDelta; 50 | camera->altitude = Clamp(camera->altitude + 1.0f * dt * altitudeDelta, 0.0, 0.4f * PI); 51 | camera->distance = Clamp(camera->distance + 20.0f * dt * -mouseWheel, 0.1f, 100.0f); 52 | 53 | Quaternion rotationAzimuth = QuaternionFromAxisAngle((Vector3){0, 1, 0}, camera->azimuth); 54 | Vector3 position = Vector3RotateByQuaternion((Vector3){0, 0, camera->distance}, rotationAzimuth); 55 | Vector3 axis = Vector3Normalize(Vector3CrossProduct(position, (Vector3){0, 1, 0})); 56 | 57 | Quaternion rotationAltitude = QuaternionFromAxisAngle(axis, camera->altitude); 58 | 59 | Vector3 localOffset = (Vector3){ dt * offsetDeltaX, dt * -offsetDeltaY, 0.0f }; 60 | localOffset = Vector3RotateByQuaternion(localOffset, rotationAzimuth); 61 | 62 | camera->offset = Vector3Add(camera->offset, Vector3RotateByQuaternion(localOffset, rotationAltitude)); 63 | 64 | Vector3 cameraTarget = Vector3Add(camera->offset, target); 65 | Vector3 eye = Vector3Add(cameraTarget, Vector3RotateByQuaternion(position, rotationAltitude)); 66 | 67 | camera->cam3d.target = cameraTarget; 68 | camera->cam3d.position = eye; 69 | } 70 | 71 | //---------------------------------------------------------------------------------- 72 | // Shadow Maps 73 | //---------------------------------------------------------------------------------- 74 | 75 | typedef struct 76 | { 77 | Vector3 target; 78 | Vector3 position; 79 | Vector3 up; 80 | double width; 81 | double height; 82 | double near; 83 | double far; 84 | 85 | } ShadowLight; 86 | 87 | RenderTexture2D LoadShadowMap(int width, int height) 88 | { 89 | RenderTexture2D target = { 0 }; 90 | target.id = rlLoadFramebuffer(); 91 | target.texture.width = width; 92 | target.texture.height = height; 93 | assert(target.id); 94 | 95 | rlEnableFramebuffer(target.id); 96 | 97 | target.depth.id = rlLoadTextureDepth(width, height, false); 98 | target.depth.width = width; 99 | target.depth.height = height; 100 | target.depth.format = 19; //DEPTH_COMPONENT_24BIT? 101 | target.depth.mipmaps = 1; 102 | rlFramebufferAttach(target.id, target.depth.id, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_TEXTURE2D, 0); 103 | assert(rlFramebufferComplete(target.id)); 104 | 105 | rlDisableFramebuffer(); 106 | 107 | return target; 108 | } 109 | 110 | void UnloadShadowMap(RenderTexture2D target) 111 | { 112 | if (target.id > 0) 113 | { 114 | rlUnloadFramebuffer(target.id); 115 | } 116 | } 117 | 118 | void BeginShadowMap(RenderTexture2D target, ShadowLight shadowLight) 119 | { 120 | BeginTextureMode(target); 121 | ClearBackground(WHITE); 122 | 123 | rlDrawRenderBatchActive(); // Update and draw internal render batch 124 | 125 | rlMatrixMode(RL_PROJECTION); // Switch to projection matrix 126 | rlPushMatrix(); // Save previous matrix, which contains the settings for the 2d ortho projection 127 | rlLoadIdentity(); // Reset current matrix (projection) 128 | 129 | rlOrtho( 130 | -shadowLight.width/2, shadowLight.width/2, 131 | -shadowLight.height/2, shadowLight.height/2, 132 | shadowLight.near, shadowLight.far); 133 | 134 | rlMatrixMode(RL_MODELVIEW); // Switch back to modelview matrix 135 | rlLoadIdentity(); // Reset current matrix (modelview) 136 | 137 | // Setup Camera view 138 | Matrix matView = MatrixLookAt(shadowLight.position, shadowLight.target, shadowLight.up); 139 | rlMultMatrixf(MatrixToFloat(matView)); // Multiply modelview matrix by view matrix (camera) 140 | 141 | rlEnableDepthTest(); // Enable DEPTH_TEST for 3D 142 | } 143 | 144 | void EndShadowMap() 145 | { 146 | rlDrawRenderBatchActive(); // Update and draw internal render batch 147 | 148 | rlMatrixMode(RL_PROJECTION); // Switch to projection matrix 149 | rlPopMatrix(); // Restore previous matrix (projection) from matrix stack 150 | 151 | rlMatrixMode(RL_MODELVIEW); // Switch back to modelview matrix 152 | rlLoadIdentity(); // Reset current matrix (modelview) 153 | 154 | rlDisableDepthTest(); // Disable DEPTH_TEST for 2D 155 | 156 | EndTextureMode(); 157 | } 158 | 159 | void SetShaderValueShadowMap(Shader shader, int locIndex, RenderTexture2D target) 160 | { 161 | if (locIndex > -1) 162 | { 163 | rlEnableShader(shader.id); 164 | int slot = 10; // Can be anything 0 to 15, but 0 will probably be taken up 165 | rlActiveTextureSlot(slot); 166 | rlEnableTexture(target.depth.id); 167 | rlSetUniform(locIndex, &slot, SHADER_UNIFORM_INT, 1); 168 | } 169 | } 170 | 171 | //---------------------------------------------------------------------------------- 172 | // GBuffer 173 | //---------------------------------------------------------------------------------- 174 | 175 | typedef struct 176 | { 177 | unsigned int id; // OpenGL framebuffer object id 178 | Texture color; // Color buffer attachment texture 179 | Texture normal; // Normal buffer attachment texture 180 | Texture depth; // Depth buffer attachment texture 181 | 182 | } GBuffer; 183 | 184 | GBuffer LoadGBuffer(int width, int height) 185 | { 186 | GBuffer target = { 0 }; 187 | target.id = rlLoadFramebuffer(); 188 | assert(target.id); 189 | 190 | rlEnableFramebuffer(target.id); 191 | 192 | target.color.id = rlLoadTexture(NULL, width, height, PIXELFORMAT_UNCOMPRESSED_R8G8B8A8, 1); 193 | target.color.width = width; 194 | target.color.height = height; 195 | target.color.format = PIXELFORMAT_UNCOMPRESSED_R8G8B8A8; 196 | target.color.mipmaps = 1; 197 | rlFramebufferAttach(target.id, target.color.id, RL_ATTACHMENT_COLOR_CHANNEL0, RL_ATTACHMENT_TEXTURE2D, 0); 198 | 199 | target.normal.id = rlLoadTexture(NULL, width, height, PIXELFORMAT_UNCOMPRESSED_R16G16B16A16, 1); 200 | target.normal.width = width; 201 | target.normal.height = height; 202 | target.normal.format = PIXELFORMAT_UNCOMPRESSED_R16G16B16A16; 203 | target.normal.mipmaps = 1; 204 | rlFramebufferAttach(target.id, target.normal.id, RL_ATTACHMENT_COLOR_CHANNEL1, RL_ATTACHMENT_TEXTURE2D, 0); 205 | 206 | target.depth.id = rlLoadTextureDepth(width, height, false); 207 | target.depth.width = width; 208 | target.depth.height = height; 209 | target.depth.format = 19; //DEPTH_COMPONENT_24BIT? 210 | target.depth.mipmaps = 1; 211 | rlFramebufferAttach(target.id, target.depth.id, RL_ATTACHMENT_DEPTH, RL_ATTACHMENT_TEXTURE2D, 0); 212 | 213 | assert(rlFramebufferComplete(target.id)); 214 | 215 | rlDisableFramebuffer(); 216 | 217 | return target; 218 | } 219 | 220 | void UnloadGBuffer(GBuffer target) 221 | { 222 | if (target.id > 0) 223 | { 224 | rlUnloadFramebuffer(target.id); 225 | } 226 | } 227 | 228 | void BeginGBuffer(GBuffer target, Camera3D camera) 229 | { 230 | rlDrawRenderBatchActive(); // Update and draw internal render batch 231 | 232 | rlEnableFramebuffer(target.id); // Enable render target 233 | rlActiveDrawBuffers(2); 234 | 235 | // Set viewport and RLGL internal framebuffer size 236 | rlViewport(0, 0, target.color.width, target.color.height); 237 | rlSetFramebufferWidth(target.color.width); 238 | rlSetFramebufferHeight(target.color.height); 239 | 240 | ClearBackground(BLACK); 241 | 242 | rlMatrixMode(RL_PROJECTION); // Switch to projection matrix 243 | rlPushMatrix(); // Save previous matrix, which contains the settings for the 2d ortho projection 244 | rlLoadIdentity(); // Reset current matrix (projection) 245 | 246 | float aspect = (float)target.color.width/(float)target.color.height; 247 | 248 | // NOTE: zNear and zFar values are important when computing depth buffer values 249 | if (camera.projection == CAMERA_PERSPECTIVE) 250 | { 251 | // Setup perspective projection 252 | double top = rlGetCullDistanceNear()*tan(camera.fovy*0.5*DEG2RAD); 253 | double right = top*aspect; 254 | 255 | rlFrustum(-right, right, -top, top, rlGetCullDistanceNear(), rlGetCullDistanceFar()); 256 | } 257 | else if (camera.projection == CAMERA_ORTHOGRAPHIC) 258 | { 259 | // Setup orthographic projection 260 | double top = camera.fovy/2.0; 261 | double right = top*aspect; 262 | 263 | rlOrtho(-right, right, -top,top, rlGetCullDistanceNear(), rlGetCullDistanceFar()); 264 | } 265 | 266 | rlMatrixMode(RL_MODELVIEW); // Switch back to modelview matrix 267 | rlLoadIdentity(); // Reset current matrix (modelview) 268 | 269 | // Setup Camera view 270 | Matrix matView = MatrixLookAt(camera.position, camera.target, camera.up); 271 | rlMultMatrixf(MatrixToFloat(matView)); // Multiply modelview matrix by view matrix (camera) 272 | 273 | rlEnableDepthTest(); // Enable DEPTH_TEST for 3D 274 | } 275 | 276 | void EndGBuffer(int windowWidth, int windowHeight) 277 | { 278 | rlDrawRenderBatchActive(); // Update and draw internal render batch 279 | 280 | rlDisableDepthTest(); // Disable DEPTH_TEST for 2D 281 | rlActiveDrawBuffers(1); 282 | rlDisableFramebuffer(); // Disable render target (fbo) 283 | 284 | rlMatrixMode(RL_PROJECTION); // Switch to projection matrix 285 | rlPopMatrix(); // Restore previous matrix (projection) from matrix stack 286 | rlLoadIdentity(); // Reset current matrix (projection) 287 | rlOrtho(0, windowWidth, windowHeight, 0, 0.0f, 1.0f); 288 | 289 | rlMatrixMode(RL_MODELVIEW); // Switch back to modelview matrix 290 | rlLoadIdentity(); // Reset current matrix (modelview) 291 | } 292 | 293 | //---------------------------------------------------------------------------------- 294 | // Geno Character and Animation 295 | //---------------------------------------------------------------------------------- 296 | 297 | Model LoadGenoModel(const char* fileName) 298 | { 299 | Model model = { 0 }; 300 | model.transform = MatrixIdentity(); 301 | 302 | FILE* f = fopen(fileName, "rb"); 303 | if (f == NULL) 304 | { 305 | TRACELOG(LOG_ERROR, "MODEL Unable to read skinned model file %s", fileName); 306 | return model; 307 | } 308 | 309 | model.materialCount = 1; 310 | model.materials = RL_CALLOC(model.materialCount, sizeof(Mesh)); 311 | model.materials[0] = LoadMaterialDefault(); 312 | 313 | model.meshCount = 1; 314 | model.meshes = RL_CALLOC(model.meshCount, sizeof(Mesh)); 315 | model.meshMaterial = RL_CALLOC(model.meshCount, sizeof(Mesh)); 316 | model.meshMaterial[0] = 0; 317 | 318 | fread(&model.meshes[0].vertexCount, sizeof(int), 1, f); 319 | fread(&model.meshes[0].triangleCount, sizeof(int), 1, f); 320 | fread(&model.boneCount, sizeof(int), 1, f); 321 | 322 | model.meshes[0].boneCount = model.boneCount; 323 | model.meshes[0].vertices = RL_CALLOC(model.meshes[0].vertexCount * 3, sizeof(float)); 324 | model.meshes[0].texcoords = RL_CALLOC(model.meshes[0].vertexCount * 2, sizeof(float)); 325 | model.meshes[0].normals = RL_CALLOC(model.meshes[0].vertexCount * 3, sizeof(float)); 326 | model.meshes[0].boneIds = RL_CALLOC(model.meshes[0].vertexCount * 4, sizeof(unsigned char)); 327 | model.meshes[0].boneWeights = RL_CALLOC(model.meshes[0].vertexCount * 4, sizeof(float)); 328 | model.meshes[0].indices = RL_CALLOC(model.meshes[0].triangleCount * 3, sizeof(unsigned short)); 329 | model.meshes[0].animVertices = RL_CALLOC(model.meshes[0].vertexCount * 3, sizeof(float)); 330 | model.meshes[0].animNormals = RL_CALLOC(model.meshes[0].vertexCount * 3, sizeof(float)); 331 | model.bones = RL_CALLOC(model.boneCount, sizeof(BoneInfo)); 332 | model.bindPose = RL_CALLOC(model.boneCount, sizeof(Transform)); 333 | 334 | fread(model.meshes[0].vertices, sizeof(float), model.meshes[0].vertexCount * 3, f); 335 | fread(model.meshes[0].texcoords, sizeof(float), model.meshes[0].vertexCount * 2, f); 336 | fread(model.meshes[0].normals, sizeof(float), model.meshes[0].vertexCount * 3, f); 337 | fread(model.meshes[0].boneIds, sizeof(unsigned char), model.meshes[0].vertexCount * 4, f); 338 | fread(model.meshes[0].boneWeights, sizeof(float), model.meshes[0].vertexCount * 4, f); 339 | fread(model.meshes[0].indices, sizeof(unsigned short), model.meshes[0].triangleCount * 3, f); 340 | memcpy(model.meshes[0].animVertices, model.meshes[0].vertices, sizeof(float) * model.meshes[0].vertexCount * 3); 341 | memcpy(model.meshes[0].animNormals, model.meshes[0].normals, sizeof(float) * model.meshes[0].vertexCount * 3); 342 | fread(model.bones, sizeof(BoneInfo), model.boneCount, f); 343 | fread(model.bindPose, sizeof(Transform), model.boneCount, f); 344 | fclose(f); 345 | 346 | model.meshes[0].boneMatrices = RL_CALLOC(model.boneCount, sizeof(Matrix)); 347 | for (int i = 0; i < model.boneCount; i++) 348 | { 349 | model.meshes[0].boneMatrices[i] = MatrixIdentity(); 350 | } 351 | 352 | UploadMesh(&model.meshes[0], true); 353 | 354 | return model; 355 | } 356 | 357 | ModelAnimation LoadGenoModelAnimation(const char* fileName) 358 | { 359 | ModelAnimation animation = { 0 }; 360 | 361 | FILE* f = fopen(fileName, "rb"); 362 | if (f == NULL) 363 | { 364 | TRACELOG(LOG_ERROR, "MODEL ANIMATION Unable to read animation file %s", fileName); 365 | return animation; 366 | } 367 | 368 | fread(&animation.frameCount, sizeof(int), 1, f); 369 | fread(&animation.boneCount, sizeof(int), 1, f); 370 | 371 | animation.bones = RL_CALLOC(animation.boneCount, sizeof(BoneInfo)); 372 | fread(animation.bones, sizeof(BoneInfo), animation.boneCount, f); 373 | 374 | animation.framePoses = RL_CALLOC(animation.frameCount, sizeof(Transform*)); 375 | for (int i = 0; i < animation.frameCount; i++) 376 | { 377 | animation.framePoses[i] = RL_CALLOC(animation.boneCount, sizeof(Transform)); 378 | fread(animation.framePoses[i], sizeof(Transform), animation.boneCount, f); 379 | } 380 | 381 | fclose(f); 382 | 383 | return animation; 384 | } 385 | 386 | ModelAnimation LoadEmptyModelAnimation(Model model) 387 | { 388 | ModelAnimation animation = { 0 }; 389 | animation.frameCount = 1; 390 | animation.boneCount = model.boneCount; 391 | 392 | animation.bones = RL_CALLOC(animation.boneCount, sizeof(BoneInfo)); 393 | memcpy(animation.bones, model.bones, animation.boneCount * sizeof(BoneInfo)); 394 | 395 | animation.framePoses = RL_CALLOC(animation.frameCount, sizeof(Transform*)); 396 | for (int i = 0; i < animation.frameCount; i++) 397 | { 398 | animation.framePoses[i] = RL_CALLOC(animation.boneCount, sizeof(Transform)); 399 | memcpy(animation.framePoses[i], model.bindPose, animation.boneCount * sizeof(Transform)); 400 | } 401 | 402 | return animation; 403 | } 404 | 405 | //---------------------------------------------------------------------------------- 406 | // Debug Draw 407 | //---------------------------------------------------------------------------------- 408 | 409 | static inline void DrawTransform(Transform t, float scale) 410 | { 411 | Matrix rotMatrix = QuaternionToMatrix(t.rotation); 412 | 413 | DrawLine3D( 414 | t.translation, 415 | Vector3Add(t.translation, (Vector3){ scale * rotMatrix.m0, scale * rotMatrix.m1, scale * rotMatrix.m2 }), 416 | RED); 417 | 418 | DrawLine3D( 419 | t.translation, 420 | Vector3Add(t.translation, (Vector3){ scale * rotMatrix.m4, scale * rotMatrix.m5, scale * rotMatrix.m6 }), 421 | GREEN); 422 | 423 | DrawLine3D( 424 | t.translation, 425 | Vector3Add(t.translation, (Vector3){ scale * rotMatrix.m8, scale * rotMatrix.m9, scale * rotMatrix.m10 }), 426 | BLUE); 427 | } 428 | 429 | static inline void DrawModelBindPose(Model model, Color color) 430 | { 431 | for (int i = 0; i < model.boneCount; i++) 432 | { 433 | DrawSphereWires( 434 | model.bindPose[i].translation, 435 | 0.01f, 436 | 4, 437 | 6, 438 | color); 439 | 440 | DrawTransform(model.bindPose[i], 0.1f); 441 | 442 | if (model.bones[i].parent != -1) 443 | { 444 | DrawLine3D( 445 | model.bindPose[i].translation, 446 | model.bindPose[model.bones[i].parent].translation, 447 | color); 448 | } 449 | } 450 | } 451 | 452 | static inline void DrawModelAnimationFrameSkeleton(ModelAnimation animation, int frame, Color color) 453 | { 454 | for (int i = 0; i < animation.boneCount; i++) 455 | { 456 | DrawSphereWires( 457 | animation.framePoses[frame][i].translation, 458 | 0.01f, 459 | 4, 460 | 6, 461 | color); 462 | 463 | DrawTransform(animation.framePoses[frame][i], 0.1f); 464 | 465 | if (animation.bones[i].parent != -1) 466 | { 467 | DrawLine3D( 468 | animation.framePoses[frame][i].translation, 469 | animation.framePoses[frame][animation.bones[i].parent].translation, 470 | color); 471 | } 472 | } 473 | } 474 | 475 | //---------------------------------------------------------------------------------- 476 | // App 477 | //---------------------------------------------------------------------------------- 478 | 479 | int main(int argc, char **argv) 480 | { 481 | // Init Window 482 | 483 | const int screenWidth = 1280; 484 | const int screenHeight = 720; 485 | 486 | SetConfigFlags(FLAG_VSYNC_HINT); 487 | InitWindow(screenWidth, screenHeight, "GenoView"); 488 | SetTargetFPS(60); 489 | 490 | // Shaders 491 | 492 | Shader shadowShader = LoadShader("./resources/shadow.vs", "./resources/shadow.fs"); 493 | int shadowShaderLightClipNear = GetShaderLocation(shadowShader, "lightClipNear"); 494 | int shadowShaderLightClipFar = GetShaderLocation(shadowShader, "lightClipFar"); 495 | 496 | Shader skinnedShadowShader = LoadShader("./resources/skinnedShadow.vs", "./resources/shadow.fs"); 497 | int skinnedShadowShaderLightClipNear = GetShaderLocation(skinnedShadowShader, "lightClipNear"); 498 | int skinnedShadowShaderLightClipFar = GetShaderLocation(skinnedShadowShader, "lightClipFar"); 499 | 500 | Shader skinnedBasicShader = LoadShader("./resources/skinnedBasic.vs", "./resources/basic.fs"); 501 | int skinnedBasicShaderSpecularity = GetShaderLocation(skinnedBasicShader, "specularity"); 502 | int skinnedBasicShaderGlossiness = GetShaderLocation(skinnedBasicShader, "glossiness"); 503 | int skinnedBasicShaderCamClipNear = GetShaderLocation(skinnedBasicShader, "camClipNear"); 504 | int skinnedBasicShaderCamClipFar = GetShaderLocation(skinnedBasicShader, "camClipFar"); 505 | 506 | Shader basicShader = LoadShader("./resources/basic.vs", "./resources/basic.fs"); 507 | int basicShaderSpecularity = GetShaderLocation(basicShader, "specularity"); 508 | int basicShaderGlossiness = GetShaderLocation(basicShader, "glossiness"); 509 | int basicShaderCamClipNear = GetShaderLocation(basicShader, "camClipNear"); 510 | int basicShaderCamClipFar = GetShaderLocation(basicShader, "camClipFar"); 511 | 512 | Shader lightingShader = LoadShader("./resources/post.vs", "./resources/lighting.fs"); 513 | int lightingShaderGBufferColor = GetShaderLocation(lightingShader, "gbufferColor"); 514 | int lightingShaderGBufferNormal = GetShaderLocation(lightingShader, "gbufferNormal"); 515 | int lightingShaderGBufferDepth = GetShaderLocation(lightingShader, "gbufferDepth"); 516 | int lightingShaderSSAO = GetShaderLocation(lightingShader, "ssao"); 517 | int lightingShaderCamPos = GetShaderLocation(lightingShader, "camPos"); 518 | int lightingShaderCamInvViewProj = GetShaderLocation(lightingShader, "camInvViewProj"); 519 | int lightingShaderLightDir = GetShaderLocation(lightingShader, "lightDir"); 520 | int lightingShaderSunColor = GetShaderLocation(lightingShader, "sunColor"); 521 | int lightingShaderSunStrength = GetShaderLocation(lightingShader, "sunStrength"); 522 | int lightingShaderSkyColor = GetShaderLocation(lightingShader, "skyColor"); 523 | int lightingShaderSkyStrength = GetShaderLocation(lightingShader, "skyStrength"); 524 | int lightingShaderGroundStrength = GetShaderLocation(lightingShader, "groundStrength"); 525 | int lightingShaderAmbientStrength = GetShaderLocation(lightingShader, "ambientStrength"); 526 | int lightingShaderExposure = GetShaderLocation(lightingShader, "exposure"); 527 | int lightingShaderCamClipNear = GetShaderLocation(lightingShader, "camClipNear"); 528 | int lightingShaderCamClipFar = GetShaderLocation(lightingShader, "camClipFar"); 529 | 530 | Shader ssaoShader = LoadShader("./resources/post.vs", "./resources/ssao.fs"); 531 | int ssaoShaderGBufferNormal = GetShaderLocation(ssaoShader, "gbufferNormal"); 532 | int ssaoShaderGBufferDepth = GetShaderLocation(ssaoShader, "gbufferDepth"); 533 | int ssaoShaderCamView = GetShaderLocation(ssaoShader, "camView"); 534 | int ssaoShaderCamProj = GetShaderLocation(ssaoShader, "camProj"); 535 | int ssaoShaderCamInvProj = GetShaderLocation(ssaoShader, "camInvProj"); 536 | int ssaoShaderCamInvViewProj = GetShaderLocation(ssaoShader, "camInvViewProj"); 537 | int ssaoShaderLightViewProj = GetShaderLocation(ssaoShader, "lightViewProj"); 538 | int ssaoShaderShadowMap = GetShaderLocation(ssaoShader, "shadowMap"); 539 | int ssaoShaderShadowInvResolution = GetShaderLocation(ssaoShader, "shadowInvResolution"); 540 | int ssaoShaderCamClipNear = GetShaderLocation(ssaoShader, "camClipNear"); 541 | int ssaoShaderCamClipFar = GetShaderLocation(ssaoShader, "camClipFar"); 542 | int ssaoShaderLightClipNear = GetShaderLocation(ssaoShader, "lightClipNear"); 543 | int ssaoShaderLightClipFar = GetShaderLocation(ssaoShader, "lightClipFar"); 544 | int ssaoShaderLightDir = GetShaderLocation(ssaoShader, "lightDir"); 545 | 546 | Shader blurShader = LoadShader("./resources/post.vs", "./resources/blur.fs"); 547 | int blurShaderGBufferNormal = GetShaderLocation(blurShader, "gbufferNormal"); 548 | int blurShaderGBufferDepth = GetShaderLocation(blurShader, "gbufferDepth"); 549 | int blurShaderInputTexture = GetShaderLocation(blurShader, "inputTexture"); 550 | int blurShaderCamInvProj = GetShaderLocation(blurShader, "camInvProj"); 551 | int blurShaderCamClipNear = GetShaderLocation(blurShader, "camClipNear"); 552 | int blurShaderCamClipFar = GetShaderLocation(blurShader, "camClipFar"); 553 | int blurShaderInvTextureResolution = GetShaderLocation(blurShader, "invTextureResolution"); 554 | int blurShaderBlurDirection = GetShaderLocation(blurShader, "blurDirection"); 555 | 556 | Shader fxaaShader = LoadShader("./resources/post.vs", "./resources/fxaa.fs"); 557 | int fxaaShaderInputTexture = GetShaderLocation(fxaaShader, "inputTexture"); 558 | int fxaaShaderInvTextureResolution = GetShaderLocation(fxaaShader, "invTextureResolution"); 559 | 560 | // Objects 561 | 562 | Mesh groundMesh = GenMeshPlane(20.0f, 20.0f, 10, 10); 563 | Model groundModel = LoadModelFromMesh(groundMesh); 564 | Vector3 groundPosition = (Vector3){ 0.0f, -0.01f, 0.0f }; 565 | 566 | Model genoModel = LoadGenoModel("./resources/Geno.bin"); 567 | Vector3 genoPosition = (Vector3){ 0.0f, 0.0f, 0.0f }; 568 | 569 | // Animation 570 | 571 | // ModelAnimation testAnimation = LoadGenoModelAnimation("./resources/ground1_subject1.bin"); 572 | //ModelAnimation testAnimation = LoadGenoModelAnimation("./resources/kthstreet_gPO_sFM_cAll_d02_mPO_ch01_atombounce_001.bin"); 573 | ModelAnimation testAnimation = LoadEmptyModelAnimation(genoModel); 574 | int animationFrame = 0; 575 | 576 | assert(testAnimation.boneCount == genoModel.boneCount); 577 | 578 | // Camera 579 | 580 | OrbitCamera camera; 581 | OrbitCameraInit(&camera); 582 | 583 | // Shadows 584 | 585 | Vector3 lightDir = Vector3Normalize((Vector3){ 0.35f, -1.0f, -0.35f }); 586 | 587 | ShadowLight shadowLight = (ShadowLight){ 0 }; 588 | shadowLight.target = Vector3Zero(); 589 | shadowLight.position = Vector3Scale(lightDir, -5.0f); 590 | shadowLight.up = (Vector3){ 0.0f, 1.0f, 0.0f }; 591 | shadowLight.width = 5.0f; 592 | shadowLight.height = 5.0f; 593 | shadowLight.near = 0.01f; 594 | shadowLight.far = 10.0f; 595 | 596 | int shadowWidth = 1024; 597 | int shadowHeight = 1024; 598 | Vector2 shadowInvResolution = (Vector2){ 1.0f / shadowWidth, 1.0f / shadowHeight }; 599 | RenderTexture2D shadowMap = LoadShadowMap(shadowWidth, shadowHeight); 600 | 601 | // GBuffer and Render Textures 602 | 603 | GBuffer gbuffer = LoadGBuffer(screenWidth, screenHeight); 604 | RenderTexture2D lighted = LoadRenderTexture(screenWidth, screenHeight); 605 | RenderTexture2D ssaoFront = LoadRenderTexture(screenWidth, screenHeight); 606 | RenderTexture2D ssaoBack = LoadRenderTexture(screenWidth, screenHeight); 607 | 608 | // UI 609 | 610 | bool drawBoneTransforms = false; 611 | 612 | // Go 613 | 614 | while (!WindowShouldClose()) 615 | { 616 | // Animation 617 | 618 | animationFrame = (animationFrame + 1) % testAnimation.frameCount; 619 | UpdateModelAnimationBones(genoModel, testAnimation, animationFrame); 620 | 621 | // Shadow Light Tracks Character 622 | 623 | Vector3 hipPosition = testAnimation.framePoses[animationFrame][0].translation; 624 | 625 | shadowLight.target = (Vector3){ hipPosition.x, 0.0f, hipPosition.z }; 626 | shadowLight.position = Vector3Add(shadowLight.target, Vector3Scale(lightDir, -5.0f)); 627 | 628 | // Update Camera 629 | 630 | OrbitCameraUpdate( 631 | &camera, 632 | (Vector3){ hipPosition.x, 0.75f, hipPosition.z }, 633 | (IsKeyDown(KEY_LEFT_CONTROL) && IsMouseButtonDown(0)) ? GetMouseDelta().x : 0.0f, 634 | (IsKeyDown(KEY_LEFT_CONTROL) && IsMouseButtonDown(0)) ? GetMouseDelta().y : 0.0f, 635 | (IsKeyDown(KEY_LEFT_CONTROL) && IsMouseButtonDown(1)) ? GetMouseDelta().x : 0.0f, 636 | (IsKeyDown(KEY_LEFT_CONTROL) && IsMouseButtonDown(1)) ? GetMouseDelta().y : 0.0f, 637 | GetMouseWheelMove(), 638 | GetFrameTime()); 639 | 640 | // Render 641 | 642 | rlDisableColorBlend(); 643 | 644 | BeginDrawing(); 645 | 646 | // Render Shadow Maps 647 | 648 | BeginShadowMap(shadowMap, shadowLight); 649 | 650 | Matrix lightViewProj = MatrixMultiply(rlGetMatrixModelview(), rlGetMatrixProjection()); 651 | float lightClipNear = rlGetCullDistanceNear(); 652 | float lightClipFar = rlGetCullDistanceFar(); 653 | 654 | SetShaderValue(shadowShader, shadowShaderLightClipNear, &lightClipNear, SHADER_UNIFORM_FLOAT); 655 | SetShaderValue(shadowShader, shadowShaderLightClipFar, &lightClipFar, SHADER_UNIFORM_FLOAT); 656 | SetShaderValue(skinnedShadowShader, skinnedShadowShaderLightClipNear, &lightClipNear, SHADER_UNIFORM_FLOAT); 657 | SetShaderValue(skinnedShadowShader, skinnedShadowShaderLightClipFar, &lightClipFar, SHADER_UNIFORM_FLOAT); 658 | 659 | groundModel.materials[0].shader = shadowShader; 660 | DrawModel(groundModel, groundPosition, 1.0f, WHITE); 661 | 662 | genoModel.materials[0].shader = skinnedShadowShader; 663 | DrawModel(genoModel, genoPosition, 1.0f, WHITE); 664 | 665 | EndShadowMap(); 666 | 667 | // Render GBuffer 668 | 669 | BeginGBuffer(gbuffer, camera.cam3d); 670 | 671 | Matrix camView = rlGetMatrixModelview(); 672 | Matrix camProj = rlGetMatrixProjection(); 673 | Matrix camInvProj = MatrixInvert(camProj); 674 | Matrix camInvViewProj = MatrixInvert(MatrixMultiply(camView, camProj)); 675 | float camClipNear = rlGetCullDistanceNear(); 676 | float camClipFar = rlGetCullDistanceFar(); 677 | 678 | float specularity = 0.5f; 679 | float glossiness = 10.0f; 680 | 681 | SetShaderValue(basicShader, basicShaderSpecularity, &specularity, SHADER_UNIFORM_FLOAT); 682 | SetShaderValue(basicShader, basicShaderGlossiness, &glossiness, SHADER_UNIFORM_FLOAT); 683 | SetShaderValue(basicShader, basicShaderCamClipNear, &camClipNear, SHADER_UNIFORM_FLOAT); 684 | SetShaderValue(basicShader, basicShaderCamClipFar, &camClipFar, SHADER_UNIFORM_FLOAT); 685 | 686 | SetShaderValue(skinnedBasicShader, skinnedBasicShaderSpecularity, &specularity, SHADER_UNIFORM_FLOAT); 687 | SetShaderValue(skinnedBasicShader, skinnedBasicShaderGlossiness, &glossiness, SHADER_UNIFORM_FLOAT); 688 | SetShaderValue(skinnedBasicShader, skinnedBasicShaderCamClipNear, &camClipNear, SHADER_UNIFORM_FLOAT); 689 | SetShaderValue(skinnedBasicShader, skinnedBasicShaderCamClipFar, &camClipFar, SHADER_UNIFORM_FLOAT); 690 | 691 | groundModel.materials[0].shader = basicShader; 692 | DrawModel(groundModel, groundPosition, 1.0f, WHITE); 693 | 694 | genoModel.materials[0].shader = skinnedBasicShader; 695 | DrawModel(genoModel, genoPosition, 1.0f, ORANGE); 696 | 697 | EndGBuffer(screenWidth, screenHeight); 698 | 699 | // Render SSAO and Shadows 700 | 701 | BeginTextureMode(ssaoFront); 702 | 703 | BeginShaderMode(ssaoShader); 704 | 705 | SetShaderValueTexture(ssaoShader, ssaoShaderGBufferNormal, gbuffer.normal); 706 | SetShaderValueTexture(ssaoShader, ssaoShaderGBufferDepth, gbuffer.depth); 707 | SetShaderValueMatrix(ssaoShader, ssaoShaderCamView, camView); 708 | SetShaderValueMatrix(ssaoShader, ssaoShaderCamProj, camProj); 709 | SetShaderValueMatrix(ssaoShader, ssaoShaderCamInvProj, camInvProj); 710 | SetShaderValueMatrix(ssaoShader, ssaoShaderCamInvViewProj, camInvViewProj); 711 | SetShaderValueMatrix(ssaoShader, ssaoShaderLightViewProj, lightViewProj); 712 | SetShaderValueShadowMap(ssaoShader, ssaoShaderShadowMap, shadowMap); 713 | SetShaderValue(ssaoShader, ssaoShaderShadowInvResolution, &shadowInvResolution, SHADER_UNIFORM_VEC2); 714 | SetShaderValue(ssaoShader, ssaoShaderCamClipNear, &camClipNear, SHADER_UNIFORM_FLOAT); 715 | SetShaderValue(ssaoShader, ssaoShaderCamClipFar, &camClipFar, SHADER_UNIFORM_FLOAT); 716 | SetShaderValue(ssaoShader, ssaoShaderLightClipNear, &lightClipNear, SHADER_UNIFORM_FLOAT); 717 | SetShaderValue(ssaoShader, ssaoShaderLightClipFar, &lightClipFar, SHADER_UNIFORM_FLOAT); 718 | SetShaderValue(ssaoShader, ssaoShaderLightDir, &lightDir, SHADER_UNIFORM_VEC3); 719 | 720 | ClearBackground(WHITE); 721 | 722 | DrawTextureRec( 723 | ssaoFront.texture, 724 | (Rectangle){ 0, 0, ssaoFront.texture.width, -ssaoFront.texture.height }, 725 | (Vector2){ 0, 0 }, 726 | WHITE); 727 | 728 | EndShaderMode(); 729 | 730 | EndTextureMode(); 731 | 732 | // Blur Horizontal 733 | 734 | BeginTextureMode(ssaoBack); 735 | 736 | BeginShaderMode(blurShader); 737 | 738 | Vector2 blurDirection = (Vector2){ 1.0f, 0.0f }; 739 | Vector2 blurInvTextureResolution = (Vector2){ 1.0f / ssaoFront.texture.width, 1.0f / ssaoFront.texture.height }; 740 | 741 | SetShaderValueTexture(blurShader, blurShaderGBufferNormal, gbuffer.normal); 742 | SetShaderValueTexture(blurShader, blurShaderGBufferDepth, gbuffer.depth); 743 | SetShaderValueTexture(blurShader, blurShaderInputTexture, ssaoFront.texture); 744 | SetShaderValueMatrix(blurShader, blurShaderCamInvProj, camInvProj); 745 | SetShaderValue(blurShader, blurShaderCamClipNear, &camClipNear, SHADER_UNIFORM_FLOAT); 746 | SetShaderValue(blurShader, blurShaderCamClipFar, &camClipFar, SHADER_UNIFORM_FLOAT); 747 | SetShaderValue(blurShader, blurShaderInvTextureResolution, &blurInvTextureResolution, SHADER_UNIFORM_VEC2); 748 | SetShaderValue(blurShader, blurShaderBlurDirection, &blurDirection, SHADER_UNIFORM_VEC2); 749 | 750 | DrawTextureRec( 751 | ssaoBack.texture, 752 | (Rectangle){ 0, 0, ssaoBack.texture.width, -ssaoBack.texture.height }, 753 | (Vector2){ 0, 0 }, 754 | WHITE); 755 | 756 | EndShaderMode(); 757 | 758 | EndTextureMode(); 759 | 760 | // Blur Vertical 761 | 762 | BeginTextureMode(ssaoFront); 763 | 764 | BeginShaderMode(blurShader); 765 | 766 | blurDirection = (Vector2){ 0.0f, 1.0f }; 767 | 768 | SetShaderValueTexture(blurShader, blurShaderInputTexture, ssaoBack.texture); 769 | SetShaderValue(blurShader, blurShaderBlurDirection, &blurDirection, SHADER_UNIFORM_VEC2); 770 | 771 | DrawTextureRec( 772 | ssaoFront.texture, 773 | (Rectangle){ 0, 0, ssaoFront.texture.width, -ssaoFront.texture.height }, 774 | (Vector2){ 0, 0 }, 775 | WHITE); 776 | 777 | EndShaderMode(); 778 | 779 | EndTextureMode(); 780 | 781 | // Light GBuffer 782 | 783 | BeginTextureMode(lighted); 784 | 785 | BeginShaderMode(lightingShader); 786 | 787 | Vector3 sunColor = (Vector3){ 253.0f / 255.0f, 255.0f / 255.0f, 232.0f / 255.0f }; 788 | float sunStrength = 0.25f; 789 | Vector3 skyColor = (Vector3){ 174.0f / 255.0f, 183.0f / 255.0f, 190.0f / 255.0f }; 790 | float skyStrength = 0.2f; 791 | float groundStrength = 0.1f; 792 | float ambientStrength = 1.0f; 793 | float exposure = 0.9f; 794 | 795 | SetShaderValueTexture(lightingShader, lightingShaderGBufferColor, gbuffer.color); 796 | SetShaderValueTexture(lightingShader, lightingShaderGBufferNormal, gbuffer.normal); 797 | SetShaderValueTexture(lightingShader, lightingShaderGBufferDepth, gbuffer.depth); 798 | SetShaderValueTexture(lightingShader, lightingShaderSSAO, ssaoFront.texture); 799 | SetShaderValue(lightingShader, lightingShaderCamPos, &camera.cam3d.position, SHADER_UNIFORM_VEC3); 800 | SetShaderValueMatrix(lightingShader, lightingShaderCamInvViewProj, camInvViewProj); 801 | SetShaderValue(lightingShader, lightingShaderLightDir, &lightDir, SHADER_UNIFORM_VEC3); 802 | SetShaderValue(lightingShader, lightingShaderSunColor, &sunColor, SHADER_UNIFORM_VEC3); 803 | SetShaderValue(lightingShader, lightingShaderSunStrength, &sunStrength, SHADER_UNIFORM_FLOAT); 804 | SetShaderValue(lightingShader, lightingShaderSkyColor, &skyColor, SHADER_UNIFORM_VEC3); 805 | SetShaderValue(lightingShader, lightingShaderSkyStrength, &skyStrength, SHADER_UNIFORM_FLOAT); 806 | SetShaderValue(lightingShader, lightingShaderGroundStrength, &groundStrength, SHADER_UNIFORM_FLOAT); 807 | SetShaderValue(lightingShader, lightingShaderAmbientStrength, &ambientStrength, SHADER_UNIFORM_FLOAT); 808 | SetShaderValue(lightingShader, lightingShaderExposure, &exposure, SHADER_UNIFORM_FLOAT); 809 | SetShaderValue(lightingShader, lightingShaderCamClipNear, &camClipNear, SHADER_UNIFORM_FLOAT); 810 | SetShaderValue(lightingShader, lightingShaderCamClipFar, &camClipFar, SHADER_UNIFORM_FLOAT); 811 | 812 | ClearBackground(RAYWHITE); 813 | 814 | DrawTextureRec( 815 | gbuffer.color, 816 | (Rectangle){ 0, 0, gbuffer.color.width, -gbuffer.color.height }, 817 | (Vector2){ 0, 0 }, 818 | WHITE); 819 | 820 | EndShaderMode(); 821 | 822 | // Debug Draw 823 | 824 | BeginMode3D(camera.cam3d); 825 | 826 | if (drawBoneTransforms) 827 | { 828 | DrawModelAnimationFrameSkeleton(testAnimation, animationFrame, GRAY); 829 | } 830 | 831 | EndMode3D(); 832 | 833 | EndTextureMode(); 834 | 835 | // Render Final with FXAA 836 | 837 | BeginShaderMode(fxaaShader); 838 | 839 | Vector2 fxaaInvTextureResolution = (Vector2){ 1.0f / lighted.texture.width, 1.0f / lighted.texture.height }; 840 | 841 | SetShaderValueTexture(fxaaShader, fxaaShaderInputTexture, lighted.texture); 842 | SetShaderValue(fxaaShader, fxaaShaderInvTextureResolution, &fxaaInvTextureResolution, SHADER_UNIFORM_VEC2); 843 | 844 | DrawTextureRec( 845 | lighted.texture, 846 | (Rectangle){ 0, 0, lighted.texture.width, -lighted.texture.height }, 847 | (Vector2){ 0, 0 }, 848 | WHITE); 849 | 850 | EndShaderMode(); 851 | 852 | // UI 853 | 854 | rlEnableColorBlend(); 855 | 856 | GuiGroupBox((Rectangle){ 20, 10, 190, 180 }, "Camera"); 857 | 858 | GuiLabel((Rectangle){ 30, 20, 150, 20 }, "Ctrl + Left Click - Rotate"); 859 | GuiLabel((Rectangle){ 30, 40, 150, 20 }, "Ctrl + Right Click - Pan"); 860 | GuiLabel((Rectangle){ 30, 60, 150, 20 }, "Mouse Scroll - Zoom"); 861 | GuiLabel((Rectangle){ 30, 80, 150, 20 }, TextFormat("Target: [% 5.3f % 5.3f % 5.3f]", camera.cam3d.target.x, camera.cam3d.target.y, camera.cam3d.target.z)); 862 | GuiLabel((Rectangle){ 30, 100, 150, 20 }, TextFormat("Offset: [% 5.3f % 5.3f % 5.3f]", camera.offset.x, camera.offset.y, camera.offset.z)); 863 | GuiLabel((Rectangle){ 30, 120, 150, 20 }, TextFormat("Azimuth: %5.3f", camera.azimuth)); 864 | GuiLabel((Rectangle){ 30, 140, 150, 20 }, TextFormat("Altitude: %5.3f", camera.altitude)); 865 | GuiLabel((Rectangle){ 30, 160, 150, 20 }, TextFormat("Distance: %5.3f", camera.distance)); 866 | 867 | GuiGroupBox((Rectangle){ screenWidth - 260, 10, 240, 40 }, "Rendering"); 868 | 869 | GuiCheckBox((Rectangle){ screenWidth - 250, 20, 20, 20 }, "Draw Transfoms", &drawBoneTransforms); 870 | 871 | 872 | EndDrawing(); 873 | } 874 | 875 | UnloadRenderTexture(lighted); 876 | UnloadRenderTexture(ssaoBack); 877 | UnloadRenderTexture(ssaoFront); 878 | UnloadRenderTexture(lighted); 879 | UnloadGBuffer(gbuffer); 880 | 881 | UnloadShadowMap(shadowMap); 882 | 883 | UnloadModelAnimation(testAnimation); 884 | 885 | UnloadModel(genoModel); 886 | UnloadModel(groundModel); 887 | 888 | UnloadShader(fxaaShader); 889 | UnloadShader(blurShader); 890 | UnloadShader(ssaoShader); 891 | UnloadShader(lightingShader); 892 | UnloadShader(basicShader); 893 | UnloadShader(skinnedBasicShader); 894 | UnloadShader(skinnedShadowShader); 895 | UnloadShader(shadowShader); 896 | 897 | CloseWindow(); 898 | 899 | return 0; 900 | } -------------------------------------------------------------------------------- /resources/Geno.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangeduck/GenoView/e32f504f946b6b3c9881a4efb28bc64d41774ab4/resources/Geno.bin -------------------------------------------------------------------------------- /resources/Geno.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangeduck/GenoView/e32f504f946b6b3c9881a4efb28bc64d41774ab4/resources/Geno.fbx -------------------------------------------------------------------------------- /resources/Geno.mb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangeduck/GenoView/e32f504f946b6b3c9881a4efb28bc64d41774ab4/resources/Geno.mb -------------------------------------------------------------------------------- /resources/Geno_bind.bvh: -------------------------------------------------------------------------------- 1 | HIERARCHY 2 | ROOT Hips 3 | { 4 | OFFSET 0.0136489431 85.5290222 -2.13670418 5 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 6 | JOINT Spine 7 | { 8 | OFFSET 2.30099286e-05 8.81424618 -2.08003235 9 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 10 | JOINT Spine1 11 | { 12 | OFFSET 8.7261958e-07 8.84414387 -2.72457055e-06 13 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 14 | JOINT Spine2 15 | { 16 | OFFSET -2.55740429e-06 11.682272 4.31642138e-06 17 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 18 | JOINT Spine3 19 | { 20 | OFFSET 6.59586306e-07 11.7466984 -3.93247592e-06 21 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 22 | JOINT Neck 23 | { 24 | OFFSET 8.48960008e-06 17.6582756 -8.42700974e-05 25 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 26 | JOINT Neck1 27 | { 28 | OFFSET 3.79443094e-07 5.10151863 3.26421036e-06 29 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 30 | JOINT Head 31 | { 32 | OFFSET -9.47953868e-06 5.10151625 8.86555881e-06 33 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 34 | JOINT HeadEnd 35 | { 36 | OFFSET -4.13024277e-16 11.6550846 5.50596564e-14 37 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 38 | End Site 39 | { 40 | OFFSET 0 0 0 41 | } 42 | } 43 | } 44 | } 45 | } 46 | JOINT RightShoulder 47 | { 48 | OFFSET -2.62538743 11.1752224 -4.81263169e-06 49 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 50 | JOINT RightArm 51 | { 52 | OFFSET -1.50603675e-06 10.4347115 1.24267818e-05 53 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 54 | JOINT RightForeArm 55 | { 56 | OFFSET 0.069977134 25.8717893 -0.536955001 57 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 58 | JOINT RightHand 59 | { 60 | OFFSET 0.298976964 24.8929021 -0.0338061789 61 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 62 | JOINT RightHandThumb1 63 | { 64 | OFFSET -2.86730862 3.95956302 2.94429946 65 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 66 | JOINT RightHandThumb2 67 | { 68 | OFFSET 5.44471726e-06 3.35039091 -6.88177021e-07 69 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 70 | JOINT RightHandThumb3 71 | { 72 | OFFSET -5.18119812e-06 3.75651813 3.88906735e-06 73 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 74 | JOINT RightHandThumb4 75 | { 76 | OFFSET -4.83070982e-07 3.1473465 -1.11636681e-06 77 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 78 | End Site 79 | { 80 | OFFSET 0 0 0 81 | } 82 | } 83 | } 84 | } 85 | } 86 | JOINT RightHandIndex1 87 | { 88 | OFFSET -0.0867566392 10.030899 2.34528232 89 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 90 | JOINT RightHandIndex2 91 | { 92 | OFFSET -3.76662116e-06 4.06108809 3.41322158e-06 93 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 94 | JOINT RightHandIndex3 95 | { 96 | OFFSET 2.12695065e-06 3.2488718 -2.91990217e-06 97 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 98 | JOINT RightHandIndex4 99 | { 100 | OFFSET 1.19115619e-07 2.6397078 2.31537559e-06 101 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 102 | End Site 103 | { 104 | OFFSET 0 0 0 105 | } 106 | } 107 | } 108 | } 109 | } 110 | JOINT RightHandMiddle1 111 | { 112 | OFFSET 0.104109198 9.50295544 0.00677696662 113 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 114 | JOINT RightHandMiddle2 115 | { 116 | OFFSET -4.00518747e-07 4.56873274 5.93760964e-06 117 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 118 | JOINT RightHandMiddle3 119 | { 120 | OFFSET 7.54751455e-06 3.6549809 -3.29262286e-06 121 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 122 | JOINT RightHandMiddle4 123 | { 124 | OFFSET -2.47242271e-06 2.74122977 5.72284435e-06 125 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 126 | End Site 127 | { 128 | OFFSET 0 0 0 129 | } 130 | } 131 | } 132 | } 133 | } 134 | JOINT RightHandRing1 135 | { 136 | OFFSET 0.0867536962 8.92171097 -2.26744866 137 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 138 | JOINT RightHandRing2 139 | { 140 | OFFSET -8.49416485e-06 4.06109715 8.33849263e-08 141 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 142 | JOINT RightHandRing3 143 | { 144 | OFFSET -2.69741424e-07 3.65497613 8.05873964e-06 145 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 146 | JOINT RightHandRing4 147 | { 148 | OFFSET -1.75682811e-07 2.74124503 -6.02012545e-07 149 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 150 | End Site 151 | { 152 | OFFSET 0 0 0 153 | } 154 | } 155 | } 156 | } 157 | } 158 | JOINT RightHandPinky1 159 | { 160 | OFFSET -0.173490137 7.97699213 -4.46720457 161 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 162 | JOINT RightHandPinky2 163 | { 164 | OFFSET -5.09637176e-06 3.35040545 -1.14142521e-05 165 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 166 | JOINT RightHandPinky3 167 | { 168 | OFFSET -2.41064345e-06 2.84276104 3.31119791e-07 169 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 170 | JOINT RightHandPinky4 171 | { 172 | OFFSET -4.84227395e-06 2.63970661 4.19883692e-06 173 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 174 | End Site 175 | { 176 | OFFSET 0 0 0 177 | } 178 | } 179 | } 180 | } 181 | } 182 | JOINT RightForeArmEnd 183 | { 184 | OFFSET -2.56183113e-14 -1.74232385e-16 -6.35784429e-17 185 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 186 | End Site 187 | { 188 | OFFSET 0 0 0 189 | } 190 | } 191 | } 192 | JOINT RightArmEnd 193 | { 194 | OFFSET -6.99860395e-14 1.22731819e-14 -1.81852944e-16 195 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 196 | End Site 197 | { 198 | OFFSET 0 0 0 199 | } 200 | } 201 | } 202 | } 203 | } 204 | JOINT LeftShoulder 205 | { 206 | OFFSET 2.62539148 11.1752157 -5.83177598e-06 207 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 208 | JOINT LeftArm 209 | { 210 | OFFSET 5.66755475e-06 10.8136358 -4.22273472e-06 211 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 212 | JOINT LeftForeArm 213 | { 214 | OFFSET 0.495176165 25.5930268 -0.449427606 215 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 216 | JOINT LeftHand 217 | { 218 | OFFSET 1.17407218 25.9241226 -0.520486077 219 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 220 | JOINT LeftHandThumb1 221 | { 222 | OFFSET 2.86732364 3.95956516 2.94428587 223 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 224 | JOINT LeftHandThumb2 225 | { 226 | OFFSET 4.51622475e-06 3.35040307 -6.45308119e-06 227 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 228 | JOINT LeftHandThumb3 229 | { 230 | OFFSET -4.47107817e-06 3.7565124 2.93693687e-06 231 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 232 | JOINT LeftHandThumb4 233 | { 234 | OFFSET 5.87812437e-06 3.09999704 6.19059526e-07 235 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 236 | End Site 237 | { 238 | OFFSET 0 0 0 239 | } 240 | } 241 | } 242 | } 243 | } 244 | JOINT LeftHandIndex1 245 | { 246 | OFFSET 0.0867575407 10.0309181 2.3452754 247 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 248 | JOINT LeftHandIndex2 249 | { 250 | OFFSET 2.42767352e-06 4.06109953 -3.08199487e-06 251 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 252 | JOINT LeftHandIndex3 253 | { 254 | OFFSET 8.04225515e-06 3.248873 -8.45241096e-07 255 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 256 | JOINT LeftHandIndex4 257 | { 258 | OFFSET 1.72217163e-06 2.63970876 -2.5227572e-06 259 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 260 | End Site 261 | { 262 | OFFSET 0 0 0 263 | } 264 | } 265 | } 266 | } 267 | } 268 | JOINT LeftHandMiddle1 269 | { 270 | OFFSET -0.104109183 9.50298023 0.00676779216 271 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 272 | JOINT LeftHandMiddle2 273 | { 274 | OFFSET 9.37434926e-06 4.56873751 -9.79924987e-06 275 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 276 | JOINT LeftHandMiddle3 277 | { 278 | OFFSET 4.04745486e-07 3.65497494 -6.22627218e-06 279 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 280 | JOINT LeftHandMiddle4 281 | { 282 | OFFSET 6.56328438e-06 2.74124384 2.14881322e-06 283 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 284 | End Site 285 | { 286 | OFFSET 0 0 0 287 | } 288 | } 289 | } 290 | } 291 | } 292 | JOINT LeftHandRing1 293 | { 294 | OFFSET -0.0867514238 8.92171001 -2.26744246 295 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 296 | JOINT LeftHandRing2 297 | { 298 | OFFSET 2.84260566e-06 4.0610981 1.66922936e-06 299 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 300 | JOINT LeftHandRing3 301 | { 302 | OFFSET 2.69776163e-06 3.65499043 -4.2109282e-07 303 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 304 | JOINT LeftHandRing4 305 | { 306 | OFFSET -3.79034851e-06 2.74123073 8.99070159e-06 307 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 308 | End Site 309 | { 310 | OFFSET 0 0 0 311 | } 312 | } 313 | } 314 | } 315 | } 316 | JOINT LeftHandPinky1 317 | { 318 | OFFSET 0.17350249 7.97701931 -4.46721411 319 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 320 | JOINT LeftHandPinky2 321 | { 322 | OFFSET 7.27843511e-06 3.35040712 -9.3553765e-07 323 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 324 | JOINT LeftHandPinky3 325 | { 326 | OFFSET -5.85262889e-06 2.84276485 4.58743125e-06 327 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 328 | JOINT LeftHandPinky4 329 | { 330 | OFFSET -7.78088633e-06 2.63970661 -4.94400273e-06 331 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 332 | End Site 333 | { 334 | OFFSET 0 0 0 335 | } 336 | } 337 | } 338 | } 339 | } 340 | JOINT LeftForeArmEnd 341 | { 342 | OFFSET 0 0 0 343 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 344 | End Site 345 | { 346 | OFFSET 0 0 0 347 | } 348 | } 349 | } 350 | JOINT LeftArmEnd 351 | { 352 | OFFSET 4.00792269e-14 -3.03205474e-15 -9.15536879e-16 353 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 354 | End Site 355 | { 356 | OFFSET 0 0 0 357 | } 358 | } 359 | } 360 | } 361 | } 362 | } 363 | } 364 | } 365 | } 366 | JOINT RightUpLeg 367 | { 368 | OFFSET -11.2899361 -5.41907593e-06 4.37811241e-06 369 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 370 | JOINT RightLeg 371 | { 372 | OFFSET 4.06874415e-06 -38.2003288 -0.000216508837 373 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 374 | JOINT RightFoot 375 | { 376 | OFFSET 2.34040795e-06 -39.9008484 -1.7754561e-06 377 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 378 | JOINT RightToeBase 379 | { 380 | OFFSET 8.32294609e-06 -2.00084855e-06 15.2616587 381 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 382 | JOINT RightToeBaseEnd 383 | { 384 | OFFSET 1.13520304e-14 -2.66453526e-15 7.37070894 385 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 386 | End Site 387 | { 388 | OFFSET 0 0 0 389 | } 390 | } 391 | } 392 | JOINT RightLegEnd 393 | { 394 | OFFSET 3.77328156e-16 -3.17678035e-15 1.54514225e-15 395 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 396 | End Site 397 | { 398 | OFFSET 0 0 0 399 | } 400 | } 401 | } 402 | JOINT RightUpLegEnd 403 | { 404 | OFFSET 0 0 0 405 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 406 | End Site 407 | { 408 | OFFSET 0 0 0 409 | } 410 | } 411 | } 412 | } 413 | JOINT LeftUpLeg 414 | { 415 | OFFSET 11.3156643 5.637718e-06 3.58431043e-06 416 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 417 | JOINT LeftLeg 418 | { 419 | OFFSET 0.000396562187 -38.2004128 0.00390832592 420 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 421 | JOINT LeftFoot 422 | { 423 | OFFSET 6.99668022e-07 -39.9008179 1.10017036e-05 424 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 425 | JOINT LeftToeBase 426 | { 427 | OFFSET 1.27913745e-06 -6.1466194e-06 15.2616472 428 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 429 | JOINT LeftToeBaseEnd 430 | { 431 | OFFSET -2.9873673e-14 9.85322934e-15 7.53999615 432 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 433 | End Site 434 | { 435 | OFFSET 0 0 0 436 | } 437 | } 438 | } 439 | JOINT LeftLegEnd 440 | { 441 | OFFSET -2.25407004e-16 7.51349475e-16 1.59377203e-15 442 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 443 | End Site 444 | { 445 | OFFSET 0 0 0 446 | } 447 | } 448 | } 449 | JOINT LeftUpLegEnd 450 | { 451 | OFFSET 0 0 0 452 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 453 | End Site 454 | { 455 | OFFSET 0 0 0 456 | } 457 | } 458 | } 459 | } 460 | } 461 | MOTION 462 | Frames: 2 463 | Frame Time: 0.016667 464 | 0.0136489431 85.5290222 -2.13670418 -0.106775223 0.990737582 -1.95232655 2.30099286e-05 8.81424618 -2.08003235 0.731996596 -0.281772584 1.7326175 8.7261958e-07 8.84414387 -2.72457055e-06 -0.0887884796 -0.55689472 1.41077256 -2.55740429e-06 11.682272 4.31642138e-06 -0.0848602206 -0.554447293 1.41127479 6.59586306e-07 11.7466984 -3.93247592e-06 -0.14110078 0.764301163 1.41961293 8.48960008e-06 17.6582756 -8.42700974e-05 -0.84381537 -0.185855117 -0.110968815 3.79443094e-07 5.10151863 3.26421036e-06 1.21945777 -0.0902915314 -1.22386346 -9.47953868e-06 5.10151625 8.86555881e-06 -0.199191275 -0.10613689 -2.7721569 -4.13024277e-16 11.6550846 5.50596564e-14 -1.98784668e-16 -2.35862667e-17 -1.49199213e-16 -2.62538743 11.1752224 -4.81263169e-06 87.5071199 2.15083389 -5.56249249 -1.50603675e-06 10.4347115 1.24267818e-05 46.7990456 -2.53156591 -3.17589217 0.069977134 25.8717893 -0.536955001 2.01937822 -0.867715733 13.0461588 0.298976964 24.8929021 -0.0338061789 9.06018708 1.77959702 9.95412794 -2.86730862 3.95956302 2.94429946 -2.76949004 -5.43271235 47.5254141 5.44471726e-06 3.35039091 -6.88177021e-07 19.1551863 6.8585393 -19.8914085 -5.18119812e-06 3.75651813 3.88906735e-06 -3.65735392 -0.126421387 -4.94146735 -4.83070982e-07 3.1473465 -1.11636681e-06 -1.76556252e-31 -6.36110936e-15 3.18055468e-15 -0.0867566392 10.030899 2.34528232 6.06020632 -0.189600725 8.91457345 -3.76662116e-06 4.06108809 3.41322158e-06 -0.731460615 0.581984568 -4.25736196 2.12695065e-06 3.2488718 -2.91990217e-06 -4.97373104 -4.10945672e-07 -0.000106993211 1.19115619e-07 2.6397078 2.31537559e-06 1.90833281e-14 5.29668756e-31 -3.18055468e-15 0.104109198 9.50295544 0.00677696662 1.22127282 0.230203374 -4.73932566 -4.00518747e-07 4.56873274 5.93760964e-06 0.0862517208 -4.50923517e-06 -1.38540975e-06 7.54751455e-06 3.6549809 -3.29262286e-06 -4.9490757 1.81123645e-06 -0.000103195045 -2.47242271e-06 2.74122977 5.72284435e-06 -3.18055468e-14 -2.78298535e-15 4.77083202e-15 0.0867536962 8.92171097 -2.26744866 -1.67973228 -0.7867574 -21.854922 -8.49416485e-06 4.06109715 8.33849263e-08 -0.373307913 -0.461968229 5.10311514 -2.69741424e-07 3.65497613 8.05873964e-06 -4.90137005 1.76895452e-06 6.81751574e-07 -1.75682811e-07 2.74124503 -6.02012545e-07 -1.27222187e-14 -6.36110936e-15 -3.97569335e-16 -0.173490137 7.97699213 -4.46720457 -0.917919453 -2.80792328 -39.1299902 -5.09637176e-06 3.35040545 -1.14142521e-05 1.61636254 0.0561816209 9.56257159 -2.41064345e-06 2.84276104 3.31119791e-07 -4.95122814 1.51178712e-07 1.51240143e-06 -4.84227395e-06 2.63970661 4.19883692e-06 6.36110936e-15 -2.78298535e-15 3.18055468e-15 -2.56183113e-14 -1.74232385e-16 -6.35784429e-17 1.27222187e-14 1.59027734e-15 3.18055468e-15 -6.99860395e-14 1.22731819e-14 -1.81852944e-16 4.72596947e-28 -3.95979058e-13 -1.36763851e-13 2.62539148 11.1752157 -5.83177598e-06 -86.1199045 -0.984291489 -7.8281325 5.66755475e-06 10.8136358 -4.22273472e-06 -48.8780023 2.07540923 1.78364453 0.495176165 25.5930268 -0.449427606 3.72132059 0.966214906 12.7784598 1.17407218 25.9241226 -0.520486077 -18.0856605 -2.55928387 4.107901 2.86732364 3.95956516 2.94428587 -7.83565275 9.61961007 42.1377421 4.51622475e-06 3.35040307 -6.45308119e-06 -7.58343458 -6.09328248 -16.9098088 -4.47107817e-06 3.7565124 2.93693687e-06 0.000127026346 -1.3795841e-06 0.0010996256 5.87812437e-06 3.09999704 6.19059526e-07 -7.9513867e-15 -6.36110936e-15 4.4139063e-31 0.0867575407 10.0309181 2.3452754 -5.26319059 3.46033946 9.7793139 2.42767352e-06 4.06109953 -3.08199487e-06 -0.173833713 1.48169942e-06 -7.94794681e-07 8.04225515e-06 3.248873 -8.45241096e-07 3.03593946 -9.74861379e-07 0.000340333878 1.72217163e-06 2.63970876 -2.5227572e-06 -6.36110936e-15 -1.59027734e-15 3.18055468e-15 -0.104109183 9.50298023 0.00676779216 2.02668273 -1.76193075 -4.23236685 9.37434926e-06 4.56873751 -9.79924987e-06 -1.10253522 -0.457874253 4.88178027 4.04745486e-07 3.65497494 -6.22627218e-06 3.02538204 -8.43880621e-07 -0.000231487429 6.56328438e-06 2.74124384 2.14881322e-06 0 0 0 -0.0867514238 8.92171001 -2.26744246 6.58147365 -1.89628606 -19.7391629 2.84260566e-06 4.0610981 1.66922936e-06 -0.486551674 3.76683416 6.14800529 2.69776163e-06 3.65499043 -4.2109282e-07 3.01718688 1.77938573e-06 -0.00045187783 -3.79034851e-06 2.74123073 8.99070159e-06 1.90833281e-14 -1.59027734e-15 3.97569335e-16 0.17350249 7.97701931 -4.46721411 8.51424081 -7.98970304 -39.6716641 7.27843511e-06 3.35040712 -9.3553765e-07 -0.785554719 3.70018647 13.7957498 -5.85262889e-06 2.84276485 4.58743125e-06 2.97979259 2.14587796e-06 7.7302866e-05 -7.78088633e-06 2.63970661 -4.94400273e-06 -3.16150795e-06 -1.74386889e-06 -1.18092708e-07 0 0 0 -1.90833281e-14 -1.19270801e-15 -1.59027734e-15 4.00792269e-14 -3.03205474e-15 -9.15536879e-16 1.90833281e-14 6.71097038e-13 -1.42329822e-13 -11.2899361 -5.41907593e-06 4.37811241e-06 -7.07668155 2.47163542 3.16028855 4.06874415e-06 -38.2003288 -0.000216508837 -0.607316985 -2.70656 7.61253046 2.34040795e-06 -39.9008484 -1.7754561e-06 3.293056 -9.93275009 18.1750073 8.32294609e-06 -2.00084855e-06 15.2616587 0.179776728 -0.144318106 -19.1180188 1.13520304e-14 -2.66453526e-15 7.37070894 -2.38541601e-15 6.4605017e-16 -1.98784668e-16 3.77328156e-16 -3.17678035e-15 1.54514225e-15 -2.38541601e-15 -2.88237768e-15 9.44227171e-15 0 0 0 -7.07184084e-35 -2.98177001e-16 2.71775913e-17 11.3156643 5.637718e-06 3.58431043e-06 8.01977485 -5.87145323 2.08529531 0.000396562187 -38.2004128 0.00390832592 -0.763691985 4.29556777 5.75564016 6.99668022e-07 -39.9008179 1.10017036e-05 3.09168718 7.97856932 19.1159935 1.27913745e-06 -6.1466194e-06 15.2616472 -0.677521036 0.48925202 -20.5022413 -2.9873673e-14 9.85322934e-15 7.53999615 1.59027734e-15 4.47265502e-16 3.87630102e-15 -2.25407004e-16 7.51349475e-16 1.59377203e-15 -1.10347657e-32 -3.97569335e-16 3.18055468e-15 0 0 0 -1.59027734e-15 5.46657836e-16 -7.55537037e-16 465 | 0.0136489431 85.5290222 -2.13670418 -0.106775223 0.990737582 -1.95232655 2.30099286e-05 8.81424618 -2.08003235 0.731996596 -0.281772584 1.7326175 8.7261958e-07 8.84414387 -2.72457055e-06 -0.0887884796 -0.55689472 1.41077256 -2.55740429e-06 11.682272 4.31642138e-06 -0.0848602206 -0.554447293 1.41127479 6.59586306e-07 11.7466984 -3.93247592e-06 -0.14110078 0.764301163 1.41961293 8.48960008e-06 17.6582756 -8.42700974e-05 -0.84381537 -0.185855117 -0.110968815 3.79443094e-07 5.10151863 3.26421036e-06 1.21945777 -0.0902915314 -1.22386346 -9.47953868e-06 5.10151625 8.86555881e-06 -0.199191275 -0.10613689 -2.7721569 -4.13024277e-16 11.6550846 5.50596564e-14 -1.98784668e-16 -2.35862667e-17 -1.49199213e-16 -2.62538743 11.1752224 -4.81263169e-06 87.5071199 2.15083389 -5.56249249 -1.50603675e-06 10.4347115 1.24267818e-05 46.7990456 -2.53156591 -3.17589217 0.069977134 25.8717893 -0.536955001 2.01937822 -0.867715733 13.0461588 0.298976964 24.8929021 -0.0338061789 9.06018708 1.77959702 9.95412794 -2.86730862 3.95956302 2.94429946 -2.76949004 -5.43271235 47.5254141 5.44471726e-06 3.35039091 -6.88177021e-07 19.1551863 6.8585393 -19.8914085 -5.18119812e-06 3.75651813 3.88906735e-06 -3.65735392 -0.126421387 -4.94146735 -4.83070982e-07 3.1473465 -1.11636681e-06 -1.76556252e-31 -6.36110936e-15 3.18055468e-15 -0.0867566392 10.030899 2.34528232 6.06020632 -0.189600725 8.91457345 -3.76662116e-06 4.06108809 3.41322158e-06 -0.731460615 0.581984568 -4.25736196 2.12695065e-06 3.2488718 -2.91990217e-06 -4.97373104 -4.10945672e-07 -0.000106993211 1.19115619e-07 2.6397078 2.31537559e-06 1.90833281e-14 5.29668756e-31 -3.18055468e-15 0.104109198 9.50295544 0.00677696662 1.22127282 0.230203374 -4.73932566 -4.00518747e-07 4.56873274 5.93760964e-06 0.0862517208 -4.50923517e-06 -1.38540975e-06 7.54751455e-06 3.6549809 -3.29262286e-06 -4.9490757 1.81123645e-06 -0.000103195045 -2.47242271e-06 2.74122977 5.72284435e-06 -3.18055468e-14 -2.78298535e-15 4.77083202e-15 0.0867536962 8.92171097 -2.26744866 -1.67973228 -0.7867574 -21.854922 -8.49416485e-06 4.06109715 8.33849263e-08 -0.373307913 -0.461968229 5.10311514 -2.69741424e-07 3.65497613 8.05873964e-06 -4.90137005 1.76895452e-06 6.81751574e-07 -1.75682811e-07 2.74124503 -6.02012545e-07 -1.27222187e-14 -6.36110936e-15 -3.97569335e-16 -0.173490137 7.97699213 -4.46720457 -0.917919453 -2.80792328 -39.1299902 -5.09637176e-06 3.35040545 -1.14142521e-05 1.61636254 0.0561816209 9.56257159 -2.41064345e-06 2.84276104 3.31119791e-07 -4.95122814 1.51178712e-07 1.51240143e-06 -4.84227395e-06 2.63970661 4.19883692e-06 6.36110936e-15 -2.78298535e-15 3.18055468e-15 -2.56183113e-14 -1.74232385e-16 -6.35784429e-17 1.27222187e-14 1.59027734e-15 3.18055468e-15 -6.99860395e-14 1.22731819e-14 -1.81852944e-16 4.72596947e-28 -3.95979058e-13 -1.36763851e-13 2.62539148 11.1752157 -5.83177598e-06 -86.1199045 -0.984291489 -7.8281325 5.66755475e-06 10.8136358 -4.22273472e-06 -48.8780023 2.07540923 1.78364453 0.495176165 25.5930268 -0.449427606 3.72132059 0.966214906 12.7784598 1.17407218 25.9241226 -0.520486077 -18.0856605 -2.55928387 4.107901 2.86732364 3.95956516 2.94428587 -7.83565275 9.61961007 42.1377421 4.51622475e-06 3.35040307 -6.45308119e-06 -7.58343458 -6.09328248 -16.9098088 -4.47107817e-06 3.7565124 2.93693687e-06 0.000127026346 -1.3795841e-06 0.0010996256 5.87812437e-06 3.09999704 6.19059526e-07 -7.9513867e-15 -6.36110936e-15 4.4139063e-31 0.0867575407 10.0309181 2.3452754 -5.26319059 3.46033946 9.7793139 2.42767352e-06 4.06109953 -3.08199487e-06 -0.173833713 1.48169942e-06 -7.94794681e-07 8.04225515e-06 3.248873 -8.45241096e-07 3.03593946 -9.74861379e-07 0.000340333878 1.72217163e-06 2.63970876 -2.5227572e-06 -6.36110936e-15 -1.59027734e-15 3.18055468e-15 -0.104109183 9.50298023 0.00676779216 2.02668273 -1.76193075 -4.23236685 9.37434926e-06 4.56873751 -9.79924987e-06 -1.10253522 -0.457874253 4.88178027 4.04745486e-07 3.65497494 -6.22627218e-06 3.02538204 -8.43880621e-07 -0.000231487429 6.56328438e-06 2.74124384 2.14881322e-06 0 0 0 -0.0867514238 8.92171001 -2.26744246 6.58147365 -1.89628606 -19.7391629 2.84260566e-06 4.0610981 1.66922936e-06 -0.486551674 3.76683416 6.14800529 2.69776163e-06 3.65499043 -4.2109282e-07 3.01718688 1.77938573e-06 -0.00045187783 -3.79034851e-06 2.74123073 8.99070159e-06 1.90833281e-14 -1.59027734e-15 3.97569335e-16 0.17350249 7.97701931 -4.46721411 8.51424081 -7.98970304 -39.6716641 7.27843511e-06 3.35040712 -9.3553765e-07 -0.785554719 3.70018647 13.7957498 -5.85262889e-06 2.84276485 4.58743125e-06 2.97979259 2.14587796e-06 7.7302866e-05 -7.78088633e-06 2.63970661 -4.94400273e-06 -3.16150795e-06 -1.74386889e-06 -1.18092708e-07 0 0 0 -1.90833281e-14 -1.19270801e-15 -1.59027734e-15 4.00792269e-14 -3.03205474e-15 -9.15536879e-16 1.90833281e-14 6.71097038e-13 -1.42329822e-13 -11.2899361 -5.41907593e-06 4.37811241e-06 -7.07668155 2.47163542 3.16028855 4.06874415e-06 -38.2003288 -0.000216508837 -0.607316985 -2.70656 7.61253046 2.34040795e-06 -39.9008484 -1.7754561e-06 3.293056 -9.93275009 18.1750073 8.32294609e-06 -2.00084855e-06 15.2616587 0.179776728 -0.144318106 -19.1180188 1.13520304e-14 -2.66453526e-15 7.37070894 -2.38541601e-15 6.4605017e-16 -1.98784668e-16 3.77328156e-16 -3.17678035e-15 1.54514225e-15 -2.38541601e-15 -2.88237768e-15 9.44227171e-15 0 0 0 -7.07184084e-35 -2.98177001e-16 2.71775913e-17 11.3156643 5.637718e-06 3.58431043e-06 8.01977485 -5.87145323 2.08529531 0.000396562187 -38.2004128 0.00390832592 -0.763691985 4.29556777 5.75564016 6.99668022e-07 -39.9008179 1.10017036e-05 3.09168718 7.97856932 19.1159935 1.27913745e-06 -6.1466194e-06 15.2616472 -0.677521036 0.48925202 -20.5022413 -2.9873673e-14 9.85322934e-15 7.53999615 1.59027734e-15 4.47265502e-16 3.87630102e-15 -2.25407004e-16 7.51349475e-16 1.59377203e-15 -1.10347657e-32 -3.97569335e-16 3.18055468e-15 0 0 0 -1.59027734e-15 5.46657836e-16 -7.55537037e-16 466 | -------------------------------------------------------------------------------- /resources/Geno_bind.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangeduck/GenoView/e32f504f946b6b3c9881a4efb28bc64d41774ab4/resources/Geno_bind.fbx -------------------------------------------------------------------------------- /resources/Geno_stance.bvh: -------------------------------------------------------------------------------- 1 | HIERARCHY 2 | ROOT Hips 3 | { 4 | OFFSET 0 85.5290222 0 5 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 6 | JOINT Spine 7 | { 8 | OFFSET 2.30099286e-05 8.81424618 -2.08003235 9 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 10 | JOINT Spine1 11 | { 12 | OFFSET 8.7261958e-07 8.84414387 -2.72457055e-06 13 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 14 | JOINT Spine2 15 | { 16 | OFFSET -2.55740429e-06 11.682272 4.31642138e-06 17 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 18 | JOINT Spine3 19 | { 20 | OFFSET 6.59586306e-07 11.7466984 -3.93247592e-06 21 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 22 | JOINT Neck 23 | { 24 | OFFSET 8.48960008e-06 17.6582756 -8.42700974e-05 25 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 26 | JOINT Neck1 27 | { 28 | OFFSET 3.79443094e-07 5.10151863 3.26421036e-06 29 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 30 | JOINT Head 31 | { 32 | OFFSET -9.47953868e-06 5.10151625 8.86555881e-06 33 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 34 | JOINT HeadEnd 35 | { 36 | OFFSET -6.66133815e-16 11.6550846 5.30257262e-14 37 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 38 | End Site 39 | { 40 | OFFSET 0 0 0 41 | } 42 | } 43 | } 44 | } 45 | } 46 | JOINT RightShoulder 47 | { 48 | OFFSET -2.62538743 11.1752224 -4.81263169e-06 49 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 50 | JOINT RightArm 51 | { 52 | OFFSET -1.50603785e-06 10.4347115 1.24267817e-05 53 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 54 | JOINT RightForeArm 55 | { 56 | OFFSET 0.0699771345 25.8717899 -0.536954999 57 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 58 | JOINT RightHand 59 | { 60 | OFFSET 0.298976958 24.8929024 -0.0338061787 61 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 62 | JOINT RightHandThumb1 63 | { 64 | OFFSET -2.86730862 3.95956302 2.94429946 65 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 66 | JOINT RightHandThumb2 67 | { 68 | OFFSET 5.44471732e-06 3.35039091 -6.8817678e-07 69 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 70 | JOINT RightHandThumb3 71 | { 72 | OFFSET -5.18119806e-06 3.75651813 3.88906756e-06 73 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 74 | JOINT RightHandThumb4 75 | { 76 | OFFSET -4.83070948e-07 3.1473465 -1.11636666e-06 77 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 78 | End Site 79 | { 80 | OFFSET 0 0 0 81 | } 82 | } 83 | } 84 | } 85 | } 86 | JOINT RightHandIndex1 87 | { 88 | OFFSET -0.0867566392 10.030899 2.34528232 89 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 90 | JOINT RightHandIndex2 91 | { 92 | OFFSET -3.76662116e-06 4.06108809 3.41322175e-06 93 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 94 | JOINT RightHandIndex3 95 | { 96 | OFFSET 2.12695067e-06 3.2488718 -2.91990204e-06 97 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 98 | JOINT RightHandIndex4 99 | { 100 | OFFSET 1.191156e-07 2.6397078 2.3153757e-06 101 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 102 | End Site 103 | { 104 | OFFSET 0 0 0 105 | } 106 | } 107 | } 108 | } 109 | } 110 | JOINT RightHandMiddle1 111 | { 112 | OFFSET 0.104109198 9.50295544 0.00677696662 113 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 114 | JOINT RightHandMiddle2 115 | { 116 | OFFSET -4.00518725e-07 4.56873274 5.93760979e-06 117 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 118 | JOINT RightHandMiddle3 119 | { 120 | OFFSET 7.54751455e-06 3.6549809 -3.29262275e-06 121 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 122 | JOINT RightHandMiddle4 123 | { 124 | OFFSET -2.47242268e-06 2.74122977 5.72284443e-06 125 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 126 | End Site 127 | { 128 | OFFSET 0 0 0 129 | } 130 | } 131 | } 132 | } 133 | } 134 | JOINT RightHandRing1 135 | { 136 | OFFSET 0.0867536962 8.92171097 -2.26744866 137 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 138 | JOINT RightHandRing2 139 | { 140 | OFFSET -8.49416482e-06 4.06109715 8.33849469e-08 141 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 142 | JOINT RightHandRing3 143 | { 144 | OFFSET -2.69741417e-07 3.65497613 8.0587397e-06 145 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 146 | JOINT RightHandRing4 147 | { 148 | OFFSET -1.7568279e-07 2.74124503 -6.02012506e-07 149 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 150 | End Site 151 | { 152 | OFFSET 0 0 0 153 | } 154 | } 155 | } 156 | } 157 | } 158 | JOINT RightHandPinky1 159 | { 160 | OFFSET -0.173490137 7.97699213 -4.46720457 161 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 162 | JOINT RightHandPinky2 163 | { 164 | OFFSET -5.09637176e-06 3.35040545 -1.14142522e-05 165 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 166 | JOINT RightHandPinky3 167 | { 168 | OFFSET -2.41064344e-06 2.84276104 3.31119764e-07 169 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 170 | JOINT RightHandPinky4 171 | { 172 | OFFSET -4.84227395e-06 2.63970661 4.1988369e-06 173 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 174 | End Site 175 | { 176 | OFFSET 0 0 0 177 | } 178 | } 179 | } 180 | } 181 | } 182 | JOINT RightForeArmEnd 183 | { 184 | OFFSET -2.84217094e-14 -9.28806963e-21 0 185 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 186 | End Site 187 | { 188 | OFFSET 0 0 0 189 | } 190 | } 191 | } 192 | JOINT RightArmEnd 193 | { 194 | OFFSET -5.68434189e-14 -1.85761393e-20 0 195 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 196 | End Site 197 | { 198 | OFFSET 0 0 0 199 | } 200 | } 201 | } 202 | } 203 | } 204 | JOINT LeftShoulder 205 | { 206 | OFFSET 2.62539148 11.1752157 -5.83177598e-06 207 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 208 | JOINT LeftArm 209 | { 210 | OFFSET 5.6675558e-06 10.8136358 -4.22273479e-06 211 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 212 | JOINT LeftForeArm 213 | { 214 | OFFSET 0.495176166 25.5930271 -0.449427605 215 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 216 | JOINT LeftHand 217 | { 218 | OFFSET 1.17407215 25.9241219 -0.520486057 219 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 220 | JOINT LeftHandThumb1 221 | { 222 | OFFSET 2.86732364 3.95956516 2.94428587 223 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 224 | JOINT LeftHandThumb2 225 | { 226 | OFFSET 4.51622463e-06 3.35040307 -6.45308091e-06 227 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 228 | JOINT LeftHandThumb3 229 | { 230 | OFFSET -4.47107823e-06 3.7565124 2.93693711e-06 231 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 232 | JOINT LeftHandThumb4 233 | { 234 | OFFSET 5.8781243e-06 3.09999704 6.19059734e-07 235 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 236 | End Site 237 | { 238 | OFFSET 0 0 0 239 | } 240 | } 241 | } 242 | } 243 | } 244 | JOINT LeftHandIndex1 245 | { 246 | OFFSET 0.0867575407 10.0309181 2.3452754 247 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 248 | JOINT LeftHandIndex2 249 | { 250 | OFFSET 2.4276735e-06 4.06109953 -3.08199469e-06 251 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 252 | JOINT LeftHandIndex3 253 | { 254 | OFFSET 8.04225512e-06 3.248873 -8.45240947e-07 255 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 256 | JOINT LeftHandIndex4 257 | { 258 | OFFSET 1.72217165e-06 2.63970876 -2.52275709e-06 259 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 260 | End Site 261 | { 262 | OFFSET 0 0 0 263 | } 264 | } 265 | } 266 | } 267 | } 268 | JOINT LeftHandMiddle1 269 | { 270 | OFFSET -0.104109183 9.50298023 0.00676779216 271 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 272 | JOINT LeftHandMiddle2 273 | { 274 | OFFSET 9.37434925e-06 4.56873751 -9.79924971e-06 275 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 276 | JOINT LeftHandMiddle3 277 | { 278 | OFFSET 4.04745507e-07 3.65497494 -6.22627203e-06 279 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 280 | JOINT LeftHandMiddle4 281 | { 282 | OFFSET 6.56328438e-06 2.74124384 2.14881334e-06 283 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 284 | End Site 285 | { 286 | OFFSET 0 0 0 287 | } 288 | } 289 | } 290 | } 291 | } 292 | JOINT LeftHandRing1 293 | { 294 | OFFSET -0.0867514238 8.92171001 -2.26744246 295 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 296 | JOINT LeftHandRing2 297 | { 298 | OFFSET 2.84260568e-06 4.0610981 1.66922939e-06 299 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 300 | JOINT LeftHandRing3 301 | { 302 | OFFSET 2.69776161e-06 3.65499043 -4.2109275e-07 303 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 304 | JOINT LeftHandRing4 305 | { 306 | OFFSET -3.79034849e-06 2.74123073 8.99070164e-06 307 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 308 | End Site 309 | { 310 | OFFSET 0 0 0 311 | } 312 | } 313 | } 314 | } 315 | } 316 | JOINT LeftHandPinky1 317 | { 318 | OFFSET 0.17350249 7.97701931 -4.46721411 319 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 320 | JOINT LeftHandPinky2 321 | { 322 | OFFSET 7.27843508e-06 3.35040712 -9.35537742e-07 323 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 324 | JOINT LeftHandPinky3 325 | { 326 | OFFSET -5.85262889e-06 2.84276485 4.58743125e-06 327 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 328 | JOINT LeftHandPinky4 329 | { 330 | OFFSET -7.78088633e-06 2.63970661 -4.94400274e-06 331 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 332 | End Site 333 | { 334 | OFFSET 0 0 0 335 | } 336 | } 337 | } 338 | } 339 | } 340 | JOINT LeftForeArmEnd 341 | { 342 | OFFSET 0 0 0 343 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 344 | End Site 345 | { 346 | OFFSET 0 0 0 347 | } 348 | } 349 | } 350 | JOINT LeftArmEnd 351 | { 352 | OFFSET 2.84217094e-14 -9.28587085e-21 2.02089148e-22 353 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 354 | End Site 355 | { 356 | OFFSET 0 0 0 357 | } 358 | } 359 | } 360 | } 361 | } 362 | } 363 | } 364 | } 365 | } 366 | JOINT RightUpLeg 367 | { 368 | OFFSET -11.2899361 -5.41907593e-06 4.37811241e-06 369 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 370 | JOINT RightLeg 371 | { 372 | OFFSET 4.06874415e-06 -38.2003288 -0.000216508837 373 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 374 | JOINT RightFoot 375 | { 376 | OFFSET 2.34040795e-06 -39.9008484 -1.7754561e-06 377 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 378 | JOINT RightToeBase 379 | { 380 | OFFSET 8.32294609e-06 -2.00084855e-06 15.2616587 381 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 382 | JOINT RightToeBaseEnd 383 | { 384 | OFFSET 1.47451495e-14 5.46958312e-15 7.37070894 385 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 386 | End Site 387 | { 388 | OFFSET 0 0 0 389 | } 390 | } 391 | } 392 | JOINT RightLegEnd 393 | { 394 | OFFSET 2.88750964e-16 -3.2160838e-15 1.48162153e-15 395 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 396 | End Site 397 | { 398 | OFFSET 0 0 0 399 | } 400 | } 401 | } 402 | JOINT RightUpLegEnd 403 | { 404 | OFFSET 0 0 0 405 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 406 | End Site 407 | { 408 | OFFSET 0 0 0 409 | } 410 | } 411 | } 412 | } 413 | JOINT LeftUpLeg 414 | { 415 | OFFSET 11.3156643 5.637718e-06 3.58431043e-06 416 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 417 | JOINT LeftLeg 418 | { 419 | OFFSET 0.000396562187 -38.2004128 0.00390832592 420 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 421 | JOINT LeftFoot 422 | { 423 | OFFSET 6.99668021e-07 -39.9008179 1.10017036e-05 424 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 425 | JOINT LeftToeBase 426 | { 427 | OFFSET 1.27913745e-06 -6.1466194e-06 15.2616472 428 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 429 | JOINT LeftToeBaseEnd 430 | { 431 | OFFSET -3.01633718e-14 9.68322644e-15 7.53999615 432 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 433 | End Site 434 | { 435 | OFFSET 0 0 0 436 | } 437 | } 438 | } 439 | JOINT LeftLegEnd 440 | { 441 | OFFSET -4.05206344e-16 -2.10277095e-15 1.8173528e-15 442 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 443 | End Site 444 | { 445 | OFFSET 0 0 0 446 | } 447 | } 448 | } 449 | JOINT LeftUpLegEnd 450 | { 451 | OFFSET 0 0 0 452 | CHANNELS 6 Xposition Yposition Zposition Zrotation Yrotation Xrotation 453 | End Site 454 | { 455 | OFFSET 0 0 0 456 | } 457 | } 458 | } 459 | } 460 | } 461 | MOTION 462 | Frames: 2 463 | Frame Time: 0.016667 464 | 0 85.5290222 0 0 0 0 2.30099286e-05 8.81424618 -2.08003235 0 0 0 8.7261958e-07 8.84414387 -2.72457055e-06 0 0 0 -2.55740429e-06 11.682272 4.31642138e-06 0 0 0 6.59586306e-07 11.7466984 -3.93247592e-06 0 0 0 8.48960008e-06 17.6582756 -8.42700974e-05 0 0 -0.110968813 3.79443094e-07 5.10151863 3.26421036e-06 0 0 -1.22408808 -9.47953868e-06 5.10151625 8.86555881e-06 0 0 -2.77216129 -6.66133815e-16 11.6550846 5.30257262e-14 0 0 7.9513867e-16 -2.62538743 11.1752224 -4.81263169e-06 89.9999813 0 0 -1.50603785e-06 10.4347115 1.24267817e-05 0 0 0 0.0699771345 25.8717899 -0.536954999 0 0 0 0.298976958 24.8929024 -0.0338061787 0 0 0 -2.86730862 3.95956302 2.94429946 -2.76949014 -5.43271238 47.5254141 5.44471732e-06 3.35039091 -6.8817678e-07 -4.87159348 -2.2063067 -38.8284721 -5.18119806e-06 3.75651813 3.88906756e-06 3.31042972e-32 2.38541601e-15 1.59027734e-15 -4.83070948e-07 3.1473465 -1.11636666e-06 2.75869144e-33 7.9513867e-16 3.97569335e-16 -0.0867566392 10.030899 2.34528232 0 0 0 -3.76662116e-06 4.06108809 3.41322175e-06 0 0 0 2.12695067e-06 3.2488718 -2.91990204e-06 1.47522144e-14 -4.10945574e-07 -0.000106993211 1.191156e-07 2.6397078 2.3153757e-06 -6.42307903e-43 1.21328532e-20 -6.06642662e-21 0.104109198 9.50295544 0.00677696662 0 0 0 -4.00518725e-07 4.56873274 5.93760979e-06 9.98880097e-15 -4.50923517e-06 -1.38540975e-06 7.54751455e-06 3.6549809 -3.29262275e-06 1.00632188e-14 1.81123653e-06 -0.000103195045 -2.47242268e-06 2.74122977 5.72284443e-06 -6.36110936e-15 1.76556925e-31 3.18056681e-15 0.0867536962 8.92171097 -2.26744866 0 0 0 -8.49416482e-06 4.06109715 8.33849469e-08 0 0 0 -2.69741417e-07 3.65497613 8.0587397e-06 1.05242273e-14 1.76895458e-06 6.81751601e-07 -1.7568279e-07 2.74124503 -6.02012506e-07 4.41390663e-32 -6.36110984e-15 -7.9513867e-16 -0.173490137 7.97699213 -4.46720457 0 0 0 -5.09637176e-06 3.35040545 -1.14142522e-05 0 0 0 -2.41064344e-06 2.84276104 3.31119764e-07 2.74397234e-14 1.51178725e-07 1.51240147e-06 -4.84227395e-06 2.63970661 4.1988369e-06 4.41390617e-32 -3.18055478e-15 -1.59027725e-15 -2.84217094e-14 -9.28806963e-21 0 0 0 0 -5.68434189e-14 -1.85761393e-20 0 0 0 0 2.62539148 11.1752157 -5.83177598e-06 -89.9999813 0 0 5.6675558e-06 10.8136358 -4.22273479e-06 -6.36289558e-15 -1.29566528e-16 1.24673581 0.495176166 25.5930271 -0.449427605 -1.72418215e-34 1.98784668e-16 -9.93923338e-17 1.17407215 25.9241219 -0.520486057 3.4483643e-34 -1.98784668e-16 -1.98784668e-16 2.86732364 3.95956516 2.94428587 6.06178311 5.51667996 17.4246965 4.51622463e-06 3.35040307 -6.45308091e-06 -7.58343458 -6.0932827 -16.9098091 -4.47107823e-06 3.7565124 2.93693711e-06 0.000127026346 -1.37958409e-06 0.0010996256 5.8781243e-06 3.09999704 6.19059734e-07 -1.13796022e-32 3.97569335e-16 -3.27994702e-15 0.0867575407 10.0309181 2.3452754 -5.17254644e-34 1.98784668e-16 -2.98177001e-16 2.4276735e-06 4.06109953 -3.08199469e-06 -3.91579797e-15 1.48169943e-06 -7.94794687e-07 8.04225512e-06 3.248873 -8.45240947e-07 1.17144395e-14 -9.7486145e-07 0.000340333878 1.72217165e-06 2.63970876 -2.52275709e-06 8.62091074e-35 9.93923338e-17 9.93923338e-17 -0.104109183 9.50298023 0.00676779216 -5.17254644e-34 1.98784668e-16 -2.98177001e-16 9.37434925e-06 4.56873751 -9.79924971e-06 1.72418215e-34 -1.98784668e-16 -9.93923338e-17 4.04745507e-07 3.65497494 -6.22627203e-06 6.31468792e-15 -8.43880685e-07 -0.000231487429 6.56328438e-06 2.74124384 2.14881334e-06 -1.90833281e-14 -2.98177001e-16 9.93923338e-17 -0.0867514238 8.92171001 -2.26744246 -5.17254644e-34 1.98784668e-16 -2.98177001e-16 2.84260568e-06 4.0610981 1.66922939e-06 1.72418215e-34 -1.98784668e-16 -9.93923338e-17 2.69776161e-06 3.65499043 -4.2109275e-07 -6.84779199e-15 1.77938568e-06 -0.00045187783 -3.79034849e-06 2.74123073 8.99070164e-06 3.4483643e-34 1.98784668e-16 1.98784668e-16 0.17350249 7.97701931 -4.46721411 -5.17254644e-34 1.98784668e-16 -2.98177001e-16 7.27843508e-06 3.35040712 -9.35537742e-07 1.72418215e-34 -1.98784668e-16 -9.93923338e-17 -5.85262889e-06 2.84276485 4.58743125e-06 -9.09601483e-15 2.14587794e-06 7.7302866e-05 -7.78088633e-06 2.63970661 -4.94400274e-06 -3.16150795e-06 -1.74386889e-06 -1.18092714e-07 0 0 0 -5.17254644e-34 1.98784668e-16 -2.98177001e-16 2.84217094e-14 -9.28587085e-21 2.02089148e-22 3.4483643e-34 -1.98784668e-16 -1.98784668e-16 -11.2899361 -5.41907593e-06 4.37811241e-06 0 0 3.16028857 4.06874415e-06 -38.2003288 -0.000216508837 0 0 7.61253023 2.34040795e-06 -39.9008484 -1.7754561e-06 -4.61884462 -0.666406814 13.980683 8.32294609e-06 -2.00084855e-06 15.2616587 0.179776728 -0.144318106 -19.1180188 1.47451495e-14 5.46958312e-15 7.37070894 1.59027734e-15 6.4605017e-16 3.16657763e-15 2.88750964e-16 -3.2160838e-15 1.48162153e-15 -3.31905063e-32 -3.97569335e-16 9.56651213e-15 0 0 0 0 0 0 11.3156643 5.637718e-06 3.58431043e-06 0 0 2.0852952 0.000396562187 -38.2004128 0.00390832592 0 0 5.75564003 6.99668021e-07 -39.9008179 1.10017036e-05 8.5046418 1.51546863 14.4972332 1.27913745e-06 -6.1466194e-06 15.2616472 -0.677521036 0.48925202 -20.5022413 -3.01633718e-14 9.68322644e-15 7.53999615 -1.59027734e-15 6.21202086e-16 1.26725226e-15 -4.05206344e-16 -2.10277095e-15 1.8173528e-15 -3.18055468e-15 9.10368174e-32 3.27994702e-15 0 0 0 0 0 1.59027734e-15 465 | 0 85.5290222 0 0 0 0 2.30099286e-05 8.81424618 -2.08003235 0 0 0 8.7261958e-07 8.84414387 -2.72457055e-06 0 0 0 -2.55740429e-06 11.682272 4.31642138e-06 0 0 0 6.59586306e-07 11.7466984 -3.93247592e-06 0 0 0 8.48960008e-06 17.6582756 -8.42700974e-05 0 0 -0.110968813 3.79443094e-07 5.10151863 3.26421036e-06 0 0 -1.22408808 -9.47953868e-06 5.10151625 8.86555881e-06 0 0 -2.77216129 -6.66133815e-16 11.6550846 5.30257262e-14 0 0 7.9513867e-16 -2.62538743 11.1752224 -4.81263169e-06 89.9999813 0 0 -1.50603785e-06 10.4347115 1.24267817e-05 0 0 0 0.0699771345 25.8717899 -0.536954999 0 0 0 0.298976958 24.8929024 -0.0338061787 0 0 0 -2.86730862 3.95956302 2.94429946 -2.76949014 -5.43271238 47.5254141 5.44471732e-06 3.35039091 -6.8817678e-07 -4.87159348 -2.2063067 -38.8284721 -5.18119806e-06 3.75651813 3.88906756e-06 3.31042972e-32 2.38541601e-15 1.59027734e-15 -4.83070948e-07 3.1473465 -1.11636666e-06 2.75869144e-33 7.9513867e-16 3.97569335e-16 -0.0867566392 10.030899 2.34528232 0 0 0 -3.76662116e-06 4.06108809 3.41322175e-06 0 0 0 2.12695067e-06 3.2488718 -2.91990204e-06 1.47522144e-14 -4.10945574e-07 -0.000106993211 1.191156e-07 2.6397078 2.3153757e-06 -6.42307903e-43 1.21328532e-20 -6.06642662e-21 0.104109198 9.50295544 0.00677696662 0 0 0 -4.00518725e-07 4.56873274 5.93760979e-06 9.98880097e-15 -4.50923517e-06 -1.38540975e-06 7.54751455e-06 3.6549809 -3.29262275e-06 1.00632188e-14 1.81123653e-06 -0.000103195045 -2.47242268e-06 2.74122977 5.72284443e-06 -6.36110936e-15 1.76556925e-31 3.18056681e-15 0.0867536962 8.92171097 -2.26744866 0 0 0 -8.49416482e-06 4.06109715 8.33849469e-08 0 0 0 -2.69741417e-07 3.65497613 8.0587397e-06 1.05242273e-14 1.76895458e-06 6.81751601e-07 -1.7568279e-07 2.74124503 -6.02012506e-07 4.41390663e-32 -6.36110984e-15 -7.9513867e-16 -0.173490137 7.97699213 -4.46720457 0 0 0 -5.09637176e-06 3.35040545 -1.14142522e-05 0 0 0 -2.41064344e-06 2.84276104 3.31119764e-07 2.74397234e-14 1.51178725e-07 1.51240147e-06 -4.84227395e-06 2.63970661 4.1988369e-06 4.41390617e-32 -3.18055478e-15 -1.59027725e-15 -2.84217094e-14 -9.28806963e-21 0 0 0 0 -5.68434189e-14 -1.85761393e-20 0 0 0 0 2.62539148 11.1752157 -5.83177598e-06 -89.9999813 0 0 5.6675558e-06 10.8136358 -4.22273479e-06 -6.36289558e-15 -1.29566528e-16 1.24673581 0.495176166 25.5930271 -0.449427605 -1.72418215e-34 1.98784668e-16 -9.93923338e-17 1.17407215 25.9241219 -0.520486057 3.4483643e-34 -1.98784668e-16 -1.98784668e-16 2.86732364 3.95956516 2.94428587 6.06178311 5.51667996 17.4246965 4.51622463e-06 3.35040307 -6.45308091e-06 -7.58343458 -6.0932827 -16.9098091 -4.47107823e-06 3.7565124 2.93693711e-06 0.000127026346 -1.37958409e-06 0.0010996256 5.8781243e-06 3.09999704 6.19059734e-07 -1.13796022e-32 3.97569335e-16 -3.27994702e-15 0.0867575407 10.0309181 2.3452754 -5.17254644e-34 1.98784668e-16 -2.98177001e-16 2.4276735e-06 4.06109953 -3.08199469e-06 -3.91579797e-15 1.48169943e-06 -7.94794687e-07 8.04225512e-06 3.248873 -8.45240947e-07 1.17144395e-14 -9.7486145e-07 0.000340333878 1.72217165e-06 2.63970876 -2.52275709e-06 8.62091074e-35 9.93923338e-17 9.93923338e-17 -0.104109183 9.50298023 0.00676779216 -5.17254644e-34 1.98784668e-16 -2.98177001e-16 9.37434925e-06 4.56873751 -9.79924971e-06 1.72418215e-34 -1.98784668e-16 -9.93923338e-17 4.04745507e-07 3.65497494 -6.22627203e-06 6.31468792e-15 -8.43880685e-07 -0.000231487429 6.56328438e-06 2.74124384 2.14881334e-06 -1.90833281e-14 -2.98177001e-16 9.93923338e-17 -0.0867514238 8.92171001 -2.26744246 -5.17254644e-34 1.98784668e-16 -2.98177001e-16 2.84260568e-06 4.0610981 1.66922939e-06 1.72418215e-34 -1.98784668e-16 -9.93923338e-17 2.69776161e-06 3.65499043 -4.2109275e-07 -6.84779199e-15 1.77938568e-06 -0.00045187783 -3.79034849e-06 2.74123073 8.99070164e-06 3.4483643e-34 1.98784668e-16 1.98784668e-16 0.17350249 7.97701931 -4.46721411 -5.17254644e-34 1.98784668e-16 -2.98177001e-16 7.27843508e-06 3.35040712 -9.35537742e-07 1.72418215e-34 -1.98784668e-16 -9.93923338e-17 -5.85262889e-06 2.84276485 4.58743125e-06 -9.09601483e-15 2.14587794e-06 7.7302866e-05 -7.78088633e-06 2.63970661 -4.94400274e-06 -3.16150795e-06 -1.74386889e-06 -1.18092714e-07 0 0 0 -5.17254644e-34 1.98784668e-16 -2.98177001e-16 2.84217094e-14 -9.28587085e-21 2.02089148e-22 3.4483643e-34 -1.98784668e-16 -1.98784668e-16 -11.2899361 -5.41907593e-06 4.37811241e-06 0 0 3.16028857 4.06874415e-06 -38.2003288 -0.000216508837 0 0 7.61253023 2.34040795e-06 -39.9008484 -1.7754561e-06 -4.61884462 -0.666406814 13.980683 8.32294609e-06 -2.00084855e-06 15.2616587 0.179776728 -0.144318106 -19.1180188 1.47451495e-14 5.46958312e-15 7.37070894 1.59027734e-15 6.4605017e-16 3.16657763e-15 2.88750964e-16 -3.2160838e-15 1.48162153e-15 -3.31905063e-32 -3.97569335e-16 9.56651213e-15 0 0 0 0 0 0 11.3156643 5.637718e-06 3.58431043e-06 0 0 2.0852952 0.000396562187 -38.2004128 0.00390832592 0 0 5.75564003 6.99668021e-07 -39.9008179 1.10017036e-05 8.5046418 1.51546863 14.4972332 1.27913745e-06 -6.1466194e-06 15.2616472 -0.677521036 0.48925202 -20.5022413 -3.01633718e-14 9.68322644e-15 7.53999615 -1.59027734e-15 6.21202086e-16 1.26725226e-15 -4.05206344e-16 -2.10277095e-15 1.8173528e-15 -3.18055468e-15 9.10368174e-32 3.27994702e-15 0 0 0 0 0 1.59027734e-15 466 | -------------------------------------------------------------------------------- /resources/Geno_stance.fbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orangeduck/GenoView/e32f504f946b6b3c9881a4efb28bc64d41774ab4/resources/Geno_stance.fbx -------------------------------------------------------------------------------- /resources/basic.fs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | precision highp float; 3 | 4 | in vec3 fragPosition; 5 | in vec2 fragTexCoord; 6 | in vec4 fragColor; 7 | in vec3 fragNormal; 8 | 9 | uniform vec4 colDiffuse; 10 | uniform float specularity; 11 | uniform float glossiness; 12 | uniform float camClipNear; 13 | uniform float camClipFar; 14 | 15 | layout (location = 0) out vec4 gbufferColor; 16 | layout (location = 1) out vec4 gbufferNormal; 17 | 18 | float Grid(in vec2 uv, in float lineWidth) 19 | { 20 | vec4 uvDDXY = vec4(dFdx(uv), dFdy(uv)); 21 | vec2 uvDeriv = vec2(length(uvDDXY.xz), length(uvDDXY.yw)); 22 | float targetWidth = lineWidth > 0.5 ? 1.0 - lineWidth : lineWidth; 23 | vec2 drawWidth = clamp( 24 | vec2(targetWidth, targetWidth), uvDeriv, vec2(0.5, 0.5)); 25 | vec2 lineAA = uvDeriv * 1.5; 26 | vec2 gridUV = abs(fract(uv) * 2.0 - 1.0); 27 | gridUV = lineWidth > 0.5 ? gridUV : 1.0 - gridUV; 28 | vec2 g2 = smoothstep(drawWidth + lineAA, drawWidth - lineAA, gridUV); 29 | g2 *= clamp(targetWidth / drawWidth, 0.0, 1.0); 30 | g2 = mix(g2, vec2(targetWidth, targetWidth), 31 | clamp(uvDeriv * 2.0 - 1.0, 0.0, 1.0)); 32 | g2 = lineWidth > 0.5 ? 1.0 - g2 : g2; 33 | return mix(g2.x, 1.0, g2.y); 34 | } 35 | 36 | float Checker(in vec2 uv) 37 | { 38 | vec4 uvDDXY = vec4(dFdx(uv), dFdy(uv)); 39 | vec2 w = vec2(length(uvDDXY.xz), length(uvDDXY.yw)); 40 | vec2 i = 2.0*(abs(fract((uv-0.5*w)*0.5)-0.5)- 41 | abs(fract((uv+0.5*w)*0.5)-0.5))/w; 42 | return 0.5 - 0.5*i.x*i.y; 43 | } 44 | 45 | vec3 FromGamma(in vec3 col) 46 | { 47 | return vec3(pow(col.x, 1.0/2.2), pow(col.y, 1.0/2.2), pow(col.z, 1.0/2.2)); 48 | } 49 | 50 | float LinearDepth(float depth, float near, float far) 51 | { 52 | return (2.0 * near) / (far + near - depth * (far - near)); 53 | } 54 | 55 | void main() 56 | { 57 | float gridFine = Grid(20.0 * 10.0 * fragTexCoord, 0.025); 58 | float gridCoarse = Grid(2.0 * 10.0 * fragTexCoord, 0.02); 59 | float check = Checker(2.0 * 10.0 * fragTexCoord); 60 | 61 | vec3 albedo = FromGamma(fragColor.xyz * colDiffuse.xyz) * mix(mix(mix(0.9, 0.95, check), 0.85, gridFine), 1.0, gridCoarse); 62 | float spec = specularity * mix(mix(0.5, 0.75, check), 1.0, gridCoarse); 63 | 64 | gbufferColor = vec4(albedo, spec); 65 | gbufferNormal = vec4(fragNormal * 0.5f + 0.5f, glossiness / 100.0f); 66 | gl_FragDepth = LinearDepth(gl_FragCoord.z, camClipNear, camClipFar); 67 | } 68 | -------------------------------------------------------------------------------- /resources/basic.vs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | in vec3 vertexPosition; 4 | in vec2 vertexTexCoord; 5 | in vec3 vertexNormal; 6 | in vec4 vertexColor; 7 | 8 | uniform mat4 mvp; 9 | 10 | out vec3 fragPosition; 11 | out vec2 fragTexCoord; 12 | out vec4 fragColor; 13 | out vec3 fragNormal; 14 | 15 | void main() 16 | { 17 | fragPosition = vertexPosition; 18 | fragTexCoord = vertexTexCoord; 19 | fragColor = vertexColor; 20 | fragNormal = vertexNormal; 21 | 22 | gl_Position = mvp * vec4(fragPosition, 1.0f); 23 | } 24 | -------------------------------------------------------------------------------- /resources/blur.fs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | precision highp float; 3 | 4 | in vec2 fragTexCoord; 5 | 6 | uniform sampler2D gbufferNormal; 7 | uniform sampler2D gbufferDepth; 8 | uniform sampler2D inputTexture; 9 | uniform mat4 camInvProj; 10 | uniform float camClipNear; 11 | uniform float camClipFar; 12 | uniform vec2 invTextureResolution; 13 | uniform vec2 blurDirection; 14 | 15 | float NonlinearDepth(float depth, float near, float far) 16 | { 17 | return (((2.0 * near) / depth) - far - near) / (near - far); 18 | } 19 | 20 | vec3 CameraSpace(vec2 texcoord, float depth) 21 | { 22 | vec4 positionClip = vec4(vec3(texcoord, NonlinearDepth(depth, camClipNear, camClipFar)) * 2.0 - 1.0, 1.0); 23 | vec4 position = camInvProj * positionClip; 24 | return position.xyz / position.w; 25 | } 26 | 27 | float FastNegExp(float x) 28 | { 29 | return 1.0f / (1.0f + x + 0.48f*x*x + 0.235f*x*x*x); 30 | } 31 | 32 | out vec4 finalColor; 33 | 34 | void main() 35 | { 36 | float depth = texture(gbufferDepth, fragTexCoord).r; 37 | if (depth == 1.0f) { discard; } 38 | 39 | vec3 baseNormal = texture(gbufferNormal, fragTexCoord).rgb * 2.0f - 1.0f; 40 | vec3 basePosition = CameraSpace(fragTexCoord, depth); 41 | 42 | vec4 totalColor = vec4(0.0f, 0.0f, 0.0f, 0.0f); 43 | float totalWeight = 0.0f; 44 | float stride = 2.0f; 45 | 46 | for (int x = -3; x <= 3; x++) 47 | { 48 | vec2 sampleTexcoord = fragTexCoord + float(x) * stride * blurDirection * invTextureResolution; 49 | vec4 sampleColour = texture(inputTexture, sampleTexcoord); 50 | vec3 sampleNormal = texture(gbufferNormal, sampleTexcoord).rgb * 2.0f - 1.0f; 51 | vec3 samplePosition = CameraSpace(sampleTexcoord, texture(gbufferDepth, sampleTexcoord).r); 52 | 53 | vec3 diffPosition = (samplePosition - basePosition) / 0.05f; 54 | 55 | float weightPosition = FastNegExp(dot(diffPosition, diffPosition)); 56 | float weightNormal = max(dot(sampleNormal, baseNormal), 0.0f); 57 | 58 | float weight = weightPosition * weightNormal; 59 | 60 | totalColor += weight * sampleColour; 61 | totalWeight += weight; 62 | } 63 | 64 | finalColor = totalColor / totalWeight; 65 | 66 | //finalColor = texture(inputTexture, fragTexCoord); 67 | } 68 | -------------------------------------------------------------------------------- /resources/bvh.py: -------------------------------------------------------------------------------- 1 | import re, os, ntpath 2 | import numpy as np 3 | 4 | channelmap = { 5 | 'Xrotation': 'x', 6 | 'Yrotation': 'y', 7 | 'Zrotation': 'z' 8 | } 9 | 10 | channelmap_inv = { 11 | 'x': 'Xrotation', 12 | 'y': 'Yrotation', 13 | 'z': 'Zrotation', 14 | } 15 | 16 | ordermap = { 17 | 'x': 0, 18 | 'y': 1, 19 | 'z': 2, 20 | } 21 | 22 | def load(filename, order=None): 23 | 24 | f = open(filename, "r") 25 | 26 | i = 0 27 | active = -1 28 | end_site = False 29 | 30 | names = [] 31 | orients = np.array([]).reshape((0, 4)) 32 | offsets = np.array([]).reshape((0, 3)) 33 | parents = np.array([], dtype=int) 34 | 35 | # Parse the file, line by line 36 | for line in f: 37 | 38 | if "HIERARCHY" in line: continue 39 | if "MOTION" in line: continue 40 | 41 | rmatch = re.match(r"ROOT (\w+)", line) 42 | if rmatch: 43 | names.append(rmatch.group(1)) 44 | offsets = np.append(offsets, np.array([[0, 0, 0]]), axis=0) 45 | orients = np.append(orients, np.array([[1, 0, 0, 0]]), axis=0) 46 | parents = np.append(parents, active) 47 | active = (len(parents) - 1) 48 | continue 49 | 50 | if "{" in line: continue 51 | 52 | if "}" in line: 53 | if end_site: 54 | end_site = False 55 | else: 56 | active = parents[active] 57 | continue 58 | 59 | offmatch = re.match(r"\s*OFFSET\s+([\-\d\.e]+)\s+([\-\d\.e]+)\s+([\-\d\.e]+)", line) 60 | if offmatch: 61 | if not end_site: 62 | offsets[active] = np.array([list(map(float, offmatch.groups()))]) 63 | continue 64 | 65 | chanmatch = re.match(r"\s*CHANNELS\s+(\d+)", line) 66 | if chanmatch: 67 | channels = int(chanmatch.group(1)) 68 | if order is None: 69 | channelis = 0 if channels == 3 else 3 70 | channelie = 3 if channels == 3 else 6 71 | parts = line.split()[2 + channelis:2 + channelie] 72 | if any([p not in channelmap for p in parts]): 73 | continue 74 | order = "".join([channelmap[p] for p in parts]) 75 | continue 76 | 77 | jmatch = re.match("\s*JOINT\s+(\w+)", line) 78 | if jmatch: 79 | names.append(jmatch.group(1)) 80 | offsets = np.append(offsets, np.array([[0, 0, 0]]), axis=0) 81 | orients = np.append(orients, np.array([[1, 0, 0, 0]]), axis=0) 82 | parents = np.append(parents, active) 83 | active = (len(parents) - 1) 84 | continue 85 | 86 | if "End Site" in line: 87 | end_site = True 88 | continue 89 | 90 | fmatch = re.match("\s*Frames:\s+(\d+)", line) 91 | if fmatch: 92 | fnum = int(fmatch.group(1)) 93 | positions = offsets[np.newaxis].repeat(fnum, axis=0) 94 | rotations = np.zeros((fnum, len(orients), 3)) 95 | continue 96 | 97 | fmatch = re.match("\s*Frame Time:\s+([\d\.]+)", line) 98 | if fmatch: 99 | frametime = float(fmatch.group(1)) 100 | continue 101 | 102 | dmatch = line.strip().split(' ') 103 | if dmatch: 104 | data_block = np.array(list(map(float, dmatch))) 105 | N = len(parents) 106 | fi = i 107 | if channels == 3: 108 | positions[fi, 0:1] = data_block[0:3] 109 | rotations[fi, :] = data_block[3:].reshape(N, 3) 110 | elif channels == 6: 111 | data_block = data_block.reshape(N, 6) 112 | positions[fi, :] = data_block[:, 0:3] 113 | rotations[fi, :] = data_block[:, 3:6] 114 | elif channels == 9: 115 | positions[fi, 0] = data_block[0:3] 116 | data_block = data_block[3:].reshape(N - 1, 9) 117 | rotations[fi, 1:] = data_block[:, 3:6] 118 | positions[fi, 1:] += data_block[:, 0:3] * data_block[:, 6:9] 119 | else: 120 | raise Exception("Too many channels! %i" % channels) 121 | 122 | i += 1 123 | 124 | f.close() 125 | 126 | return { 127 | 'rotations': rotations, 128 | 'positions': positions, 129 | 'offsets': offsets, 130 | 'parents': parents, 131 | 'names': names, 132 | 'order': order 133 | } 134 | 135 | 136 | def save_joint(f, data, t, i, save_order, order='zyx', save_positions=False): 137 | 138 | save_order.append(i) 139 | 140 | f.write("%sJOINT %s\n" % (t, data['names'][i])) 141 | f.write("%s{\n" % t) 142 | t += '\t' 143 | 144 | f.write("%sOFFSET %f %f %f\n" % (t, data['offsets'][i,0], data['offsets'][i,1], data['offsets'][i,2])) 145 | 146 | if save_positions: 147 | f.write("%sCHANNELS 6 Xposition Yposition Zposition %s %s %s \n" % (t, 148 | channelmap_inv[order[0]], channelmap_inv[order[1]], channelmap_inv[order[2]])) 149 | else: 150 | f.write("%sCHANNELS 3 %s %s %s\n" % (t, 151 | channelmap_inv[order[0]], channelmap_inv[order[1]], channelmap_inv[order[2]])) 152 | 153 | end_site = True 154 | 155 | for j in range(len(data['parents'])): 156 | if data['parents'][j] == i: 157 | t = save_joint(f, data, t, j, save_order, order=order, save_positions=save_positions) 158 | end_site = False 159 | 160 | if end_site: 161 | f.write("%sEnd Site\n" % t) 162 | f.write("%s{\n" % t) 163 | t += '\t' 164 | f.write("%sOFFSET %f %f %f\n" % (t, 0.0, 0.0, 0.0)) 165 | t = t[:-1] 166 | f.write("%s}\n" % t) 167 | 168 | t = t[:-1] 169 | f.write("%s}\n" % t) 170 | 171 | return t 172 | 173 | 174 | def save(filename, data, frametime=1.0/60.0, save_positions=False): 175 | 176 | order = data['order'] 177 | 178 | with open(filename, 'w') as f: 179 | 180 | t = "" 181 | f.write("%sHIERARCHY\n" % t) 182 | f.write("%sROOT %s\n" % (t, data['names'][0])) 183 | f.write("%s{\n" % t) 184 | t += '\t' 185 | 186 | f.write("%sOFFSET %f %f %f\n" % (t, data['offsets'][0,0], data['offsets'][0,1], data['offsets'][0,2]) ) 187 | f.write("%sCHANNELS 6 Xposition Yposition Zposition %s %s %s \n" % 188 | (t, channelmap_inv[order[0]], channelmap_inv[order[1]], channelmap_inv[order[2]])) 189 | 190 | save_order = [0] 191 | 192 | for i in range(len(data['parents'])): 193 | if data['parents'][i] == 0: 194 | t = save_joint(f, data, t, i, save_order, order=order, save_positions=save_positions) 195 | 196 | t = t[:-1] 197 | f.write("%s}\n" % t) 198 | 199 | rots, poss = data['rotations'], data['positions'] 200 | 201 | f.write("MOTION\n") 202 | f.write("Frames: %i\n" % len(rots)); 203 | f.write("Frame Time: %f\n" % frametime); 204 | 205 | for i in range(rots.shape[0]): 206 | for j in save_order: 207 | 208 | if save_positions or j == 0: 209 | 210 | f.write("%f %f %f %f %f %f " % ( 211 | poss[i,j,0], poss[i,j,1], poss[i,j,2], 212 | rots[i,j,ordermap[order[0]]], rots[i,j,ordermap[order[1]]], rots[i,j,ordermap[order[2]]])) 213 | 214 | else: 215 | 216 | f.write("%f %f %f " % ( 217 | rots[i,j,ordermap[order[0]]], rots[i,j,ordermap[order[1]]], rots[i,j,ordermap[order[2]]])) 218 | 219 | f.write("\n") 220 | 221 | 222 | 223 | -------------------------------------------------------------------------------- /resources/export_animations.py: -------------------------------------------------------------------------------- 1 | import struct 2 | import numpy as np 3 | import bvh 4 | import quat 5 | 6 | bvh_files = [ 7 | 'ground1_subject1.bvh', 8 | 'ground2_subject2.bvh', 9 | 'kthstreet_gPO_sFM_cAll_d02_mPO_ch01_atombounce_001.bvh', 10 | ] 11 | 12 | joints = [ 13 | 'Hips', 14 | 'Spine', 15 | 'Spine1', 16 | 'Spine2', 17 | 'Spine3', 18 | 'Neck', 19 | 'Neck1', 20 | 'Head', 21 | 'HeadEnd', 22 | 'RightShoulder', 23 | 'RightArm', 24 | 'RightForeArm', 25 | 'RightHand', 26 | 'RightHandThumb1', 27 | 'RightHandThumb2', 28 | 'RightHandThumb3', 29 | 'RightHandThumb4', 30 | 'RightHandIndex1', 31 | 'RightHandIndex2', 32 | 'RightHandIndex3', 33 | 'RightHandIndex4', 34 | 'RightHandMiddle1', 35 | 'RightHandMiddle2', 36 | 'RightHandMiddle3', 37 | 'RightHandMiddle4', 38 | 'RightHandRing1', 39 | 'RightHandRing2', 40 | 'RightHandRing3', 41 | 'RightHandRing4', 42 | 'RightHandPinky1', 43 | 'RightHandPinky2', 44 | 'RightHandPinky3', 45 | 'RightHandPinky4', 46 | 'RightForeArmEnd', 47 | 'RightArmEnd', 48 | 'LeftShoulder', 49 | 'LeftArm', 50 | 'LeftForeArm', 51 | 'LeftHand', 52 | 'LeftHandThumb1', 53 | 'LeftHandThumb2', 54 | 'LeftHandThumb3', 55 | 'LeftHandThumb4', 56 | 'LeftHandIndex1', 57 | 'LeftHandIndex2', 58 | 'LeftHandIndex3', 59 | 'LeftHandIndex4', 60 | 'LeftHandMiddle1', 61 | 'LeftHandMiddle2', 62 | 'LeftHandMiddle3', 63 | 'LeftHandMiddle4', 64 | 'LeftHandRing1', 65 | 'LeftHandRing2', 66 | 'LeftHandRing3', 67 | 'LeftHandRing4', 68 | 'LeftHandPinky1', 69 | 'LeftHandPinky2', 70 | 'LeftHandPinky3', 71 | 'LeftHandPinky4', 72 | 'LeftForeArmEnd', 73 | 'LeftArmEnd', 74 | 'RightUpLeg', 75 | 'RightLeg', 76 | 'RightFoot', 77 | 'RightToeBase', 78 | 'RightToeBaseEnd', 79 | 'RightLegEnd', 80 | 'RightUpLegEnd', 81 | 'LeftUpLeg', 82 | 'LeftLeg', 83 | 'LeftFoot', 84 | 'LeftToeBase', 85 | 'LeftToeBaseEnd', 86 | 'LeftLegEnd', 87 | 'LeftUpLegEnd', 88 | ] 89 | 90 | for bvh_file in bvh_files: 91 | 92 | bvh_data = bvh.load(bvh_file) 93 | 94 | positions = bvh_data['positions'].copy() 95 | parents = bvh_data['parents'].copy() 96 | names = bvh_data['names'].copy() 97 | rotations = quat.unroll(quat.from_euler(np.radians(bvh_data['rotations']), order=bvh_data['order'])) 98 | rotations, positions = quat.fk(rotations, positions, parents) 99 | 100 | assert names == joints 101 | 102 | # Swap order 103 | rotations = np.concatenate([ 104 | rotations[...,1:2], 105 | rotations[...,2:3], 106 | rotations[...,3:4], 107 | rotations[...,0:1], 108 | ], axis=-1).astype(np.float32) 109 | 110 | # Convert from cm to m 111 | positions = (0.01 * positions).astype(np.float32) 112 | 113 | with open(bvh_file.replace('.bvh', '.bin'), 'wb') as f: 114 | 115 | nframes = positions.shape[0] 116 | nbones = positions.shape[1] 117 | 118 | f.write(struct.pack('ii', nframes, nbones)) 119 | 120 | for i in range(nbones): 121 | f.write(struct.pack('32si', bytes(names[i], encoding='ascii'), parents[i])) 122 | 123 | for i in range(nframes): 124 | for j in range(nbones): 125 | f.write(struct.pack('ffffffffff', 126 | positions[i,j,0], positions[i,j,1], positions[i,j,2], 127 | rotations[i,j,0], rotations[i,j,1], rotations[i,j,2], rotations[i,j,3], 128 | 1.0, 1.0, 1.0 129 | )) 130 | 131 | f.write(struct.pack('32s', bytes(bvh_file.replace('.bvh',''), encoding='ascii')[:31])) 132 | -------------------------------------------------------------------------------- /resources/export_geno.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pymel.core as pm 3 | import struct 4 | 5 | def quat_from_xform(ts, eps=1e-10): 6 | qs = np.empty_like(ts[..., :1, 0].repeat(4, axis=-1)) 7 | 8 | t = ts[..., 0, 0] + ts[..., 1, 1] + ts[..., 2, 2] 9 | 10 | s = 0.5 / np.sqrt(np.maximum(t + 1, eps)) 11 | qs = np.where((t > 0)[..., np.newaxis].repeat(4, axis=-1), np.concatenate([ 12 | (0.25 / s)[..., np.newaxis], 13 | (s * (ts[..., 2, 1] - ts[..., 1, 2]))[..., np.newaxis], 14 | (s * (ts[..., 0, 2] - ts[..., 2, 0]))[..., np.newaxis], 15 | (s * (ts[..., 1, 0] - ts[..., 0, 1]))[..., np.newaxis] 16 | ], axis=-1), qs) 17 | 18 | c0 = (ts[..., 0, 0] > ts[..., 1, 1]) & (ts[..., 0, 0] > ts[..., 2, 2]) 19 | s0 = 2.0 * np.sqrt(np.maximum(1.0 + ts[..., 0, 0] - ts[..., 1, 1] - ts[..., 2, 2], eps)) 20 | qs = np.where(((t <= 0) & c0)[..., np.newaxis].repeat(4, axis=-1), np.concatenate([ 21 | ((ts[..., 2, 1] - ts[..., 1, 2]) / s0)[..., np.newaxis], 22 | (s0 * 0.25)[..., np.newaxis], 23 | ((ts[..., 0, 1] + ts[..., 1, 0]) / s0)[..., np.newaxis], 24 | ((ts[..., 0, 2] + ts[..., 2, 0]) / s0)[..., np.newaxis] 25 | ], axis=-1), qs) 26 | 27 | c1 = (~c0) & (ts[..., 1, 1] > ts[..., 2, 2]) 28 | s1 = 2.0 * np.sqrt(np.maximum(1.0 + ts[..., 1, 1] - ts[..., 0, 0] - ts[..., 2, 2], eps)) 29 | qs = np.where(((t <= 0) & c1)[..., np.newaxis].repeat(4, axis=-1), np.concatenate([ 30 | ((ts[..., 0, 2] - ts[..., 2, 0]) / s1)[..., np.newaxis], 31 | ((ts[..., 0, 1] + ts[..., 1, 0]) / s1)[..., np.newaxis], 32 | (s1 * 0.25)[..., np.newaxis], 33 | ((ts[..., 1, 2] + ts[..., 2, 1]) / s1)[..., np.newaxis] 34 | ], axis=-1), qs) 35 | 36 | c2 = (~c0) & (~c1) 37 | s2 = 2.0 * np.sqrt(np.maximum(1.0 + ts[..., 2, 2] - ts[..., 0, 0] - ts[..., 1, 1], eps)) 38 | qs = np.where(((t <= 0) & c2)[..., np.newaxis].repeat(4, axis=-1), np.concatenate([ 39 | ((ts[..., 1, 0] - ts[..., 0, 1]) / s2)[..., np.newaxis], 40 | ((ts[..., 0, 2] + ts[..., 2, 0]) / s2)[..., np.newaxis], 41 | ((ts[..., 1, 2] + ts[..., 2, 1]) / s2)[..., np.newaxis], 42 | (s2 * 0.25)[..., np.newaxis] 43 | ], axis=-1), qs) 44 | 45 | return qs 46 | 47 | geno = pm.PyNode('GenoShape') 48 | pm.polyTriangulate(geno) 49 | 50 | joints = [ 51 | 'Hips', 52 | 'Spine', 53 | 'Spine1', 54 | 'Spine2', 55 | 'Spine3', 56 | 'Neck', 57 | 'Neck1', 58 | 'Head', 59 | 'HeadEnd', 60 | 'RightShoulder', 61 | 'RightArm', 62 | 'RightForeArm', 63 | 'RightHand', 64 | 'RightHandThumb1', 65 | 'RightHandThumb2', 66 | 'RightHandThumb3', 67 | 'RightHandThumb4', 68 | 'RightHandIndex1', 69 | 'RightHandIndex2', 70 | 'RightHandIndex3', 71 | 'RightHandIndex4', 72 | 'RightHandMiddle1', 73 | 'RightHandMiddle2', 74 | 'RightHandMiddle3', 75 | 'RightHandMiddle4', 76 | 'RightHandRing1', 77 | 'RightHandRing2', 78 | 'RightHandRing3', 79 | 'RightHandRing4', 80 | 'RightHandPinky1', 81 | 'RightHandPinky2', 82 | 'RightHandPinky3', 83 | 'RightHandPinky4', 84 | 'RightForeArmEnd', 85 | 'RightArmEnd', 86 | 'LeftShoulder', 87 | 'LeftArm', 88 | 'LeftForeArm', 89 | 'LeftHand', 90 | 'LeftHandThumb1', 91 | 'LeftHandThumb2', 92 | 'LeftHandThumb3', 93 | 'LeftHandThumb4', 94 | 'LeftHandIndex1', 95 | 'LeftHandIndex2', 96 | 'LeftHandIndex3', 97 | 'LeftHandIndex4', 98 | 'LeftHandMiddle1', 99 | 'LeftHandMiddle2', 100 | 'LeftHandMiddle3', 101 | 'LeftHandMiddle4', 102 | 'LeftHandRing1', 103 | 'LeftHandRing2', 104 | 'LeftHandRing3', 105 | 'LeftHandRing4', 106 | 'LeftHandPinky1', 107 | 'LeftHandPinky2', 108 | 'LeftHandPinky3', 109 | 'LeftHandPinky4', 110 | 'LeftForeArmEnd', 111 | 'LeftArmEnd', 112 | 'RightUpLeg', 113 | 'RightLeg', 114 | 'RightFoot', 115 | 'RightToeBase', 116 | 'RightToeBaseEnd', 117 | 'RightLegEnd', 118 | 'RightUpLegEnd', 119 | 'LeftUpLeg', 120 | 'LeftLeg', 121 | 'LeftFoot', 122 | 'LeftToeBase', 123 | 'LeftToeBaseEnd', 124 | 'LeftLegEnd', 125 | 'LeftUpLegEnd', 126 | ] 127 | 128 | joint_nodes = [pm.PyNode(n) for n in joints] 129 | 130 | parents = np.asarray([ 131 | joints.index(str(j.getParent().getName())) if j.getParent() else -1 132 | for j in joint_nodes 133 | ]) 134 | 135 | print(parents) 136 | 137 | skinning = pm.PyNode('skinCluster1') 138 | 139 | influences = skinning.influenceObjects() 140 | influence_index = np.asarray([joints.index(node.getName()) for node in influences]) 141 | print(influence_index) 142 | 143 | weights_all = np.asarray(list(skinning.getWeights('GenoShape'))) 144 | weights_order = weights_all.argsort(axis=1)[:,::-1] 145 | vert_bone_weis = np.zeros([len(weights_all), 4], dtype=np.float32) 146 | vert_bone_inds = np.zeros([len(weights_all), 4], dtype=np.uint8) 147 | for i in range(len(weights_all)): 148 | vert_bone_inds[i] = influence_index[weights_order[i,:4]] 149 | vert_bone_weis[i] = weights_all[i,weights_order[i,:4]] 150 | vert_bone_weis[i] = vert_bone_weis[i] / np.sum(vert_bone_weis[i]) 151 | vert_bone_inds[i][vert_bone_weis[i] == 0.0] = 0 152 | 153 | print(vert_bone_inds.shape, vert_bone_inds) 154 | print(vert_bone_weis.shape, vert_bone_weis) 155 | 156 | 157 | vert_posns = np.asarray(geno.getPoints(space='world')) 158 | vert_norms = np.asarray(geno.getNormals(space='world')) 159 | vert_uvs = np.asarray(geno.getUVs()).T 160 | 161 | print(vert_norms.shape) 162 | print(vert_posns.shape) 163 | print(vert_uvs.shape) 164 | 165 | tris_posns_num, tris_posns = geno.getTriangles() 166 | tris_posns_num, tris_posns = np.asarray(tris_posns_num), np.asarray(tris_posns) 167 | assert np.all(tris_posns_num == 1) 168 | tris_posns = tris_posns.reshape([-1, 3]) 169 | 170 | tris_uvs_num, tris_uvs = geno.getAssignedUVs() 171 | tris_uvs_num, tris_uvs = np.asarray(tris_uvs_num), np.asarray(tris_uvs) 172 | assert np.all(tris_uvs_num == 3) 173 | tris_uvs = tris_uvs.reshape([-1, 3]) 174 | 175 | tris_norms_num, tris_norms = geno.getNormalIds() 176 | tris_norms_num, tris_norms = np.asarray(tris_norms_num), np.asarray(tris_norms) 177 | assert np.all(tris_norms_num == 3) 178 | tris_norms = tris_norms.reshape([-1, 3]) 179 | 180 | print(tris_posns.shape) 181 | print(tris_uvs.shape) 182 | print(tris_norms.shape) 183 | 184 | tri_num = len(tris_posns) 185 | 186 | assert tri_num == len(tris_posns) 187 | assert tri_num == len(tris_norms) 188 | assert tri_num == len(tris_uvs) 189 | 190 | vert_map = {} 191 | final_tris = [] 192 | final_posns = [] 193 | final_norms = [] 194 | final_uvs = [] 195 | final_bone_inds = [] 196 | final_bone_weis = [] 197 | 198 | for t in range(tri_num): 199 | 200 | pi0, pi1, pi2 = tris_posns[t] 201 | ni0, ni1, ni2 = tris_norms[t] 202 | ui0, ui1, ui2 = tris_uvs[t] 203 | 204 | p0, p1, p2 = vert_posns[pi0], vert_posns[pi1], vert_posns[pi2] 205 | n0, n1, n2 = vert_norms[ni0], vert_norms[ni1], vert_norms[ni2] 206 | u0, u1, u2 = vert_uvs[ui0], vert_uvs[ui1], vert_uvs[ui2] 207 | bi0, bi1, bi2 = vert_bone_inds[pi0], vert_bone_inds[pi1], vert_bone_inds[pi2] 208 | bw0, bw1, bw2 = vert_bone_weis[pi0], vert_bone_weis[pi1], vert_bone_weis[pi2] 209 | 210 | vert0 = (tuple(p0), tuple(n0), tuple(u0), tuple(bi0), tuple(bw0)) 211 | vert1 = (tuple(p1), tuple(n1), tuple(u1), tuple(bi1), tuple(bw1)) 212 | vert2 = (tuple(p2), tuple(n2), tuple(u2), tuple(bi2), tuple(bw2)) 213 | 214 | if vert0 in vert_map: 215 | i0 = vert_map[vert0] 216 | else: 217 | i0 = len(final_posns) 218 | vert_map[vert0] = i0 219 | final_posns.append(p0) 220 | final_norms.append(n0) 221 | final_uvs.append(u0) 222 | final_bone_inds.append(bi0) 223 | final_bone_weis.append(bw0) 224 | 225 | if vert1 in vert_map: 226 | i1 = vert_map[vert1] 227 | else: 228 | i1 = len(final_posns) 229 | vert_map[vert1] = i1 230 | final_posns.append(p1) 231 | final_norms.append(n1) 232 | final_uvs.append(u1) 233 | final_bone_inds.append(bi1) 234 | final_bone_weis.append(bw1) 235 | 236 | if vert2 in vert_map: 237 | i2 = vert_map[vert2] 238 | else: 239 | i2 = len(final_posns) 240 | vert_map[vert2] = i2 241 | final_posns.append(p2) 242 | final_norms.append(n2) 243 | final_uvs.append(u2) 244 | final_bone_inds.append(bi2) 245 | final_bone_weis.append(bw2) 246 | 247 | final_tris.append((i0, i1, i2)) 248 | 249 | final_tris = np.asarray(final_tris).astype(np.uint16) 250 | final_posns = np.asarray(final_posns).astype(np.float32) 251 | final_norms = np.asarray(final_norms).astype(np.float32) 252 | final_uvs = np.asarray(final_uvs).astype(np.float32) 253 | final_bone_inds = np.asarray(final_bone_inds).astype(np.uint8) 254 | final_bone_weis = np.asarray(final_bone_weis).astype(np.float32) 255 | 256 | print(final_tris.shape, final_tris[:10]) 257 | print(final_posns.shape, final_posns[:10]) 258 | print(final_norms.shape, final_norms[:10]) 259 | print(final_uvs.shape, final_uvs[:10]) 260 | print(final_bone_inds.shape, final_bone_inds[:10]) 261 | print(final_bone_weis.shape, final_bone_weis[:10]) 262 | 263 | bone_xforms = np.asarray([pm.xform(j, q=True, ws=True, m=True) for j in joints]).reshape([len(joints), 4, 4]).transpose([0, 2, 1]) 264 | #print(bone_xforms) 265 | 266 | bone_positions = bone_xforms[:,:3,3].copy().astype(np.float32) 267 | bone_rotations = quat_from_xform(bone_xforms).astype(np.float32) 268 | bone_parents = parents.astype(np.int32) 269 | 270 | bone_rotations = np.concatenate([ 271 | bone_rotations[:,1:2], 272 | bone_rotations[:,2:3], 273 | bone_rotations[:,3:4], 274 | bone_rotations[:,0:1], 275 | ], axis=-1) 276 | 277 | #print(bone_positions) 278 | #print(bone_rotations) 279 | 280 | final_posns = 0.01 * final_posns 281 | bone_positions = 0.01 * bone_positions 282 | 283 | with open('C:/Projects/GenoView/resources/Geno.bin', 'wb') as f: 284 | 285 | f.write(struct.pack('I', len(final_posns))) 286 | f.write(struct.pack('I', len(final_tris))) 287 | f.write(struct.pack('I', len(joints))) 288 | f.write(final_posns.tobytes()) 289 | f.write(final_uvs.tobytes()) 290 | f.write(final_norms.tobytes()) 291 | f.write(final_bone_inds.tobytes()) 292 | f.write(final_bone_weis.tobytes()) 293 | f.write(final_tris.tobytes()) 294 | 295 | 296 | for i in range(len(bone_parents)): 297 | f.write(struct.pack('32si', bytes(joints[i], encoding='ascii'), bone_parents[i])) 298 | 299 | for i in range(len(bone_parents)): 300 | f.write(struct.pack('ffffffffff', 301 | bone_positions[i,0], bone_positions[i,1], bone_positions[i,2], 302 | bone_rotations[i,0], bone_rotations[i,1], bone_rotations[i,2], bone_rotations[i,3], 303 | 1.0, 1.0, 1.0)) 304 | -------------------------------------------------------------------------------- /resources/fxaa.fs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | precision highp float; 3 | 4 | in vec2 fragTexCoord; 5 | 6 | uniform sampler2D inputTexture; 7 | uniform vec2 invTextureResolution; 8 | 9 | out vec4 finalColor; 10 | 11 | void main() 12 | { 13 | const float spanMax = 4.0; 14 | const float reduceAmount = 1.0 / 4.0; 15 | const float reduceMin = (1.0 / 64.0); 16 | 17 | vec3 luma = vec3(0.299, 0.587, 0.114); 18 | float lumaNW = dot(texture(inputTexture, fragTexCoord + (vec2(-1.0, -1.0) * invTextureResolution)).rgb, luma); 19 | float lumaNE = dot(texture(inputTexture, fragTexCoord + (vec2( 1.0, -1.0) * invTextureResolution)).rgb, luma); 20 | float lumaSW = dot(texture(inputTexture, fragTexCoord + (vec2(-1.0, 1.0) * invTextureResolution)).rgb, luma); 21 | float lumaSE = dot(texture(inputTexture, fragTexCoord + (vec2( 1.0, 1.0) * invTextureResolution)).rgb, luma); 22 | float lumaMI = dot(texture(inputTexture, fragTexCoord).rgb, luma); 23 | 24 | float lumaMin = min(lumaMI, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); 25 | float lumaMax = max(lumaMI, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); 26 | 27 | vec2 dir = vec2( 28 | -((lumaNW + lumaNE) - (lumaSW + lumaSE)), 29 | +((lumaNW + lumaSW) - (lumaNE + lumaSE))); 30 | 31 | float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * reduceAmount), reduceMin); 32 | float dirRcpMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce); 33 | 34 | dir = min(vec2(spanMax, spanMax), max(vec2(-spanMax, -spanMax), dir * dirRcpMin)) * invTextureResolution; 35 | 36 | vec3 rgba0 = texture(inputTexture, fragTexCoord + dir * (1.0 / 3.0 - 0.5)).rgb; 37 | vec3 rgba1 = texture(inputTexture, fragTexCoord + dir * (2.0 / 3.0 - 0.5)).rgb; 38 | vec3 rgba2 = texture(inputTexture, fragTexCoord + dir * (0.0 / 3.0 - 0.5)).rgb; 39 | vec3 rgba3 = texture(inputTexture, fragTexCoord + dir * (3.0 / 3.0 - 0.5)).rgb; 40 | 41 | vec3 rgbA = (1.0/ 2.0) * (rgba0 + rgba1); 42 | vec3 rgbB = rgbA * (1.0/ 2.0) + (1.0/ 4.0) * (rgba2 + rgba3); 43 | 44 | float lumaB = dot(rgbB, luma); 45 | 46 | finalColor.rgb = (lumaB < lumaMin) || (lumaB > lumaMax) ? rgbA : rgbB; 47 | } 48 | -------------------------------------------------------------------------------- /resources/lighting.fs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | precision highp float; 3 | 4 | in vec2 fragTexCoord; 5 | 6 | uniform sampler2D gbufferColor; 7 | uniform sampler2D gbufferNormal; 8 | uniform sampler2D gbufferDepth; 9 | uniform sampler2D ssao; 10 | 11 | uniform vec3 camPos; 12 | uniform mat4 camInvViewProj; 13 | uniform vec3 lightDir; 14 | uniform vec3 sunColor; 15 | uniform float sunStrength; 16 | uniform vec3 skyColor; 17 | uniform float skyStrength; 18 | uniform float groundStrength; 19 | uniform float ambientStrength; 20 | uniform float exposure; 21 | uniform float camClipNear; 22 | uniform float camClipFar; 23 | 24 | out vec4 finalColor; 25 | 26 | #define PI 3.14159265358979323846264338327950288 27 | 28 | vec3 ToGamma(in vec3 col) 29 | { 30 | return vec3(pow(col.x, 2.2), pow(col.y, 2.2), pow(col.z, 2.2)); 31 | } 32 | 33 | vec3 FromGamma(in vec3 col) 34 | { 35 | return vec3(pow(col.x, 1.0/2.2), pow(col.y, 1.0/2.2), pow(col.z, 1.0/2.2)); 36 | } 37 | 38 | float LinearDepth(float depth, float near, float far) 39 | { 40 | return (2.0 * near) / (far + near - depth * (far - near)); 41 | } 42 | 43 | float NonlinearDepth(float depth, float near, float far) 44 | { 45 | return (((2.0 * near) / depth) - far - near) / (near - far); 46 | } 47 | 48 | void main() 49 | { 50 | // Unpack GBuffer 51 | 52 | float depth = texture(gbufferDepth, fragTexCoord).r; 53 | if (depth == 1.0f) { discard; } 54 | 55 | vec4 colorAndSpec = texture(gbufferColor, fragTexCoord); 56 | vec4 normalAndGlossiness = texture(gbufferNormal, fragTexCoord); 57 | vec3 positionClip = vec3(fragTexCoord, NonlinearDepth(depth, camClipNear, camClipFar)) * 2.0f - 1.0f; 58 | vec4 fragPositionHomo = camInvViewProj * vec4(positionClip, 1); 59 | vec3 fragPosition = fragPositionHomo.xyz / fragPositionHomo.w; 60 | vec4 ssaoData = texture(ssao, fragTexCoord); 61 | vec3 fragNormal = normalAndGlossiness.xyz * 2.0f - 1.0f; 62 | vec3 albedo = colorAndSpec.xyz; 63 | float specularity = colorAndSpec.w; 64 | float glossiness = normalAndGlossiness.w * 100.0f; 65 | float sunShadow = ssaoData.g; 66 | float ambientShadow = ssaoData.r; 67 | 68 | // Compute lighting 69 | 70 | vec3 eyeDir = normalize(fragPosition - camPos); 71 | 72 | vec3 lightSunColor = FromGamma(sunColor); 73 | vec3 lightSunHalf = normalize(-lightDir - eyeDir); 74 | 75 | vec3 lightSkyColor = FromGamma(skyColor); 76 | vec3 skyDir = vec3(0.0, -1.0, 0.0); 77 | vec3 lightSkyHalf = normalize(-skyDir - eyeDir); 78 | 79 | float sunFactorDiff = max(dot(fragNormal, -lightDir), 0.0); 80 | float sunFactorSpec = specularity * 81 | ((glossiness+2.0) / (8.0 * PI)) * 82 | pow(max(dot(fragNormal, lightSunHalf), 0.0), glossiness); 83 | 84 | float skyFactorDiff = max(dot(fragNormal, -skyDir), 0.0); 85 | float skyFactorSpec = specularity * 86 | ((glossiness+2.0) / (8.0 * PI)) * 87 | pow(max(dot(fragNormal, lightSkyHalf), 0.0), glossiness); 88 | 89 | float groundFactorDiff = max(dot(fragNormal, skyDir), 0.0); 90 | 91 | // Combine 92 | 93 | vec3 ambient = ambientShadow * ambientStrength * lightSkyColor * albedo; 94 | 95 | vec3 diffuse = sunShadow * sunStrength * lightSunColor * albedo * sunFactorDiff + 96 | groundStrength * lightSkyColor * albedo * groundFactorDiff; 97 | skyStrength * lightSkyColor * albedo * skyFactorDiff; 98 | 99 | float specular = sunShadow * sunStrength * sunFactorSpec + skyStrength * skyFactorSpec; 100 | 101 | vec3 final = diffuse + ambient + specular; 102 | 103 | finalColor = vec4(ToGamma(exposure * final), 1.0f); 104 | //finalColor = vec4(ToGamma(vec3(ambientShadow, ambientShadow, ambientShadow)), 1.0f); 105 | //finalColor = vec4(ToGamma(vec3(sunShadow, sunShadow, sunShadow)), 1.0f); 106 | //finalColor = vec4(ToGamma(vec3(specular, specular, specular)), 1.0f); 107 | gl_FragDepth = NonlinearDepth(depth, camClipNear, camClipFar); 108 | } 109 | -------------------------------------------------------------------------------- /resources/post.vs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | in vec3 vertexPosition; 4 | in vec2 vertexTexCoord; 5 | 6 | uniform mat4 mvp; 7 | 8 | out vec2 fragTexCoord; 9 | 10 | void main() 11 | { 12 | fragTexCoord = vertexTexCoord; 13 | gl_Position = mvp * vec4(vertexPosition, 1.0f); 14 | } 15 | -------------------------------------------------------------------------------- /resources/quat.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | 3 | def _fast_cross(a, b): 4 | return np.concatenate([ 5 | a[...,1:2]*b[...,2:3] - a[...,2:3]*b[...,1:2], 6 | a[...,2:3]*b[...,0:1] - a[...,0:1]*b[...,2:3], 7 | a[...,0:1]*b[...,1:2] - a[...,1:2]*b[...,0:1]], axis=-1) 8 | 9 | def eye(shape, dtype=np.float32): 10 | return np.ones(list(shape) + [4], dtype=dtype) * np.asarray([1, 0, 0, 0], dtype=dtype) 11 | 12 | def length(x): 13 | return np.sqrt(np.sum(x * x, axis=-1)) 14 | 15 | def normalize(x, eps=1e-8): 16 | return x / (length(x)[...,np.newaxis] + eps) 17 | 18 | def abs(x): 19 | return np.where(x[...,0:1] > 0.0, x, -x) 20 | 21 | def from_angle_axis(angle, axis): 22 | c = np.cos(angle / 2.0)[..., np.newaxis] 23 | s = np.sin(angle / 2.0)[..., np.newaxis] 24 | q = np.concatenate([c, s * axis], axis=-1) 25 | return q 26 | 27 | def to_xform(x): 28 | 29 | qw, qx, qy, qz = x[...,0:1], x[...,1:2], x[...,2:3], x[...,3:4] 30 | 31 | x2, y2, z2 = qx + qx, qy + qy, qz + qz 32 | xx, yy, wx = qx * x2, qy * y2, qw * x2 33 | xy, yz, wy = qx * y2, qy * z2, qw * y2 34 | xz, zz, wz = qx * z2, qz * z2, qw * z2 35 | 36 | return np.concatenate([ 37 | np.concatenate([1.0 - (yy + zz), xy - wz, xz + wy], axis=-1)[...,np.newaxis,:], 38 | np.concatenate([xy + wz, 1.0 - (xx + zz), yz - wx], axis=-1)[...,np.newaxis,:], 39 | np.concatenate([xz - wy, yz + wx, 1.0 - (xx + yy)], axis=-1)[...,np.newaxis,:], 40 | ], axis=-2) 41 | 42 | def to_xform_xy(x): 43 | 44 | qw, qx, qy, qz = x[...,0:1], x[...,1:2], x[...,2:3], x[...,3:4] 45 | 46 | x2, y2, z2 = qx + qx, qy + qy, qz + qz 47 | xx, yy, wx = qx * x2, qy * y2, qw * x2 48 | xy, yz, wy = qx * y2, qy * z2, qw * y2 49 | xz, zz, wz = qx * z2, qz * z2, qw * z2 50 | 51 | return np.concatenate([ 52 | np.concatenate([1.0 - (yy + zz), xy - wz], axis=-1)[...,np.newaxis,:], 53 | np.concatenate([xy + wz, 1.0 - (xx + zz)], axis=-1)[...,np.newaxis,:], 54 | np.concatenate([xz - wy, yz + wx], axis=-1)[...,np.newaxis,:], 55 | ], axis=-2) 56 | 57 | 58 | 59 | def from_euler(e, order='zyx'): 60 | axis = { 61 | 'x': np.asarray([1, 0, 0], dtype=np.float32), 62 | 'y': np.asarray([0, 1, 0], dtype=np.float32), 63 | 'z': np.asarray([0, 0, 1], dtype=np.float32)} 64 | 65 | q0 = from_angle_axis(e[..., 0], axis[order[0]]) 66 | q1 = from_angle_axis(e[..., 1], axis[order[1]]) 67 | q2 = from_angle_axis(e[..., 2], axis[order[2]]) 68 | 69 | return mul(q0, mul(q1, q2)) 70 | 71 | def from_xform(ts): 72 | 73 | return normalize( 74 | np.where((ts[...,2,2] < 0.0)[...,np.newaxis], 75 | np.where((ts[...,0,0] > ts[...,1,1])[...,np.newaxis], 76 | np.concatenate([ 77 | (ts[...,2,1]-ts[...,1,2])[...,np.newaxis], 78 | (1.0 + ts[...,0,0] - ts[...,1,1] - ts[...,2,2])[...,np.newaxis], 79 | (ts[...,1,0]+ts[...,0,1])[...,np.newaxis], 80 | (ts[...,0,2]+ts[...,2,0])[...,np.newaxis]], axis=-1), 81 | np.concatenate([ 82 | (ts[...,0,2]-ts[...,2,0])[...,np.newaxis], 83 | (ts[...,1,0]+ts[...,0,1])[...,np.newaxis], 84 | (1.0 - ts[...,0,0] + ts[...,1,1] - ts[...,2,2])[...,np.newaxis], 85 | (ts[...,2,1]+ts[...,1,2])[...,np.newaxis]], axis=-1)), 86 | np.where((ts[...,0,0] < -ts[...,1,1])[...,np.newaxis], 87 | np.concatenate([ 88 | (ts[...,1,0]-ts[...,0,1])[...,np.newaxis], 89 | (ts[...,0,2]+ts[...,2,0])[...,np.newaxis], 90 | (ts[...,2,1]+ts[...,1,2])[...,np.newaxis], 91 | (1.0 - ts[...,0,0] - ts[...,1,1] + ts[...,2,2])[...,np.newaxis]], axis=-1), 92 | np.concatenate([ 93 | (1.0 + ts[...,0,0] + ts[...,1,1] + ts[...,2,2])[...,np.newaxis], 94 | (ts[...,2,1]-ts[...,1,2])[...,np.newaxis], 95 | (ts[...,0,2]-ts[...,2,0])[...,np.newaxis], 96 | (ts[...,1,0]-ts[...,0,1])[...,np.newaxis]], axis=-1)))) 97 | 98 | 99 | def from_xform_xy(x): 100 | 101 | c2 = _fast_cross(x[...,0], x[...,1]) 102 | c2 = c2 / np.sqrt(np.sum(np.square(c2), axis=-1))[...,np.newaxis] 103 | c1 = _fast_cross(c2, x[...,0]) 104 | c1 = c1 / np.sqrt(np.sum(np.square(c1), axis=-1))[...,np.newaxis] 105 | c0 = x[...,0] 106 | 107 | return from_xform(np.concatenate([ 108 | c0[...,np.newaxis], 109 | c1[...,np.newaxis], 110 | c2[...,np.newaxis]], axis=-1)) 111 | 112 | def inv(q): 113 | return np.asarray([1, -1, -1, -1], dtype=np.float32) * q 114 | 115 | def mul(x, y): 116 | x0, x1, x2, x3 = x[..., 0:1], x[..., 1:2], x[..., 2:3], x[..., 3:4] 117 | y0, y1, y2, y3 = y[..., 0:1], y[..., 1:2], y[..., 2:3], y[..., 3:4] 118 | 119 | return np.concatenate([ 120 | y0 * x0 - y1 * x1 - y2 * x2 - y3 * x3, 121 | y0 * x1 + y1 * x0 - y2 * x3 + y3 * x2, 122 | y0 * x2 + y1 * x3 + y2 * x0 - y3 * x1, 123 | y0 * x3 - y1 * x2 + y2 * x1 + y3 * x0], axis=-1) 124 | 125 | def inv_mul(x, y): 126 | return mul(inv(x), y) 127 | 128 | def mul_inv(x, y): 129 | return mul(x, inv(y)) 130 | 131 | def mul_vec(q, x): 132 | t = 2.0 * _fast_cross(q[..., 1:], x) 133 | return x + q[..., 0][..., np.newaxis] * t + _fast_cross(q[..., 1:], t) 134 | 135 | def inv_mul_vec(q, x): 136 | return mul_vec(inv(q), x) 137 | 138 | def unroll(x): 139 | y = x.copy() 140 | for i in range(1, len(x)): 141 | d0 = np.sum( y[i] * y[i-1], axis=-1) 142 | d1 = np.sum(-y[i] * y[i-1], axis=-1) 143 | y[i][d0 < d1] = -y[i][d0 < d1] 144 | return y 145 | 146 | def between(x, y): 147 | return np.concatenate([ 148 | np.sqrt(np.sum(x*x, axis=-1) * np.sum(y*y, axis=-1))[...,np.newaxis] + 149 | np.sum(x * y, axis=-1)[...,np.newaxis], 150 | _fast_cross(x, y)], axis=-1) 151 | 152 | def log(x, eps=1e-5): 153 | length = np.sqrt(np.sum(np.square(x[...,1:]), axis=-1))[...,np.newaxis] 154 | halfangle = np.where(length < eps, np.ones_like(length), np.arctan2(length, x[...,0:1]) / length) 155 | return halfangle * x[...,1:] 156 | 157 | def exp(x, eps=1e-5): 158 | halfangle = np.sqrt(np.sum(np.square(x), axis=-1))[...,np.newaxis] 159 | c = np.where(halfangle < eps, np.ones_like(halfangle), np.cos(halfangle)) 160 | s = np.where(halfangle < eps, np.ones_like(halfangle), np.sinc(halfangle / np.pi)) 161 | return np.concatenate([c, s * x], axis=-1) 162 | 163 | def to_scaled_angle_axis(x, eps=1e-5): 164 | return 2.0 * log(x, eps) 165 | 166 | def from_scaled_angle_axis(x, eps=1e-5): 167 | return exp(x / 2.0, eps) 168 | 169 | def fk(lrot, lpos, parents): 170 | 171 | gp, gr = [lpos[...,:1,:]], [lrot[...,:1,:]] 172 | for i in range(1, len(parents)): 173 | gp.append(mul_vec(gr[parents[i]], lpos[...,i:i+1,:]) + gp[parents[i]]) 174 | gr.append(mul (gr[parents[i]], lrot[...,i:i+1,:])) 175 | 176 | return np.concatenate(gr, axis=-2), np.concatenate(gp, axis=-2) 177 | 178 | def ik(grot, gpos, parents): 179 | 180 | return ( 181 | np.concatenate([ 182 | grot[...,:1,:], 183 | mul(inv(grot[...,parents[1:],:]), grot[...,1:,:]), 184 | ], axis=-2), 185 | np.concatenate([ 186 | gpos[...,:1,:], 187 | mul_vec( 188 | inv(grot[...,parents[1:],:]), 189 | gpos[...,1:,:] - gpos[...,parents[1:],:]), 190 | ], axis=-2)) 191 | 192 | def fk_vel(lrot, lpos, lvel, lang, parents): 193 | 194 | gp, gr, gv, ga = [lpos[...,:1,:]], [lrot[...,:1,:]], [lvel[...,:1,:]], [lang[...,:1,:]] 195 | for i in range(1, len(parents)): 196 | gp.append(mul_vec(gr[parents[i]], lpos[...,i:i+1,:]) + gp[parents[i]]) 197 | gr.append(mul (gr[parents[i]], lrot[...,i:i+1,:])) 198 | gv.append(mul_vec(gr[parents[i]], lvel[...,i:i+1,:]) + 199 | _fast_cross(ga[parents[i]], mul_vec(gr[parents[i]], lpos[...,i:i+1,:])) + 200 | gv[parents[i]]) 201 | ga.append(mul_vec(gr[parents[i]], lang[...,i:i+1,:]) + ga[parents[i]]) 202 | 203 | return ( 204 | np.concatenate(gr, axis=-2), 205 | np.concatenate(gp, axis=-2), 206 | np.concatenate(gv, axis=-2), 207 | np.concatenate(ga, axis=-2)) 208 | 209 | 210 | def to_euler(x, order='xyz'): 211 | 212 | q0 = x[...,0:1] 213 | q1 = x[...,1:2] 214 | q2 = x[...,2:3] 215 | q3 = x[...,3:4] 216 | 217 | if order == 'xyz': 218 | 219 | return np.concatenate([ 220 | np.arctan2(2 * (q0 * q1 + q2 * q3), 1 - 2 * (q1 * q1 + q2 * q2)), 221 | np.arcsin((2 * (q0 * q2 - q3 * q1)).clip(-1,1)), 222 | np.arctan2(2 * (q0 * q3 + q1 * q2), 1 - 2 * (q2 * q2 + q3 * q3))], axis=-1) 223 | 224 | elif order == 'yzx': 225 | 226 | return np.concatenate([ 227 | np.arctan2(2 * (q1 * q0 - q2 * q3), -q1 * q1 + q2 * q2 - q3 * q3 + q0 * q0), 228 | np.arctan2(2 * (q2 * q0 - q1 * q3), q1 * q1 - q2 * q2 - q3 * q3 + q0 * q0), 229 | np.arcsin((2 * (q1 * q2 + q3 * q0)).clip(-1,1))], axis=-1) 230 | 231 | else: 232 | raise NotImplementedError('Cannot convert from ordering %s' % order) 233 | -------------------------------------------------------------------------------- /resources/shadow.fs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | precision highp float; 3 | 4 | uniform float lightClipNear; 5 | uniform float lightClipFar; 6 | 7 | float LinearDepth(float depth, float near, float far) 8 | { 9 | return (2.0 * near) / (far + near - depth * (far - near)); 10 | } 11 | 12 | void main() 13 | { 14 | gl_FragDepth = LinearDepth(gl_FragCoord.z, lightClipNear, lightClipFar); 15 | } 16 | -------------------------------------------------------------------------------- /resources/shadow.vs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | in vec3 vertexPosition; 4 | 5 | uniform mat4 mvp; 6 | 7 | void main() 8 | { 9 | gl_Position = mvp * vec4(vertexPosition, 1.0f); 10 | } 11 | -------------------------------------------------------------------------------- /resources/skinnedBasic.vs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | in vec3 vertexPosition; 4 | in vec2 vertexTexCoord; 5 | in vec3 vertexNormal; 6 | in vec4 vertexColor; 7 | in vec4 vertexBoneIds; 8 | in vec4 vertexBoneWeights; 9 | 10 | #define MAX_BONE_NUM 128 11 | uniform mat4 boneMatrices[MAX_BONE_NUM]; 12 | 13 | uniform mat4 mvp; 14 | 15 | out vec3 fragPosition; 16 | out vec2 fragTexCoord; 17 | out vec4 fragColor; 18 | out vec3 fragNormal; 19 | 20 | void main() 21 | { 22 | int boneIndex0 = int(vertexBoneIds.x); 23 | int boneIndex1 = int(vertexBoneIds.y); 24 | int boneIndex2 = int(vertexBoneIds.z); 25 | int boneIndex3 = int(vertexBoneIds.w); 26 | 27 | vec4 skinnedPosition = 28 | vertexBoneWeights.x * (boneMatrices[boneIndex0] * vec4(vertexPosition, 1.0f)) + 29 | vertexBoneWeights.y * (boneMatrices[boneIndex1] * vec4(vertexPosition, 1.0f)) + 30 | vertexBoneWeights.z * (boneMatrices[boneIndex2] * vec4(vertexPosition, 1.0f)) + 31 | vertexBoneWeights.w * (boneMatrices[boneIndex3] * vec4(vertexPosition, 1.0f)); 32 | 33 | vec3 skinnedNormal = normalize( 34 | vertexBoneWeights.x * (mat3(boneMatrices[boneIndex0]) * vertexNormal) + 35 | vertexBoneWeights.y * (mat3(boneMatrices[boneIndex1]) * vertexNormal) + 36 | vertexBoneWeights.z * (mat3(boneMatrices[boneIndex2]) * vertexNormal) + 37 | vertexBoneWeights.w * (mat3(boneMatrices[boneIndex3]) * vertexNormal)); 38 | 39 | fragPosition = skinnedPosition.xyz / skinnedPosition.w; 40 | fragTexCoord = vertexTexCoord; 41 | fragColor = vertexColor; 42 | fragNormal = skinnedNormal; 43 | 44 | gl_Position = mvp * vec4(fragPosition, 1.0f); 45 | } 46 | -------------------------------------------------------------------------------- /resources/skinnedShadow.vs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | 3 | in vec3 vertexPosition; 4 | in vec4 vertexBoneIds; 5 | in vec4 vertexBoneWeights; 6 | 7 | #define MAX_BONE_NUM 128 8 | uniform mat4 boneMatrices[MAX_BONE_NUM]; 9 | 10 | uniform mat4 mvp; 11 | 12 | void main() 13 | { 14 | int boneIndex0 = int(vertexBoneIds.x); 15 | int boneIndex1 = int(vertexBoneIds.y); 16 | int boneIndex2 = int(vertexBoneIds.z); 17 | int boneIndex3 = int(vertexBoneIds.w); 18 | 19 | vec4 skinnedPosition = 20 | vertexBoneWeights.x * (boneMatrices[boneIndex0] * vec4(vertexPosition, 1.0f)) + 21 | vertexBoneWeights.y * (boneMatrices[boneIndex1] * vec4(vertexPosition, 1.0f)) + 22 | vertexBoneWeights.z * (boneMatrices[boneIndex2] * vec4(vertexPosition, 1.0f)) + 23 | vertexBoneWeights.w * (boneMatrices[boneIndex3] * vec4(vertexPosition, 1.0f)); 24 | 25 | gl_Position = mvp * vec4(skinnedPosition.xyz / skinnedPosition.w, 1.0f); 26 | } 27 | -------------------------------------------------------------------------------- /resources/ssao.fs: -------------------------------------------------------------------------------- 1 | #version 300 es 2 | precision highp float; 3 | 4 | #define PI 3.14159265358979323846264338327950288 5 | #define SSAO_SAMPLE_NUM 9 6 | 7 | in vec2 fragTexCoord; 8 | 9 | uniform sampler2D gbufferNormal; 10 | uniform sampler2D gbufferDepth; 11 | uniform mat4 camView; 12 | uniform mat4 camProj; 13 | uniform mat4 camInvProj; 14 | uniform mat4 camInvViewProj; 15 | uniform mat4 lightViewProj; 16 | uniform sampler2D shadowMap; 17 | uniform vec2 shadowInvResolution; 18 | uniform float camClipNear; 19 | uniform float camClipFar; 20 | uniform float lightClipNear; 21 | uniform float lightClipFar; 22 | uniform vec3 lightDir; 23 | 24 | float LinearDepth(float depth, float near, float far) 25 | { 26 | return (2.0 * near) / (far + near - depth * (far - near)); 27 | } 28 | 29 | float NonlinearDepth(float depth, float near, float far) 30 | { 31 | return (((2.0 * near) / depth) - far - near) / (near - far); 32 | } 33 | 34 | vec3 CameraSpace(vec2 texcoord, float depth) 35 | { 36 | vec4 positionClip = vec4(vec3(texcoord, NonlinearDepth(depth, camClipNear, camClipFar)) * 2.0 - 1.0, 1.0); 37 | vec4 position = camInvProj * positionClip; 38 | return position.xyz / position.w; 39 | } 40 | 41 | vec3 Rand(vec2 seed) 42 | { 43 | return 2.0 * fract(sin(dot(seed, vec2(12.9898, 78.233))) * vec3(43758.5453, 21383.21227, 20431.20563)) - 1.0; 44 | } 45 | 46 | vec2 Spiral(int sampleIndex, float turns, float seed) 47 | { 48 | float alpha = (float(sampleIndex) + 0.5) / float(SSAO_SAMPLE_NUM); 49 | float angle = alpha * (turns * 2.0 * PI) + 2.0 * PI * seed; 50 | return alpha * vec2(cos(angle), sin(angle)); 51 | } 52 | 53 | out vec4 finalColor; 54 | 55 | void main() 56 | { 57 | // Compute Shadows 58 | 59 | float depth = texture(gbufferDepth, fragTexCoord).r; 60 | if (depth == 1.0f) { discard; } 61 | 62 | vec3 positionClip = vec3(fragTexCoord, NonlinearDepth(depth, camClipNear, camClipFar)) * 2.0f - 1.0f; 63 | vec4 fragPositionHomo = camInvViewProj * vec4(positionClip, 1); 64 | vec3 fragPosition = fragPositionHomo.xyz / fragPositionHomo.w; 65 | vec3 fragNormal = texture(gbufferNormal, fragTexCoord).xyz * 2.0 - 1.0; 66 | 67 | vec3 seed = Rand(fragTexCoord); 68 | 69 | float shadowNormalBias = 0.005; 70 | 71 | vec4 fragPosLightSpace = lightViewProj * vec4(fragPosition + shadowNormalBias * fragNormal, 1); 72 | fragPosLightSpace.xyz /= fragPosLightSpace.w; 73 | fragPosLightSpace.xyz = (fragPosLightSpace.xyz + 1.0f) / 2.0f; 74 | 75 | float shadowDepthBias = 0.00000025; 76 | float shadowClip = float( 77 | fragPosLightSpace.x < +1.0 && 78 | fragPosLightSpace.x > -1.0 && 79 | fragPosLightSpace.y < +1.0 && 80 | fragPosLightSpace.y > -1.0); 81 | 82 | float shadow = 1.0 - shadowClip * float( 83 | LinearDepth(fragPosLightSpace.z, lightClipNear, lightClipFar) - shadowDepthBias > 84 | texture(shadowMap, fragPosLightSpace.xy + shadowInvResolution * seed.xy).r); 85 | 86 | //shadow = texture(shadowMap, fragPosLightSpace.xy).r; 87 | 88 | // Compute SSAO 89 | 90 | float bias = 0.025f; 91 | float radius = 0.5f; 92 | float turns = 7.0f; 93 | float intensity = 0.15f; 94 | 95 | vec3 norm = mat3(camView) * fragNormal; 96 | vec3 base = CameraSpace(fragTexCoord, texture(gbufferDepth, fragTexCoord).r); 97 | float occ = 0.0; 98 | for (int i = 0; i < SSAO_SAMPLE_NUM; i++) 99 | { 100 | vec3 next = base + radius * vec3(Spiral(i, turns, seed.x), 0.0); 101 | vec4 ntex = camProj * vec4(next, 1); 102 | vec2 sampleTexCoord = (ntex.xy / ntex.w) * 0.5f + 0.5f; 103 | vec3 actu = CameraSpace(sampleTexCoord, texture(gbufferDepth, sampleTexCoord).r); 104 | vec3 diff = actu - base; 105 | float vv = dot(diff, diff); 106 | float vn = dot(diff, norm) - bias; 107 | float f = max(radius*radius - vv, 0.0); 108 | occ += f*f*f*max(vn / (0.001 + vv), 0.0); 109 | } 110 | occ = occ / pow(radius, 6.0); 111 | 112 | float ssao = max(0.0, 1.0 - occ * intensity * (5.0 / float(SSAO_SAMPLE_NUM))); 113 | 114 | finalColor.r = ssao; 115 | finalColor.g = shadow; 116 | finalColor.b = 0.0f; 117 | finalColor.a = 1.0f; 118 | } 119 | --------------------------------------------------------------------------------