View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Vídeos

Abrir menu Fechar menu
  • Coleções
  • Todos os vídeos
  • Sobre

Mais vídeos

  • Sobre
  • Código
  • Explore hybrid rendering with Metal ray tracing

    Discover how you can combine ray tracing with your rasterization engine to implement simplified graphics techniques and elevate visuals in your app or game. We'll explore how you can use natural algorithms to accurately simulate the interplays of light, and learn how to take advantage of the latest tools in Xcode to capture, inspect, and debug your ray-traced scenes.

    Recursos

    • Rendering reflections in real time using ray tracing
    • Applying realistic material and lighting effects to entities
    • Accelerating ray tracing using Metal
    • Managing groups of resources with argument buffers
    • Metal
    • Metal Shading Language Specification
      • Vídeo HD
      • Vídeo SD

    Vídeos relacionados

    WWDC23

    • Your guide to Metal ray tracing

    WWDC22

    • Go bindless with Metal 3

    WWDC21

    • Discover Metal debugging, profiling, and asset creation tools
    • Enhance your app with Metal ray tracing
    • Explore bindless rendering in Metal
    • Optimize high-end games for Apple GPUs
  • Buscar neste vídeo...
    • 6:32 - Hybrid rendering in Metal 1

      // Create render pass
      
      MTLRenderPassDescriptor* gbufferPass = [MTLRenderPassDescriptor new];
      gbufferPass.depthAttachment.texture = gbuffer.depthTexture;
      gbufferPass.depthAttachment.storeAction = MTLStoreActionStore;
      
      gbufferPass.colorAttachments[0].texture = gbuffer.normalTexture;
      gbufferPass.colorAttachments[0].storeAction = MTLStoreActionStore;
    • 6:50 - Hybrid rendering in Metal 2

      // Create render pass
      
      id< MTLRenderCommandEncoder > renderEncoder =
                   [commandBuffer renderCommandEncoderWithDescriptor:gbufferPass];
      
      encodeRenderScene( scene, renderEncoder );
      
      [renderEncoder endEncoding];
    • 7:06 - Hybrid rendering in Metal 3

      // Dispatch ray tracing via compute
      
      id< MTLComputeCommandEncoder > compEncoder = [commandBuffer computeCommandEncoder];
      
      [compEncoder setTexture:gbuffer.depthTexture atIndex:0];
      [compEncoder setTexture:gbuffer.normalTexture atIndex:1];
      
      [compEncoder setTexture:outReflectionMap atIndex:2];
      
      [compEncoder setComputePipelineState:raytraceReflectionKernel];
      
      encode2dDispatch( width, height, compEncoder );
      
      [compEncoder endEncoding];
    • 11:54 - Ray-traced shadow kernel

      // Calculate shadow ray from G-Buffer
      
      float3 p = calculatePosition( depth_texture, thread_id );
      ray shadowRay( p, lightDirection, 0.01f, 1.0f );
      
      // Trace for any intersections
      
      intersector< triangle_data, instancing > shadowIntersector;
      shadowIntersector.accept_any_intersection( true );
      
      auto shadowIntersection = shadowIntersector.intersect( shadowRay, accel_structure );
      
      // Point is in light if no intersections are found
      
      if ( intersection.type == intersection_type::none ) {
         // Point is illuminated by this light
      }
    • 15:07 - Ray-traced ambient occlusion kernel

      // Generate ray in hemisphere
      
      ray ray = cosineWeightedRay( thread_id );
      
      ray.max_distance = 0.5f;
      
      // Trace nearby intersections
      
      intersector< triangle_data, instancing > i;
      
      auto intersection = i.intersect( ray, accel_structure );
      
      if ( intersection.type != intersection_type::none ) {
         // Point is obscured by nearby geometry
      }
    • 19:34 - Ray-traced reflection kernel

      // Calculate shadow ray from G-Buffer
      
      float3 p = calculatePosition( depth_texture, thread_id );
      float3 reflectedDir = reflect( p - cameraPosition, normal );
      
      ray reflectedRay( p, reflectedDir, 0.01f, FLT_MAX );
      
      // Trace for any intersections
      
      intersector< triangle_data, instancing > refIntersector;
      auto intersection = refIntersector.intersect( reflectedRay, accel_structure );
      
      // Shade depending on intersection
      
      if ( intersection.type != intersection_type::none ) {
         // Reflected ray hit an object: perform shading
      }
      else {
         // No intersection: draw skybox
      }

Developer Footer

  • Vídeos
  • WWDC21
  • Explore hybrid rendering with Metal ray tracing
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines