Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Smart Scene Composer

A Next.js full-stack MVP application for the Bria FIBO Hackathon that enables users to generate structured scene compositions with live image previews using AI-powered scene generation.

🎯 Project Overview

Smart Scene Composer is an intelligent tool that transforms simple text descriptions into detailed, structured JSON prompts and generates corresponding images. Users can type a scene description, and the application will:

  1. Generate a structured JSON prompt using Bria AI's FIBO LLM
  2. Create a live preview image based on the structured prompt
  3. Allow real-time control adjustments (camera angle, FOV, lighting, color palette, HDR)
  4. Export both JSON and image files for production use

Hackathon: Bria FIBO Hackathon

✨ Features

  • Scene Input: Type natural language descriptions (e.g., "futuristic cyberpunk city at sunset")
  • FIBO Integration: Backend API route proxies requests to Bria AI FIBO API, returning structured JSON
  • Live Preview: Images update automatically with control changes
  • Interactive Controls Panel:
    • Camera angle slider (0–360°)
    • FOV slider (20–120)
    • Lighting intensity slider (0–100)
    • Color palette multi-select
    • HDR toggle
  • Export Functionality: Download JSON + image files for production use
  • Responsive Design: Modern UI with dark mode support
  • Real-time Updates: Automatic preview generation when controls change

🛠️ Tech Stack

  • Framework: Next.js 16 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS 4
  • API Integration: Bria AI FIBO API
  • Deployment: Vercel-ready

📋 Prerequisites

  • Node.js 18+
  • npm, yarn, pnpm, or bun
  • Bria AI API Key (get one at Bria Platform)

🚀 Getting Started

1. Clone the Repository

git clone <repository-url>
cd smart-scene-composer

2. Install Dependencies

npm install
# or
yarn install
# or
pnpm install

3. Environment Setup

Create a .env.local file in the root directory:

FIBO_API_KEY=your_bria_api_key_here

Getting Your API Key:

  1. Visit Bria Platform
  2. Sign up or log in
  3. Navigate to API Keys section
  4. Copy your Production API key
  5. Paste it in .env.local

4. Run Development Server

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 in your browser.

📁 Project Structure

smart-scene-composer/
│
├── app/
│   ├── api/
│   │   └── fibo/
│   │       └── route.ts          # Backend API route (proxies to Bria AI)
│   ├── page.tsx                  # Main frontend page
│   ├── layout.tsx                # Root layout
│   └── globals.css               # Global styles
│
├── components/
│   ├── SceneInput.tsx            # Scene description input
│   ├── ControlsPanel.tsx         # Sliders & toggles for controls
│   ├── PreviewImage.tsx          # Live preview display
│   └── ExportButton.tsx          # JSON + image export functionality
│
├── hooks/
│   └── useSceneState.ts          # Custom hook for state management
│
├── .env.local                    # Environment variables (not in git)
├── package.json
├── next.config.ts
└── README.md

🎮 Usage

  1. Enter Scene Description: Type a scene description in the text area (e.g., "futuristic cyberpunk city at sunset")
  2. Click Generate: Click the "Generate" button to create structured JSON and preview image
  3. Adjust Controls: Use the sliders and toggles to fine-tune:
    • Camera angle
    • Field of view (FOV)
    • Lighting intensity
    • Color palette (select multiple colors)
    • HDR mode
  4. View Results:
    • See the generated image in the preview panel
    • Review the structured JSON below the image
  5. Export: Click "Export JSON + Image" to download both files

🔌 API Integration

The application uses Bria AI's FIBO API with a two-step process:

  1. Structured Prompt Generation (/v2/structured_prompt/generate):

    • Converts text input into detailed JSON structured prompts
    • Returns comprehensive scene descriptions with objects, lighting, aesthetics, etc.
  2. Image Generation (/v2/image/generate):

    • Uses the structured prompt to generate high-quality images
    • Supports async processing with status polling

API Endpoints

  • Backend Route: /api/fibo (POST)
    • Accepts: { prompt: string, controls: object }
    • Returns: { structuredJson: object, imageUrl: string | null }

🎨 Features in Detail

Controls Panel

  • Camera Angle (0–360°): Adjust the viewing angle of the scene
  • FOV (20–120): Control the field of view
  • Lighting (0–100): Adjust lighting intensity
  • Color Palette: Multi-select from predefined color options
  • HDR: Toggle high dynamic range mode

Export Functionality

The export button downloads:

  • scene-composition.json: Complete structured JSON with all scene details
  • scene-preview.png: Generated preview image

🚢 Deployment

Deploy to Vercel

  1. Push your code to GitHub
  2. Import project in Vercel
  3. Add environment variable:
    • FIBO_API_KEY: Your Bria AI API key
  4. Deploy!

The app is optimized for Vercel deployment with Next.js App Router.

🔧 Development

Available Scripts

npm run dev      # Start development server
npm run build    # Build for production
npm run start    # Start production server
npm run lint     # Run ESLint

Code Structure

  • Components: Reusable React components with TypeScript
  • Hooks: Custom React hooks for state management
  • API Routes: Server-side API routes for secure API key handling
  • Styling: Tailwind CSS with dark mode support

📝 Example Usage

Input:

"futuristic cyberpunk city at sunset"

Output:

  • Structured JSON with detailed scene description, objects, lighting, aesthetics
  • High-quality generated image matching the description

🤝 Contributing

This is a hackathon project. Contributions and improvements are welcome!

📄 License

This project is created for the Bria FIBO Hackathon.

🔗 Links

💡 Tips

  • Use descriptive scene descriptions for better results
  • Experiment with different control combinations
  • The structured JSON can be reused for consistent scene generation
  • Images are generated asynchronously - be patient during generation

Built with ❤️ for the Bria FIBO Hackathon

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages