chunqian / go-raylib

go-raylib is a simple and easy-to-use library to enjoy videogames programming
zlib License
44 stars 3 forks source link

PBR example doesn't work on Linux [upstream] #3

Open makew0rld opened 3 years ago

makew0rld commented 3 years ago

Most examples are working great on Linux, I'm happy to see it! cubicmap and first_person_maze, for example. But the PBR one is not.

Here is a screenshot:

image

Some details come through but the overall color is not there.

Here is the log:

INFO: Initializing raylib 3.5
INFO: DISPLAY: Device initialized successfully
INFO:     > Display size: 1920 x 1080
INFO:     > Render size:  800 x 450
INFO:     > Screen size:  800 x 450
INFO:     > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: OpenGL 3.3 Core profile supported
INFO: GL: OpenGL device information:
INFO:     > Vendor:   Intel
INFO:     > Renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)
INFO:     > Version:  4.6 (Core Profile) Mesa 20.3.4
INFO:     > GLSL:     4.60
INFO: GL: Supported extensions count: 223
INFO: GL: DXT compressed textures supported
INFO: GL: ETC2/EAC compressed textures supported
INFO: GL: Anisotropic textures filtering supported (max: 16X)
INFO: TEXTURE: [ID 1] Texture created successfully (1x1 - 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Compiled successfully
INFO: SHADER: [ID 2] Compiled successfully
INFO: SHADER: [ID 3] Program loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Internal vertex buffers initialized successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully
INFO: RLGL: Default state initialized successfully
INFO: TEXTURE: [ID 2] Texture created successfully (128x128 - 1 mipmaps)
INFO: FONT: Default font loaded successfully
INFO: FILEIO: [../models/resources/pbr/trooper.obj] Text file loaded successfully
INFO: MODEL: [../models/resources/pbr/trooper.obj] OBJ data loaded successfully: 1 meshes / 0 materials
INFO: MODEL: No materials, putting all meshes in a default material
INFO: VAO: [ID 2] Mesh uploaded successfully to VRAM (GPU)
WARNING: MATERIAL: [../models/resources/pbr/trooper.obj] Failed to load material data, default to white material
INFO: MESH: Tangents data computed for provided mesh
INFO: FILEIO: [../models/resources/shaders/glsl330/pbr.vs] Text file loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/pbr.fs] Text file loaded successfully
INFO: SHADER: [ID 4] Compiled successfully
INFO: SHADER: [ID 5] Compiled successfully
INFO: SHADER: [ID 6] Program loaded successfully
INFO: SHADER: [ID 6] Shader uniform (albedo.sampler) set at location: 4
INFO: SHADER: [ID 6] Shader uniform (metalness.sampler) set at location: 10
INFO: SHADER: [ID 6] Shader uniform (normals.sampler) set at location: 7
INFO: SHADER: [ID 6] Shader uniform (roughness.sampler) set at location: 13
INFO: SHADER: [ID 6] Shader uniform (occlusion.sampler) set at location: 16
INFO: SHADER: [ID 6] Shader uniform (irradianceMap) set at location: 23
INFO: SHADER: [ID 6] Shader uniform (prefilterMap) set at location: 24
INFO: SHADER: [ID 6] Shader uniform (brdfLUT) set at location: 25
INFO: SHADER: [ID 6] Shader uniform (matModel) set at location: 1
INFO: SHADER: [ID 6] Shader uniform (viewPos) set at location: 47
INFO: FILEIO: [../models/resources/pbr/trooper_albedo.png] File loaded successfully
INFO: IMAGE: [../models/resources/pbr/trooper_albedo.png] Data loaded successfully (1024x1024)
INFO: TEXTURE: [ID 3] Texture created successfully (1024x1024 - 1 mipmaps)
INFO: FILEIO: [../models/resources/pbr/trooper_normals.png] File loaded successfully
INFO: IMAGE: [../models/resources/pbr/trooper_normals.png] Data loaded successfully (1024x1024)
INFO: TEXTURE: [ID 4] Texture created successfully (1024x1024 - 1 mipmaps)
INFO: FILEIO: [../models/resources/pbr/trooper_metalness.png] File loaded successfully
INFO: IMAGE: [../models/resources/pbr/trooper_metalness.png] Data loaded successfully (2048x2048)
INFO: TEXTURE: [ID 5] Texture created successfully (2048x2048 - 1 mipmaps)
INFO: FILEIO: [../models/resources/pbr/trooper_roughness.png] File loaded successfully
INFO: IMAGE: [../models/resources/pbr/trooper_roughness.png] Data loaded successfully (1024x1024)
INFO: TEXTURE: [ID 6] Texture created successfully (1024x1024 - 1 mipmaps)
INFO: FILEIO: [../models/resources/pbr/trooper_ao.png] File loaded successfully
INFO: IMAGE: [../models/resources/pbr/trooper_ao.png] Data loaded successfully (1024x1024)
INFO: TEXTURE: [ID 7] Texture created successfully (1024x1024 - 1 mipmaps)
INFO: FILEIO: [../models/resources/shaders/glsl330/cubemap.vs] Text file loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/cubemap.fs] Text file loaded successfully
INFO: SHADER: [ID 7] Compiled successfully
INFO: SHADER: [ID 8] Compiled successfully
INFO: SHADER: [ID 9] Program loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/skybox.vs] Text file loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/irradiance.fs] Text file loaded successfully
INFO: SHADER: [ID 10] Compiled successfully
INFO: SHADER: [ID 11] Compiled successfully
INFO: SHADER: [ID 12] Program loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/skybox.vs] Text file loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/prefilter.fs] Text file loaded successfully
INFO: SHADER: [ID 13] Compiled successfully
INFO: SHADER: [ID 14] Compiled successfully
INFO: SHADER: [ID 15] Program loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/brdf.vs] Text file loaded successfully
INFO: FILEIO: [../models/resources/shaders/glsl330/brdf.fs] Text file loaded successfully
INFO: SHADER: [ID 16] Compiled successfully
INFO: SHADER: [ID 17] Compiled successfully
INFO: SHADER: [ID 18] Program loaded successfully
INFO: SHADER: [ID 9] Shader uniform (equirectangularMap) set at location: 2
INFO: SHADER: [ID 12] Shader uniform (environmentMap) set at location: 2
INFO: SHADER: [ID 15] Shader uniform (environmentMap) set at location: 2
INFO: FILEIO: [../models/resources/dresden_square.hdr] File loaded successfully
INFO: IMAGE: [../models/resources/dresden_square.hdr] Data loaded successfully (1024x512)
INFO: TEXTURE: [ID 8] Texture created successfully (1024x512 - 1 mipmaps)
INFO: TEXTURE: [ID 1] Depth renderbuffer loaded successfully (16 bits)
INFO: TEXTURE: [ID 9] Cubemap texture created successfully (512x512)
INFO: FBO: [ID 1] Framebuffer object created successfully
INFO: FBO: [ID 1] Unloaded framebuffer from VRAM (GPU)
INFO: TEXTURE: [ID 2] Depth renderbuffer loaded successfully (16 bits)
INFO: TEXTURE: [ID 10] Cubemap texture created successfully (32x32)
INFO: FBO: [ID 2] Unloaded framebuffer from VRAM (GPU)
INFO: TEXTURE: [ID 3] Depth renderbuffer loaded successfully (16 bits)
INFO: TEXTURE: [ID 11] Cubemap texture created successfully (256x256)
INFO: SHADER: [ID 15] Shader uniform (roughness) set at location: 3
INFO: FBO: [ID 3] Unloaded framebuffer from VRAM (GPU)
INFO: TEXTURE: [ID 4] Depth renderbuffer loaded successfully (16 bits)
INFO: TEXTURE: [ID 12] Texture created successfully (512x512 - 1 mipmaps)
INFO: FBO: [ID 4] Unloaded framebuffer from VRAM (GPU)
INFO: TEXTURE: [ID 9] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 8] Unloaded texture data from VRAM (GPU)
INFO: SHADER: [ID 9] Unloaded shader program data from VRAM (GPU)
INFO: SHADER: [ID 12] Unloaded shader program data from VRAM (GPU)
INFO: SHADER: [ID 15] Unloaded shader program data from VRAM (GPU)
INFO: SHADER: [ID 18] Unloaded shader program data from VRAM (GPU)
INFO: SHADER: [ID 6] Shader uniform (albedo.useSampler) set at location: 3
INFO: SHADER: [ID 6] Shader uniform (normals.useSampler) set at location: 6
INFO: SHADER: [ID 6] Shader uniform (metalness.useSampler) set at location: 9
INFO: SHADER: [ID 6] Shader uniform (roughness.useSampler) set at location: 12
INFO: SHADER: [ID 6] Shader uniform (occlusion.useSampler) set at location: 15
INFO: SHADER: [ID 6] Shader uniform (renderMode) set at location: 46
INFO: SHADER: [ID 6] Shader uniform (lights[0].enabled) set at location: 26
INFO: SHADER: [ID 6] Shader uniform (lights[0].type) set at location: 27
INFO: SHADER: [ID 6] Shader uniform (lights[0].position) set at location: 28
INFO: SHADER: [ID 6] Shader uniform (lights[0].target) set at location: 29
INFO: SHADER: [ID 6] Shader uniform (lights[0].color) set at location: 30
INFO: SHADER: [ID 6] Shader uniform (lights[1].enabled) set at location: 31
INFO: SHADER: [ID 6] Shader uniform (lights[1].type) set at location: 32
INFO: SHADER: [ID 6] Shader uniform (lights[1].position) set at location: 33
INFO: SHADER: [ID 6] Shader uniform (lights[1].target) set at location: 34
INFO: SHADER: [ID 6] Shader uniform (lights[1].color) set at location: 35
INFO: SHADER: [ID 6] Shader uniform (lights[2].enabled) set at location: 36
INFO: SHADER: [ID 6] Shader uniform (lights[2].type) set at location: 37
INFO: SHADER: [ID 6] Shader uniform (lights[2].position) set at location: 38
INFO: SHADER: [ID 6] Shader uniform (lights[2].target) set at location: 39
INFO: SHADER: [ID 6] Shader uniform (lights[2].color) set at location: 40
INFO: SHADER: [ID 6] Shader uniform (lights[3].enabled) set at location: 41
INFO: SHADER: [ID 6] Shader uniform (lights[3].type) set at location: 42
INFO: SHADER: [ID 6] Shader uniform (lights[3].position) set at location: 43
INFO: SHADER: [ID 6] Shader uniform (lights[3].target) set at location: 44
INFO: SHADER: [ID 6] Shader uniform (lights[3].color) set at location: 45
INFO: TIMER: Target time per frame: 16.667 milliseconds
INFO: TEXTURE: [ID 3] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 4] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 5] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 6] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 7] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 10] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 11] Unloaded texture data from VRAM (GPU)
INFO: TEXTURE: [ID 12] Unloaded texture data from VRAM (GPU)
INFO: SHADER: [ID 6] Unloaded shader program data from VRAM (GPU)
INFO: VAO: [ID 2] Unloaded vertex 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: TEXTURE: [ID 1] Unloaded default texture data from VRAM (GPU)
INFO: Window closed successfully

Key line is:

WARNING: MATERIAL: [../models/resources/pbr/trooper.obj] Failed to load material data, default to white material

All other files are loaded successfully, I'm not sure why this one failed.

Build command is from the README.

chunqian commented 3 years ago

@makeworld-the-better-one This is not a bug, when you compile and run the raylib c version example you will also get the same WARNING The reason for this is that the LoadModel method will have this WARNING when model.materialCount == 0, the .obj in the example is without material

chunqian commented 3 years ago

@makeworld-the-better-one Actually, the material is already running properly and loaded Take a look at the running program

makew0rld commented 3 years ago

@chunqian How does it work on the examples page page then?

image

Seems to me like this doesn't match the upstream behaviour and should be re-opened.

chunqian commented 3 years ago

This is raylib c version's bug See this #1571