orangeduck / BVHView

A simple viewer for the .bvh animation file format written using raylib.
MIT License
254 stars 14 forks source link

Cannot render volume #5

Closed EmptyBlueBox closed 4 months ago

EmptyBlueBox commented 4 months ago

Hi! I'm using your tool to visualize some bvh files! I'm using MacOS with M1Pro chip.

Everything went on smoothly, except I couldn't visualize the colored volume around the skeleton, and there seems to be a white box around the skeleton.

CleanShot 2024-06-04 at 00 04 29@2x

However, when I turned down the opacity a little bit (from 1 to 0.99), the white box disappeared but still no colored volume around the skeleton. Input multiple bvh files does help.

CleanShot 2024-06-04 at 00 06 59@2x

Thank you in advance!

orangeduck commented 4 months ago

This looks like a shader issue. Are you able to compile in debug mode and then share the log?

EmptyBlueBox commented 4 months ago

The above images were already compiled with BUILD_MODE ?= DEBUG. I think this is because the shader version.

INFO: Initializing raylib 5.1-dev
INFO: Platform backend: DESKTOP (GLFW)
INFO: Supported raylib modules:
INFO:     > rcore:..... loaded (mandatory)
INFO:     > rlgl:...... loaded (mandatory)
INFO:     > rshapes:... loaded (optional)
INFO:     > rtextures:. loaded (optional)
INFO:     > rtext:..... loaded (optional)
INFO:     > rmodels:... loaded (optional)
INFO:     > raudio:.... loaded (optional)
INFO: DISPLAY: Trying to enable MSAA x4
INFO: wantWindowed: 0, size: 1280x720
INFO: DISPLAY: Trying to enable VSYNC
INFO: DISPLAY: Device initialized successfully
INFO:     > Display size: 1728 x 1117
INFO:     > Screen size:  1280 x 720
INFO:     > Render size:  1280 x 720
INFO:     > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: Supported extensions count: 43
INFO: GL: OpenGL device information:
INFO:     > Vendor:   Apple
INFO:     > Renderer: Apple M1 Pro
INFO:     > Version:  4.1 Metal - 88.1
INFO:     > GLSL:     4.10
INFO: GL: VAO extension detected, VAO functions loaded successfully
INFO: GL: NPOT textures extension detected, full NPOT textures supported
INFO: GL: DXT compressed textures supported
INFO: GLFW platform: Cocoa
INFO: PLATFORM: DESKTOP (GLFW): Initialized successfully
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Vertex shader compiled successfully
INFO: SHADER: [ID 2] Fragment shader compiled successfully
INFO: SHADER: [ID 3] Program shader loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: TIMER: Target time per frame: 16.667 milliseconds
WARNING: SHADER: [ID 4] Failed to compile vertex shader code
WARNING: SHADER: [ID 4] Compile error: ERROR: 0:1: '' :  version '300' is not supported
ERROR: 0:1: '' : syntax error: #version
ERROR: 0:2: '' :  #version required and missing.

WARNING: SHADER: [ID 5] Failed to compile fragment shader code
WARNING: SHADER: [ID 5] Compile error: ERROR: 0:1: '' :  version '300' is not supported
ERROR: 0:1: '' : syntax error: #version
ERROR: 0:2: '' :  #version required and missing.

WARNING: SHADER: [ID 6] Failed to link shader program
WARNING: SHADER: [ID 6] Link error: ERROR: One or more attached shaders not successfully compiled

WARNING: SHADER: Failed to load custom shader code, using default shader
INFO: VAO: [ID 2] Mesh uploaded successfully to VRAM (GPU)
INFO: VAO: [ID 3] Mesh uploaded successfully to VRAM (GPU)
INFO: TEXTURE: [ID 3] Texture loaded successfully (32x32 | GRAYSCALE | 1 mipmaps)
INFO: TEXTURE: [ID 4] Texture loaded successfully (256x128 | GRAYSCALE | 1 mipmaps)
INFO: Loading '*.bvh'
INFO: parsed '*.bvh' successfully
INFO: TEXTURE: [ID 3] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 4] Unloaded texture data from VRAM (GPU)
INFO: VAO: [ID 3] Unloaded vertex array data from VRAM (GPU)
INFO: MODEL: Unloaded model (and meshes) from RAM and VRAM
INFO: VAO: [ID 2] Unloaded vertex array data from VRAM (GPU)
INFO: MODEL: Unloaded model (and meshes) from RAM and VRAM
INFO: TEXTURE: [ID 2] Unloaded texture data from VRAM (GPU)
INFO: SHADER: [ID 3] Default shader unloaded successfully
INFO: TEXTURE: [ID 1] Default texture unloaded successfully
INFO: Window closed successfully
orangeduck commented 4 months ago

Are you also compiling raylib from scratch? I wonder if you need to make sure you compile it with a particular GRAPHICS variable to make sure that glsl version is supported:

https://www.reddit.com/r/raylib/comments/vwk8w9/seemingly_unable_to_use_opengl_4_features_even/

EmptyBlueBox commented 4 months ago

Yes, I make clean and compile them again, still got problems. Maybe some problem like this one? But I'm not familiar with these tools :(

https://www.reddit.com/r/opengl/comments/14oazju/version_330_is_not_supported_m1_mac/

orangeduck commented 4 months ago

Perhaps try switching the version to 330 non-es.

#define GLSL(X) \
  "#version 330\n" \
  GLSL_DEFINE(AO_RATIO_MAX) \
  GLSL_DEFINE(AO_CAPSULES_MAX) \
  GLSL_DEFINE(SHADOW_CAPSULES_MAX) \
  GLSL_DEFINE(PI) \
  #X
EmptyBlueBox commented 4 months ago

That works! Just change #version 300 es to #version 330 will work!

CleanShot 2024-06-05 at 14 56 18@2x

orangeduck commented 4 months ago

Great, I am glad to hear that worked :)