diff --git a/metadrive/component/sensors/rgb_camera.py b/metadrive/component/sensors/rgb_camera.py index a00f6d099..7fa83eaa6 100644 --- a/metadrive/component/sensors/rgb_camera.py +++ b/metadrive/component/sensors/rgb_camera.py @@ -6,6 +6,7 @@ from metadrive.constants import CamMask from metadrive.constants import Semantics, CameraTagStateKey from metadrive.third_party.simplepbr import _load_shader_str +from metadrive.utils.utils import is_mac class RGBCamera(BaseCamera): @@ -39,15 +40,17 @@ def _setup_effect(self): self.manager = FilterManager(self.buffer, self.cam) fbprops = p3d.FrameBufferProperties() fbprops.float_color = True - fbprops.set_rgba_bits(16, 16, 16, 16) + # fbprops.set_rgba_bits(16, 16, 16, 16) fbprops.set_depth_bits(24) - fbprops.set_multisamples(16) + # fbprops.set_multisamples(16) self.scene_tex = p3d.Texture() self.scene_tex.set_format(p3d.Texture.F_rgba16) self.scene_tex.set_component_type(p3d.Texture.T_float) self.tonemap_quad = self.manager.render_scene_into(colortex=self.scene_tex, fbprops=fbprops) # defines = {} + if is_mac(): + defines["USE_330"] = True # post_vert_str = _load_shader_str('post.vert', defines) post_frag_str = _load_shader_str('tonemap.frag', defines) diff --git a/metadrive/engine/core/engine_core.py b/metadrive/engine/core/engine_core.py index e4978e9c5..3febf3595 100644 --- a/metadrive/engine/core/engine_core.py +++ b/metadrive/engine/core/engine_core.py @@ -104,11 +104,14 @@ class EngineCore(ShowBase.ShowBase): if is_mac(): # latest macOS supported openGL version loadPrcFileData("", "gl-version 4 1") - loadPrcFileData("", " framebuffer-srgb truein") + loadPrcFileData("", "color-bits 8 8 8") + loadPrcFileData("", "alpha-bits 8") else: # anti-aliasing does not work on macOS loadPrcFileData("", "framebuffer-multisample 1") loadPrcFileData("", "multisamples 8") + loadPrcFileData("", "color-bits 16 16 16") + loadPrcFileData("", "alpha-bits 16") def __init__(self, global_config): # if EngineCore.global_config is not None: @@ -294,7 +297,13 @@ def __init__(self, global_config): if self.global_config["daytime"] is not None: self.render_pipeline.daytime_mgr.time = self.global_config["daytime"] else: - if not is_mac(): + if is_mac(): + self.pbrpipe = init( + msaa_samples = 0, + # use_hardware_skinning=True, + use_330=True + ) + else: self.pbrpipe = init( msaa_samples=16, use_hardware_skinning=True, diff --git a/metadrive/third_party/simplepbr/__init__.py b/metadrive/third_party/simplepbr/__init__.py index 957eb022e..21e36c323 100644 --- a/metadrive/third_party/simplepbr/__init__.py +++ b/metadrive/third_party/simplepbr/__init__.py @@ -265,7 +265,7 @@ def _setup_tonemapping(self): fbprops = p3d.FrameBufferProperties() fbprops.float_color = True - fbprops.set_rgba_bits(16, 16, 16, 16) + # fbprops.set_rgba_bits(16, 16, 16, 16) fbprops.set_depth_bits(24) fbprops.set_multisamples(self.msaa_samples) scene_tex = p3d.Texture() diff --git a/metadrive/third_party/simplepbr/shaders/tonemap.frag.glsl b/metadrive/third_party/simplepbr/shaders/tonemap.frag.glsl index b728d25cb..cf33e629b 100644 --- a/metadrive/third_party/simplepbr/shaders/tonemap.frag.glsl +++ b/metadrive/third_party/simplepbr/shaders/tonemap.frag.glsl @@ -10,7 +10,7 @@ out vec4 o_color; #endif void main() { - vec3 color = texture2D(tex, v_texcoord).rgb; + vec3 color = texture(tex, v_texcoord).rgb; color *= exposure; color = max(vec3(0.0), color - vec3(0.004));