# Blender Rendering

Blender का उपयोग करके CLORE.AI GPUs पर 3D दृश्यों और एनीमेशन को रेंडर करें।

{% hint style="success" %}
सभी उदाहरण GPU सर्वरों पर चलाए जा सकते हैं जिन्हें द्वारा किराए पर लिया गया है [CLORE.AI मार्केटप्लेस](https://clore.ai/marketplace).
{% endhint %}

## CLORE.AI पर किराये पर लेना

1. पर जाएँ [CLORE.AI मार्केटप्लेस](https://clore.ai/marketplace)
2. GPU प्रकार, VRAM, और मूल्य के अनुसार फ़िल्टर करें
3. चुनें **ऑन-डिमांड** (निश्चित दर) या **स्पॉट** (बिड प्राइस)
4. अपना ऑर्डर कॉन्फ़िगर करें:
   * Docker इमेज चुनें
   * पोर्ट सेट करें (SSH के लिए TCP, वेब UI के लिए HTTP)
   * यदि आवश्यक हो तो एनवायरनमेंट वेरिएबल जोड़ें
   * स्टार्टअप कमांड दर्ज करें
5. भुगतान चुनें: **CLORE**, **BTC**, या **USDT/USDC**
6. ऑर्डर बनाएं और डिप्लॉयमेंट का इंतज़ार करें

### अपने सर्वर तक पहुँचें

* कनेक्शन विवरण में खोजें **मेरे ऑर्डर**
* वेब इंटरफेस: HTTP पोर्ट URL का उपयोग करें
* SSH: `ssh -p <port> root@<proxy-address>`

## Blender के लिए GPU किराए पर क्यों लें?

* CPU की तुलना में जटिल दृश्यों को 10-50x तेज़ रेंडर करें
* और भी तेज़ रेंडरिंग के लिए कई GPUs
* महंगे हार्डवेयर में निवेश करने की आवश्यकता नहीं
* केवल रेंडर समय के लिए भुगतान करें

## आवश्यकताएँ

| दृश्य जटिलता | अनुशंसित GPU | VRAM    |
| ------------ | ------------ | ------- |
| सरल          | RTX 3070     | 8GB     |
| मध्यम        | RTX 3090     | 24GB    |
| जटिल         | RTX 4090     | 24GB    |
| प्रोडक्शन    | A100         | 40-80GB |

## त्वरित तैनाती

**Docker इमेज:**

```
linuxserver/blender
```

या हेडलेस रेंडरिंग:

```
nytimes/blender:3.6-gpu-ubuntu22.04
```

**पोर्ट:**

```
22/tcp
3000/http
```

## हेडलेस रेंडरिंग सेटअप

**इमेज:**

```
nvidia/cuda:12.1.0-devel-ubuntu22.04
```

**कमांड:**

```bash
apt-get update && \
apt-get install -y wget libxi6 libxxf86vm1 libxfixes3 libxrender1 libgl1 && \
wget https://download.blender.org/release/Blender4.0/blender-4.0.2-linux-x64.tar.xz && \
tar -xf blender-4.0.2-linux-x64.tar.xz && \
mv blender-4.0.2-linux-x64 /opt/blender
```

## अपनी सेवा तक पहुँचना

डिप्लॉयमेंट के बाद, अपना खोजें `http_pub` URL में **मेरे ऑर्डर**:

1. जाएँ **मेरे ऑर्डर** पृष्ठ
2. अपने ऑर्डर पर क्लिक करें
3. खोजें `http_pub` URL (उदा., `abc123.clorecloud.net`)

उपयोग करें `https://YOUR_HTTP_PUB_URL` की बजाय `localhost` नीचे दिए उदाहरणों में।

## अपना प्रोजेक्ट अपलोड करें

### SCP के माध्यम से

```bash

# .blend फ़ाइल अपलोड करें
scp -P <port> myproject.blend root@<proxy>:/workspace/

# प्रोजेक्ट फ़ोल्डर अपलोड करें
scp -P <port> -r ./project/ root@<proxy>:/workspace/
```

### rsync के माध्यम से (बड़े प्रोजेक्ट्स)

```bash
rsync -avz --progress -e "ssh -p <port>" ./project/ root@<proxy>:/workspace/project/
```

## रेंडर कमांड्स

### सिंगल फ्रेम

```bash
/opt/blender/blender -b /workspace/myproject.blend -o /workspace/output/frame_### -f 1 -- --cycles-device CUDA
```

### एनीमेशन (फ्रेम रेंज)

```bash
/opt/blender/blender -b /workspace/myproject.blend -o /workspace/output/frame_### -s 1 -e 250 -a -- --cycles-device CUDA
```

### विशिष्ट फ्रेम्स

```bash
/opt/blender/blender -b /workspace/myproject.blend -o /workspace/output/frame_### -f 1,50,100,150,200 -- --cycles-device CUDA
```

## रेंडर विकल्प

### रिज़ॉल्यूशन

```bash

# रेज़ॉल्यूशन ओवरराइड करें
blender -b file.blend -o //output/frame_### -x 1920 -y 1080 -a -- --cycles-device CUDA
```

### Python स्क्रिप्ट का उपयोग करें

```bash
blender -b file.blend --python render_setup.py -a
```

**render\_setup.py:**

```python
import bpy

# रेंडर इंजन सेट करें
bpy.context.scene.render.engine = 'CYCLES'

# डिवाइस सेट करें
bpy.context.preferences.addons['cycles'].preferences.compute_device_type = 'CUDA'

# सभी GPUs सक्षम करें
for device in bpy.context.preferences.addons['cycles'].preferences.devices:
    device.use = True

# सैंपल्स सेट करें
bpy.context.scene.cycles.samples = 128

# रेज़ॉल्यूशन सेट करें
bpy.context.scene.render.resolution_x = 1920
bpy.context.scene.render.resolution_y = 1080

# आउटपुट सेटिंग्स
bpy.context.scene.render.image_settings.file_format = 'PNG'
```

## मल्टी-GPU रेंडरिंग

कई GPUs वाले सर्वरों के लिए:

```python
import bpy

# CUDA सक्षम करें
prefs = bpy.context.preferences.addons['cycles'].preferences
prefs.compute_device_type = 'CUDA'

# डिवाइस रिफ्रेश करें
prefs.get_devices()

# सभी GPUs सक्षम करें
for device in prefs.devices:
    if device.type == 'CUDA':
        device.use = True
        print(f"Enabled: {device.name}")
```

## रेंडर फार्म शैली (कई सर्वर)

कई सर्वर किराये पर लें और फ्रेम्स विभाजित करें:

**सर्वर 1:**

```bash
blender -b project.blend -o //output/frame_### -s 1 -e 100 -a
```

**सर्वर 2:**

```bash
blender -b project.blend -o //output/frame_### -s 101 -e 200 -a
```

**सर्वर 3:**

```bash
blender -b project.blend -o //output/frame_### -s 201 -e 300 -a
```

फिर लोकली रेंडर्स को संयोजित करें।

## Eevee रेंडरिंग (तेज़)

रीयल-टाइम क्वालिटी के लिए:

```bash
blender -b file.blend -E BLENDER_EEVEE -o //output/frame_### -a
```

## OptiX सपोर्ट (RTX GPUs)

RTX रे ट्रेसिंग के लिए:

```python
import bpy
prefs = bpy.context.preferences.addons['cycles'].preferences
prefs.compute_device_type = 'OPTIX'  # CUDA के बजाय
```

## ऑटोमेटेड रेंडर स्क्रिप्ट

**render.sh:**

```bash
#!/bin/bash
BLEND_FILE=$1
START_FRAME=$2
END_FRAME=$3
OUTPUT_DIR=/workspace/output

mkdir -p $OUTPUT_DIR

/opt/blender/blender -b $BLEND_FILE \
    -o ${OUTPUT_DIR}/frame_### \
    -s $START_FRAME \
    -e $END_FRAME \
    -a \
    -- --cycles-device CUDA

echo "Rendering complete!"
ls -la $OUTPUT_DIR
```

उपयोग:

```bash
chmod +x render.sh
./render.sh /workspace/myproject.blend 1 250
```

## रेंडर प्रगति की निगरानी

### आउटपुट फ़ोल्डर देखें

```bash
watch -n 5 'ls -la /workspace/output/ | tail -20'
```

### Blender आउटपुट

Blender stdout में फ्रेम प्रगति प्रिंट करता है:

```
Fra:1 Mem:1234.56M (Peak 1500.00M) | Time:00:01.23 | Remaining:04:32.10 | Mem:567.89M, Peak:890.12M | Scene, View Layer | Sample 64/128
```

## रेंडर किए गए फ्रेम डाउनलोड करें

```bash

# सभी फ्रेम डाउनलोड करें
scp -P <port> -r root@<proxy>:/workspace/output/ ./renders/

# विशिष्ट फ्रेम डाउनलोड करें
scp -P <port> root@<proxy>:/workspace/output/frame_001.png ./

# rsync के साथ सिंक करें
rsync -avz --progress -e "ssh -p <port>" root@<proxy>:/workspace/output/ ./renders/
```

## वीडियो एन्कोडिंग

फ्रेम रेंडर करने के बाद, वीडियो के लिए एन्कोड करें:

```bash

# ffmpeg इंस्टॉल करें
apt-get install -y ffmpeg

# MP4 में एन्कोड करें
ffmpeg -framerate 24 -i /workspace/output/frame_%03d.png -c:v libx264 -pix_fmt yuv420p output.mp4

# ProRes में एन्कोड करें (उच्च गुणवत्ता)
ffmpeg -framerate 24 -i /workspace/output/frame_%03d.png -c:v prores_ks -profile:v 3 output.mov
```

## प्रदर्शन टिप्स

### स्पीड के लिए ऑप्टिमाइज़ करें

```python

# प्रीव्यू के लिए सैंपल्स कम करें
bpy.context.scene.cycles.samples = 64

# एडैप्टिव सैम्पलिंग का उपयोग करें
bpy.context.scene.cycles.use_adaptive_sampling = True
bpy.context.scene.cycles.adaptive_threshold = 0.01

# बाउंस सीमित करें
bpy.context.scene.cycles.max_bounces = 8
```

### मेमोरी अनुकूलन

```python

# उच्च-रेज़ के लिए टाइल्ड रेंडरिंग का उपयोग करें
bpy.context.scene.render.use_persistent_data = True

# टाइल साइज सेट करें
bpy.context.scene.cycles.tile_size = 256  # GPU के लिए
```

## रेंडर समय अनुमान

| दृश्य     | GPU      | रिज़ॉल्यूशन | सैंपल्स | समय/फ्रेम |
| --------- | -------- | ----------- | ------- | --------- |
| सरल       | RTX 3090 | 1080p       | 128     | \~30s     |
| मध्यम     | RTX 3090 | 1080p       | 256     | \~2min    |
| जटिल      | RTX 4090 | 4K          | 512     | \~10min   |
| प्रोडक्शन | A100     | 4K          | 1024    | \~20min   |

## लागत गणना

**उदाहरण: 250 फ्रेम एनीमेशन**

```
GPU: RTX 4090
प्रति फ्रेम समय: 2 मिनट
कुल रेंडर समय: 500 मिनट = 8.3 घंटे
घंटा दर: $0.04
कुल लागत: ~$0.33
```

## समस्याओं का निवारण

### "CUDA device not found"

```python

# उपलब्ध डिवाइस जांचें
import bpy
prefs = bpy.context.preferences.addons['cycles'].preferences
prefs.compute_device_type = 'CUDA'
prefs.get_devices()
for d in prefs.devices:
    print(d.name, d.type)
```

{% hint style="danger" %}
**मेमोरी खत्म**
{% endhint %}

* टेक्सचर रेज़ॉल्यूशन कम करें
* छोटा टाइल साइज उपयोग करें
* “persistent data” सक्षम करें
* सरल शेडर्स का उपयोग करें

### धीमी रेंडरिंग

* जाँच करें कि GPU उपयोग हो रहा है (nvidia-smi)
* सीन ज्योमेट्री को अनुकूलित करें
* कम सैंपल्स के साथ डीनोइज़िंग का उपयोग करें

## अगले कदम

* पोस्ट-प्रोसेसिंग के लिए Jupyter चलाएँ
* [AI वीडियो जनरेशन](/guides/guides_v2-hi/video-generation/ai-video-generation.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-hi/other-workloads/blender-rendering.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
