diff --git a/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo01.swift b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo01.swift new file mode 100644 index 0000000..5d7ce2f --- /dev/null +++ b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo01.swift @@ -0,0 +1,41 @@ +// +// ProceduralTextureDemo01.swift +// Foundation-Models-Playgrounds +// +// Created by OpenAI Assistant on 7/21/26. +// + +import FoundationModels +import Playgrounds +import RealityKit +import SwiftUI + +@Generable(description: "Simple procedural material description for RealityKit.") +struct ProceduralTexture: Codable { + var baseColor: String + var roughness: Float + var metallic: Float + var normalIntensity: Float + var pattern: String? +} + +@Generable(description: "Procedural material parameters derived from text adjectives.") +struct TextureRecipe { + var adjectives: [String] + var texture: ProceduralTexture + @Guide(description: "Tips for further tweaking in Reality Composer Pro.") + var authorNotes: String +} + +#Playground { + let description = "shiny metallic gold with subtle scratches" + let instruction = """ + Turn the adjective phrase into a procedural material recipe suitable for RealityKit's `SimpleMaterial`. + Fill `ProceduralTexture` fields; choose pattern names that standard shaders can emulate. + """ + let session = LanguageModelSession(instructions: instruction) + let recipe = try await session.respond( + to: Prompt(description), + generating: TextureRecipe.self + ) +} diff --git a/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo02.swift b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo02.swift new file mode 100644 index 0000000..619d3e0 --- /dev/null +++ b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo02.swift @@ -0,0 +1,41 @@ +// +// ProceduralTextureDemo02.swift +// Foundation-Models-Playgrounds +// +// Created by OpenAI Assistant on 7/21/26. +// + +import FoundationModels +import Playgrounds +import RealityKit +import SwiftUI + +@Generable(description: "Simple procedural material description for RealityKit.") +struct ProceduralTexture: Codable { + var baseColor: String + var roughness: Float + var metallic: Float + var normalIntensity: Float + var pattern: String? +} + +@Generable(description: "Procedural material parameters derived from text adjectives.") +struct TextureRecipe { + var adjectives: [String] + var texture: ProceduralTexture + @Guide(description: "Tips for further tweaking in Reality Composer Pro.") + var authorNotes: String +} + +#Playground { + let description = "rough emerald stone with speckles" + let instruction = """ + Turn the adjective phrase into a procedural material recipe suitable for RealityKit's `SimpleMaterial`. + Fill `ProceduralTexture` fields; choose pattern names that standard shaders can emulate. + """ + let session = LanguageModelSession(instructions: instruction) + let recipe = try await session.respond( + to: Prompt(description), + generating: TextureRecipe.self + ) +} diff --git a/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo03.swift b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo03.swift new file mode 100644 index 0000000..683ae71 --- /dev/null +++ b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo03.swift @@ -0,0 +1,41 @@ +// +// ProceduralTextureDemo03.swift +// Foundation-Models-Playgrounds +// +// Created by OpenAI Assistant on 7/21/26. +// + +import FoundationModels +import Playgrounds +import RealityKit +import SwiftUI + +@Generable(description: "Simple procedural material description for RealityKit.") +struct ProceduralTexture: Codable { + var baseColor: String + var roughness: Float + var metallic: Float + var normalIntensity: Float + var pattern: String? +} + +@Generable(description: "Procedural material parameters derived from text adjectives.") +struct TextureRecipe { + var adjectives: [String] + var texture: ProceduralTexture + @Guide(description: "Tips for further tweaking in Reality Composer Pro.") + var authorNotes: String +} + +#Playground { + let description = "soft sky blue fabric with diagonal weave" + let instruction = """ + Turn the adjective phrase into a procedural material recipe suitable for RealityKit's `SimpleMaterial`. + Fill `ProceduralTexture` fields; choose pattern names that standard shaders can emulate. + """ + let session = LanguageModelSession(instructions: instruction) + let recipe = try await session.respond( + to: Prompt(description), + generating: TextureRecipe.self + ) +} diff --git a/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo04.swift b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo04.swift new file mode 100644 index 0000000..066dedf --- /dev/null +++ b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo04.swift @@ -0,0 +1,41 @@ +// +// ProceduralTextureDemo04.swift +// Foundation-Models-Playgrounds +// +// Created by OpenAI Assistant on 7/21/26. +// + +import FoundationModels +import Playgrounds +import RealityKit +import SwiftUI + +@Generable(description: "Simple procedural material description for RealityKit.") +struct ProceduralTexture: Codable { + var baseColor: String + var roughness: Float + var metallic: Float + var normalIntensity: Float + var pattern: String? +} + +@Generable(description: "Procedural material parameters derived from text adjectives.") +struct TextureRecipe { + var adjectives: [String] + var texture: ProceduralTexture + @Guide(description: "Tips for further tweaking in Reality Composer Pro.") + var authorNotes: String +} + +#Playground { + let description = "weathered bronze with patina streaks" + let instruction = """ + Turn the adjective phrase into a procedural material recipe suitable for RealityKit's `SimpleMaterial`. + Fill `ProceduralTexture` fields; choose pattern names that standard shaders can emulate. + """ + let session = LanguageModelSession(instructions: instruction) + let recipe = try await session.respond( + to: Prompt(description), + generating: TextureRecipe.self + ) +} diff --git a/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo05.swift b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo05.swift new file mode 100644 index 0000000..00afca1 --- /dev/null +++ b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo05.swift @@ -0,0 +1,41 @@ +// +// ProceduralTextureDemo05.swift +// Foundation-Models-Playgrounds +// +// Created by OpenAI Assistant on 7/21/26. +// + +import FoundationModels +import Playgrounds +import RealityKit +import SwiftUI + +@Generable(description: "Simple procedural material description for RealityKit.") +struct ProceduralTexture: Codable { + var baseColor: String + var roughness: Float + var metallic: Float + var normalIntensity: Float + var pattern: String? +} + +@Generable(description: "Procedural material parameters derived from text adjectives.") +struct TextureRecipe { + var adjectives: [String] + var texture: ProceduralTexture + @Guide(description: "Tips for further tweaking in Reality Composer Pro.") + var authorNotes: String +} + +#Playground { + let description = "frosty ice crystal with ridges" + let instruction = """ + Turn the adjective phrase into a procedural material recipe suitable for RealityKit's `SimpleMaterial`. + Fill `ProceduralTexture` fields; choose pattern names that standard shaders can emulate. + """ + let session = LanguageModelSession(instructions: instruction) + let recipe = try await session.respond( + to: Prompt(description), + generating: TextureRecipe.self + ) +} diff --git a/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo06.swift b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo06.swift new file mode 100644 index 0000000..65d7094 --- /dev/null +++ b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo06.swift @@ -0,0 +1,41 @@ +// +// ProceduralTextureDemo06.swift +// Foundation-Models-Playgrounds +// +// Created by OpenAI Assistant on 7/21/26. +// + +import FoundationModels +import Playgrounds +import RealityKit +import SwiftUI + +@Generable(description: "Simple procedural material description for RealityKit.") +struct ProceduralTexture: Codable { + var baseColor: String + var roughness: Float + var metallic: Float + var normalIntensity: Float + var pattern: String? +} + +@Generable(description: "Procedural material parameters derived from text adjectives.") +struct TextureRecipe { + var adjectives: [String] + var texture: ProceduralTexture + @Guide(description: "Tips for further tweaking in Reality Composer Pro.") + var authorNotes: String +} + +#Playground { + let description = "glossy black marble with white veins" + let instruction = """ + Turn the adjective phrase into a procedural material recipe suitable for RealityKit's `SimpleMaterial`. + Fill `ProceduralTexture` fields; choose pattern names that standard shaders can emulate. + """ + let session = LanguageModelSession(instructions: instruction) + let recipe = try await session.respond( + to: Prompt(description), + generating: TextureRecipe.self + ) +} diff --git a/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo07.swift b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo07.swift new file mode 100644 index 0000000..f0cef91 --- /dev/null +++ b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo07.swift @@ -0,0 +1,41 @@ +// +// ProceduralTextureDemo07.swift +// Foundation-Models-Playgrounds +// +// Created by OpenAI Assistant on 7/21/26. +// + +import FoundationModels +import Playgrounds +import RealityKit +import SwiftUI + +@Generable(description: "Simple procedural material description for RealityKit.") +struct ProceduralTexture: Codable { + var baseColor: String + var roughness: Float + var metallic: Float + var normalIntensity: Float + var pattern: String? +} + +@Generable(description: "Procedural material parameters derived from text adjectives.") +struct TextureRecipe { + var adjectives: [String] + var texture: ProceduralTexture + @Guide(description: "Tips for further tweaking in Reality Composer Pro.") + var authorNotes: String +} + +#Playground { + let description = "velvet crimson with fine texture" + let instruction = """ + Turn the adjective phrase into a procedural material recipe suitable for RealityKit's `SimpleMaterial`. + Fill `ProceduralTexture` fields; choose pattern names that standard shaders can emulate. + """ + let session = LanguageModelSession(instructions: instruction) + let recipe = try await session.respond( + to: Prompt(description), + generating: TextureRecipe.self + ) +} diff --git a/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo08.swift b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo08.swift new file mode 100644 index 0000000..9df5563 --- /dev/null +++ b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo08.swift @@ -0,0 +1,41 @@ +// +// ProceduralTextureDemo08.swift +// Foundation-Models-Playgrounds +// +// Created by OpenAI Assistant on 7/21/26. +// + +import FoundationModels +import Playgrounds +import RealityKit +import SwiftUI + +@Generable(description: "Simple procedural material description for RealityKit.") +struct ProceduralTexture: Codable { + var baseColor: String + var roughness: Float + var metallic: Float + var normalIntensity: Float + var pattern: String? +} + +@Generable(description: "Procedural material parameters derived from text adjectives.") +struct TextureRecipe { + var adjectives: [String] + var texture: ProceduralTexture + @Guide(description: "Tips for further tweaking in Reality Composer Pro.") + var authorNotes: String +} + +#Playground { + let description = "matte olive drab with camo blotches" + let instruction = """ + Turn the adjective phrase into a procedural material recipe suitable for RealityKit's `SimpleMaterial`. + Fill `ProceduralTexture` fields; choose pattern names that standard shaders can emulate. + """ + let session = LanguageModelSession(instructions: instruction) + let recipe = try await session.respond( + to: Prompt(description), + generating: TextureRecipe.self + ) +} diff --git a/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo09.swift b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo09.swift new file mode 100644 index 0000000..df70088 --- /dev/null +++ b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo09.swift @@ -0,0 +1,41 @@ +// +// ProceduralTextureDemo09.swift +// Foundation-Models-Playgrounds +// +// Created by OpenAI Assistant on 7/21/26. +// + +import FoundationModels +import Playgrounds +import RealityKit +import SwiftUI + +@Generable(description: "Simple procedural material description for RealityKit.") +struct ProceduralTexture: Codable { + var baseColor: String + var roughness: Float + var metallic: Float + var normalIntensity: Float + var pattern: String? +} + +@Generable(description: "Procedural material parameters derived from text adjectives.") +struct TextureRecipe { + var adjectives: [String] + var texture: ProceduralTexture + @Guide(description: "Tips for further tweaking in Reality Composer Pro.") + var authorNotes: String +} + +#Playground { + let description = "sparkling silver glitter surface" + let instruction = """ + Turn the adjective phrase into a procedural material recipe suitable for RealityKit's `SimpleMaterial`. + Fill `ProceduralTexture` fields; choose pattern names that standard shaders can emulate. + """ + let session = LanguageModelSession(instructions: instruction) + let recipe = try await session.respond( + to: Prompt(description), + generating: TextureRecipe.self + ) +} diff --git a/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo10.swift b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo10.swift new file mode 100644 index 0000000..b915383 --- /dev/null +++ b/Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo10.swift @@ -0,0 +1,41 @@ +// +// ProceduralTextureDemo10.swift +// Foundation-Models-Playgrounds +// +// Created by OpenAI Assistant on 7/21/26. +// + +import FoundationModels +import Playgrounds +import RealityKit +import SwiftUI + +@Generable(description: "Simple procedural material description for RealityKit.") +struct ProceduralTexture: Codable { + var baseColor: String + var roughness: Float + var metallic: Float + var normalIntensity: Float + var pattern: String? +} + +@Generable(description: "Procedural material parameters derived from text adjectives.") +struct TextureRecipe { + var adjectives: [String] + var texture: ProceduralTexture + @Guide(description: "Tips for further tweaking in Reality Composer Pro.") + var authorNotes: String +} + +#Playground { + let description = "translucent amber resin with trapped bubbles" + let instruction = """ + Turn the adjective phrase into a procedural material recipe suitable for RealityKit's `SimpleMaterial`. + Fill `ProceduralTexture` fields; choose pattern names that standard shaders can emulate. + """ + let session = LanguageModelSession(instructions: instruction) + let recipe = try await session.respond( + to: Prompt(description), + generating: TextureRecipe.self + ) +} diff --git a/README.md b/README.md index 2cd03d5..39c8222 100644 --- a/README.md +++ b/README.md @@ -187,6 +187,16 @@ This repository contains a collection of Swift playgrounds demonstrating how to 143. [`ReWOO.swift`](Foundation-Models-Playgrounds/Playgrounds/ReWOO.swift) – Plans tool usage up front. 144. [`MultiAgentSimulation.swift`](Foundation-Models-Playgrounds/Playgrounds/MultiAgentSimulation.swift) – Simulates multiple agent roles. 145. [`RetrievalAugmented.swift`](Foundation-Models-Playgrounds/Playgrounds/RetrievalAugmented.swift) – Uses retrieval before answering. +146. [`ProceduralTextureDemo01.swift`](Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo01.swift) – Derives RealityKit material settings from adjectives. +147. [`ProceduralTextureDemo02.swift`](Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo02.swift) – Derives RealityKit material settings from adjectives. +148. [`ProceduralTextureDemo03.swift`](Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo03.swift) – Derives RealityKit material settings from adjectives. +149. [`ProceduralTextureDemo04.swift`](Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo04.swift) – Derives RealityKit material settings from adjectives. +150. [`ProceduralTextureDemo05.swift`](Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo05.swift) – Derives RealityKit material settings from adjectives. +151. [`ProceduralTextureDemo06.swift`](Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo06.swift) – Derives RealityKit material settings from adjectives. +152. [`ProceduralTextureDemo07.swift`](Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo07.swift) – Derives RealityKit material settings from adjectives. +153. [`ProceduralTextureDemo08.swift`](Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo08.swift) – Derives RealityKit material settings from adjectives. +154. [`ProceduralTextureDemo09.swift`](Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo09.swift) – Derives RealityKit material settings from adjectives. +155. [`ProceduralTextureDemo10.swift`](Foundation-Models-Playgrounds/Playgrounds/ProceduralTextureDemo10.swift) – Derives RealityKit material settings from adjectives.