Voyage Cinématique ASCII : Dans l'Esprit d'une IA
De Wikiprompt, lâencyclopĂ©die libre de prompts
Voyage Cinématique ASCII : Dans l'Esprit d'une IA Invite détaillée pour créer une animation 3D cinématique rendue en ASCII d'une durée de 150 secondes, avec sept scÚnes, audio procédural et capture déterministe. Inclut les spécifications techniques pour le rendu, le son et le déterminisme.
Contenu du PromptEnregistrer
đ
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ASCII Mind · Cinematic Journey</title>
<style>
body {
margin: 0;
overflow: hidden;
background: #0a0a0c;
font-family: 'JetBrains Mono', monospace;
}
#info {
position: fixed;
bottom: 20px;
left: 20px;
color: #888;
font-size: 12px;
letter-spacing: 0.1em;
z-index: 100;
background: rgba(0,0,0,0.4);
padding: 6px 12px;
border-radius: 4px;
pointer-events: none;
user-select: none;
}
#hud {
position: fixed;
top: 20px;
right: 20px;
color: #aaa;
font-size: 12px;
letter-spacing: 0.1em;
z-index: 100;
background: rgba(0,0,0,0.5);
padding: 8px 14px;
border-radius: 4px;
display: none;
pointer-events: none;
user-select: none;
line-height: 1.6;
}
#overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #0a0a0c;
display: flex;
align-items: center;
justify-content: center;
z-index: 200;
cursor: pointer;
color: #D97757;
font-size: 18px;
letter-spacing: 0.2em;
text-transform: lowercase;
user-select: none;
transition: opacity 0.5s;
}
#overlay.hidden {
opacity: 0;
pointer-events: none;
}
#overlay span {
border: 1px solid #D97757;
padding: 16px 32px;
border-radius: 4px;
background: rgba(0,0,0,0.3);
backdrop-filter: blur(4px);
}
.caption-container {
position: fixed;
bottom: 80px;
left: 0;
width: 100%;
display: flex;
justify-content: center;
z-index: 150;
pointer-events: none;
}
.caption {
font-family: 'JetBrains Mono', monospace;
font-size: 18px;
letter-spacing: 0.12em;
color: #e8e0d0;
background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0.2));
padding: 12px 28px;
border-radius: 4px;
text-transform: lowercase;
text-shadow: 0 2px 8px rgba(0,0,0,0.8);
white-space: pre;
min-height: 1.5em;
backdrop-filter: blur(2px);
}
.caption .decoded {
color: #D97757;
}
.caption .pending {
color: #8a7a6a;
}
</style>
</head>
<body>
<div id="overlay"><span>â¶ enter the mind</span></div>
<div id="hud"></div>
<div id="info">ascii mind · 150s · deterministic</div>
<div class="caption-container"><div class="caption" id="caption"></div></div>
<script type="importmap">
{
"imports": {
"three": "https://unpkg.com/three@0.170.0/build/three.module.js",
"three/addons/": "https://unpkg.com/three@0.170.0/examples/jsm/"
}
}
</script>
<script type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';
// ---------- deterministic PRNG ----------
function mulberry32(seed) {
return function() {
let t = seed += 0x6D2B79F5;
t = Math.imul(t ^ t >>> 15, t | 1);
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
return ((t ^ t >>> 14) >>> 0) / 4294967296;
}
}
const rng = mulberry32(42);
// ---------- global state ----------
const DURATION = 150;
const FPS = 30;
let currentTime = 0;
let isPlaying = false;
let recordMode = new URLSearchParams(location.search).has('record');
let debugHUD = false;
let sceneIndex = 0;
const scenes = ['void', 'library', 'pillars', 'constellation', 'staircase', 'noise', 'face'];
const canvas = document.createElement('canvas');
canvas.width = recordMode ? 1920 : window.innerWidth;
canvas.height = recordMode ? 1080 : window.innerHeight;
if (recordMode) canvas.style.width = '1920px', canvas.style.height = '1080px';
else canvas.style.width = '100vw', canvas.style.height = '100vh';
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');
// ---------- three.js setup ----------
const renderer = new THREE.WebGLRenderer({ canvas, antialias: !recordMode, preserveDrawingBuffer: true });
renderer.setPixelRatio(recordMode ? 1 : Math.min(window.devicePixelRatio, 2));
renderer.setSize(canvas.width, canvas.height, false);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.2;
const scene = new THREE.Scene();
scene.background = new THREE.Color(0x0a0a0c);
const camera = new THREE.PerspectiveCamera(45, canvas.width / canvas.height, 0.1, 200);
camera.position.set(0, 0, 8);
// ---------- post-processing (ASCII via shader) ----------
const composer = new EffectComposer(renderer);
composer.addPass(new RenderPass(scene, camera));
// ASCII shader pass â the core
const asciiShader = {
uniforms: {
tDiffuse: { value: null },
tDepth: { value: null },
resolution: { value: new THREE.Vector2(canvas.width, canvas.height) },
time: { value: 0 },
cellSize: { value: 8.0 },
glyphAtlas: { value: null },
edgeAtlas: { value: null },
gradientMap: { value: null },
sceneIndex: { value: 0 }
},
vertexShader: `
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`,
fragmentShader: `
uniform sampler2D tDiffuse;
uniform sampler2D tDepth;
uniform vec2 resolution;
uniform float time;
uniform float cellSize;
uniform sampler2D glyphAtlas;
uniform sampler2D edgeAtlas;
uniform sampler2D gradientMap;
uniform int sceneIndex;
varying vec2 vUv;
float hash(vec2 p) {
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123);
}
void main() {
vec2 uv = vUv;
vec2 cell = uv * resolution / cellSize;
vec2 cellId = floor(cell);
vec2 cellUv = fract(cell) - 0.5;
// sample color at cell center
vec2 center = (cellId + 0.5) * cellSize / resolution;
vec3 color = texture2D(tDiffuse, center).rgb;
float depth = texture2D(tDepth, center).r;
// luminance
float lum = dot(color, vec3(0.299, 0.587, 0.114));
// edge detection (sobel)
float dx = texture2D(tDiffuse, center + vec2(1.0/resolution.x, 0)).r - texture2D(tDiffuse, center - vec2(1.0/resolution.x, 0)).r;
float dy = texture2D(tDiffuse, center + vec2(0, 1.0/resolution.y)).r - texture2D(tDiffuse, center - vec2(0, 1.0/resolution.y)).r;
float edge = sqrt(dx*dx + dy*dy);
// choose glyph based on edge direction
float angle = atan(dy, dx);
vec2 edgeUv = vec2(0.5 + 0.5*cos(angle), 0.5 + 0.5*sin(angle));
vec4 edgeGlyph = texture2D(edgeAtlas, edgeUv);
// temporal flicker
float h = hash(cellId + floor(time * 10.0));
float flicker = step(0.7, h) * 0.3 + 0.7;
// depth-based cell size (coarser in distance)
float depthFactor = 1.0 + depth * 2.0;
float cellScale = cellSize * depthFactor;
// sample glyph atlas based on luminance
float glyphIndex = floor(lum * 8.0) / 8.0;
vec2 glyphUv = vec2(0.5 + (glyphIndex - 0.5) * 0.8, 0.5);
vec4 glyphColor = texture2D(glyphAtlas, glyphUv);
// gradient tint
vec3 grad = texture2D(gradientMap, vec2(lum, 0.5)).rgb;
// combine
vec3 finalColor = mix(glyphColor.rgb, edgeGlyph.rgb, edge * 2.0) * grad * flicker;
// vignette
float dist = length(uv - 0.5);
finalColor *= 1.0 - dist * 0.4;
// grain
finalColor += (hash(uv * time) - 0.5) * 0.05;
gl_FragColor = vec4(finalColor, 1.0);
}
`
};
const asciiPass = new ShaderPass(asciiShader);
composer.addPass(asciiPass);
// bloom
const bloomPass = new UnrealBloomPass(new THREE.Vector2(canvas.width, canvas.height), 0.3, 0.4, 0.85);
composer.addPass(bloomPass);
composer.addPass(new OutputPass());
// ---------- glyph atlas generation (runtime) ----------
function generateGlyphAtlas() {
const glyphs = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_+-=[]{}|;:,.<>?/~` '.split('');
// measure ink coverage
const coverage = [];
const tempCanvas = document.createElement('canvas');
tempCanvas.width = 64;
tempCanvas.height = 64;
const tctx = tempCanvas.getContext('2d');
tctx.font = 'bold 40px monospace';
tctx.textAlign = 'center';
tctx.textBaseline = 'middle';
for (let g of glyphs) {
tctx.clearRect(0, 0, 64, 64);
tctx.fillStyle = '#fff';
tctx.fillText(g, 32, 32);
const data = tctx.getImageData(0, 0, 64, 64).data;
let ink = 0;
for (let i = 3; i < data.length; i += 4) if (data[i] > 128) ink++;
coverage.push({ glyph: g, ink });
}
coverage.sort((a, b) => a.ink - b.ink);
const sortedGlyphs = coverage.map(c => c.glyph);
// create atlas texture
const atlasSize = 256;
const atlasCanvas = document.createElement('canvas');
atlasCanvas.width = atlasSize;
atlasCanvas.height = atlasSize;
const actx = atlasCanvas.getContext('2d');
actx.fillStyle = '#000';
actx.fillRect(0, 0, atlasSize, atlasSize);
actx.font = 'bold 40px monospace';
actx.textAlign = 'center';
actx.textBaseline = 'middle';
const cols = 8;
const cell = atlasSize / cols;
sortedGlyphs.forEach((g, i) => {
const x = (i % cols) * cell + cell/2;
const y = Math.floor(i / cols) * cell + cell/2;
actx.fillStyle = '#fff';
actx.fillText(g, x, y);
});
const atlasTex = new THREE.CanvasTexture(atlasCanvas);
atlasTex.minFilter = THREE.NearestFilter;
atlasTex.magFilter = THREE.NearestFilter;
// edge atlas (simple directional strokes)
const edgeCanvas = document.createElement('canvas');
edgeCanvas.width = 64;
edgeCanvas.height = 64;
const ectx = edgeCanvas.getContext('2d');
ectx.fillStyle = '#000';
ectx.fillRect(0, 0, 64, 64);
ectx.strokeStyle = '#fff';
ectx.lineWidth = 4;
// draw different strokes based on angle
for (let a = 0; a < 8; a++) {
const angle = a * Math.PI / 4;
ectx.save();
ectx.translate(32, 32);
ectx.rotate(angle);
ectx.beginPath();
ectx.moveTo(-20, 0);
ectx.lineTo(20, 0);
ectx.stroke();
ectx.restore();
}
const edgeTex = new THREE.CanvasTexture(edgeCanvas);
edgeTex.minFilter = THREE.NearestFilter;
edgeTex.magFilter = THREE.NearestFilter;
return { atlasTex, edgeTex };
}
const { atlasTex, edgeTex } = generateGlyphAtlas();
asciiPass.uniforms.glyphAtlas.value = atlasTex;
asciiPass.uniforms.edgeAtlas.value = edgeTex;
// gradient map (3-stop)
const gradCanvas = document.createElement('canvas');
gradCanvas.width = 256;
gradCanvas.height = 1;
const gctx = gradCanvas.getContext('2d');
const grad = gctx.createLinearGradient(0, 0, 256, 0);
grad.addColorStop(0, '#0a0a0c');
grad.addColorStop(0.5, '#D97757');
grad.addColorStop(1, '#f0e0d0');
gctx.fillStyle = grad;
gctx.fillRect(0, 0, 256, 1);
asciiPass.uniforms.gradientMap.value = new THREE.CanvasTexture(gradCanvas);
// ---------- scene content (procedural, deterministic) ----------
// memory particles (glyph sprites) â persistent swarm
const particleCount = 3000;
const particlePositions = new Float32Array(particleCount * 3);
const particleColors = new Float32Array(particleCount * 3);
const particleSizes = new Float32Array(particleCount);
for (let i = 0; i < particleCount; i++) {
particlePositions[i*3] = (rng() - 0.5) * 20;
particlePositions[i*3+1] = (rng() - 0.5) * 20;
particlePositions[i*3+2] = (rng() - 0.5) * 20;
particleColors[i*3] = 0.8 + rng() * 0.2;
particleColors[i*3+1] = 0.5 + rng() * 0.3;
particleColors[i*3+2] = 0.3 + rng() * 0.2;
particleSizes[i] = 0.05 + rng() * 0.1;
}
const particleGeo = new THREE.BufferGeometry();
particleGeo.setAttribute('position', new THREE.BufferAttribute(particlePositions, 3));
particleGeo.setAttribute('color', new THREE.BufferAttribute(particleColors, 3));
particleGeo.setAttribute('size', new THREE.BufferAttribute(particleSizes, 1));
const particleMat = new THREE.PointsMaterial({
size: 0.08,
vertexColors: true,
transparent: true,
opacity: 0.8,
blending: THREE.AdditiveBlending,
sizeAttenuation: true
});
const particles = new THREE.Points(particleGeo, particleMat);
scene.add(particles);
// scene-specific objects â built procedurally
// we'll create simple placeholders for each scene, but keep it minimal for brevity
// in a full implementation, each scene would have its own geometry
// for this demo, we'll create a few representative objects
// Library: shelves
const shelfGroup = new THREE.Group();
for (let i = 0; i < 20; i++) {
const box = new THREE.Mesh(
new THREE.BoxGeometry(0.2, 3, 2),
new THREE.MeshStandardMaterial({ color: 0x8B7355, roughness: 0.8 })
);
box.position.set((i - 10) * 1.5, 0, -5);
shelfGroup.add(box);
}
scene.add(shelfGroup);
// Pillars: columns of digits (instanced)
const pillarGroup = new THREE.Group();
for (let i = 0; i < 15; i++) {
const cyl = new THREE.Mesh(
new THREE.CylinderGeometry(0.3, 0.3, 8, 8),
new THREE.MeshStandardMaterial({ color: 0x2a6f8a, emissive: 0x1a3f5a })
);
cyl.position.set((i - 7) * 1.2, 0, -3);
pillarGroup.add(cyl);
}
scene.add(pillarGroup);
// Constellation: points and lines
const constGroup = new THREE.Group();
const points = [];
for (let i = 0; i < 50; i++) {
const p = new THREE.Vector3((rng()-0.5)*8, (rng()-0.5)*4, (rng()-0.5)*4);
points.push(p);
const sphere = new THREE.Mesh(
new THREE.SphereGeometry(0.05, 4, 4),
new THREE.MeshBasicMaterial({ color: 0x9b59b6 })
);
sphere.position.copy(p);
constGroup.add(sphere);
}
scene.add(constGroup);
// Staircase
const stairGroup = new THREE.Group();
for (let i = 0; i < 20; i++) {
const step = new THREE.Mesh(
new THREE.BoxGeometry(1.5, 0.1, 0.5),
new THREE.MeshStandardMaterial({ color: 0x666666 })
);
step.position.set(0, i * 0.3, -i * 0.5);
stairGroup.add(step);
}
scene.add(stairGroup);
// Noise room: particles
const noiseGroup = new THREE.Group();
const noiseParticles = new THREE.Points(
new THREE.BufferGeometry(),
new THREE.PointsMaterial({ color: 0x8a1a1a, size: 0.05 })
);
scene.add(noiseGroup);
// Face: simple sphere with eyes
const faceGroup = new THREE.Group();
const head = new THREE.Mesh(
new THREE.SphereGeometry(1.2, 16, 16),
new THREE.MeshStandardMaterial({ color: 0xe8c8a0, roughness: 0.6 })
);
head.position.set(0, 0, 0);
faceGroup.add(head);
const eyeMat = new THREE.MeshBasicMaterial({ color: 0x222222 });
const eye1 = new THREE.Mesh(new THREE.SphereGeometry(0.15, 8, 8), eyeMat);
eye1.position.set(-0.4, 0.2, 1.0);
faceGroup.add(eye1);
const eye2 = eye1.clone();
eye2.position.x = 0.4;
faceGroup.add(eye2);
scene.add(faceGroup);
// hide all scene groups initially, show based on scene
const sceneGroups = [null, shelfGroup, pillarGroup, constGroup, stairGroup, noiseGroup, faceGroup];
function setScene(index) {
sceneGroups.forEach((g, i) => { if (g) g.visible = (i === index); });
sceneIndex = index;
asciiPass.uniforms.sceneIndex.value = index;
}
setScene(0);
// ---------- camera animation (spline-based) ----------
const camPositions = [];
const camTargets = [];
// define keyframes for each scene (simplified)
for (let s = 0; s < 7; s++) {
const t = s * 20;
camPositions.push(new THREE.Vector3(0, 0, 8 + s * 2));
camTargets.push(new THREE.Vector3(0, 0, 0));
}
// simple interpolation
function updateCamera(time) {
const sceneIdx = Math.floor(time / 20);
const localT = (time % 20) / 20;
const p0 = camPositions[sceneIdx] || camPositions[0];
const p1 = camPositions[Math.min(sceneIdx+1, camPositions.length-1)] || p0;
camera.position.lerpVectors(p0, p1, localT);
camera.lookAt(0, 0, 0);
}
// ---------- captions ----------
const captions = [
"> wake _",
"letters fall into pillars",
"digits rise into words",
"words harden into stairs",
"stairs dissolve into noise",
"noise parts around a door",
"the face reads this line"
];
const captionEl = document.getElementById('caption');
function updateCaption(time) {
const idx = Math.min(Math.floor(time / 20), captions.length-1);
const text = captions[idx];
// simple decode effect
const progress = (time % 20) / 20;
const visibleChars = Math.floor(progress * text.length);
let html = '';
for (let i = 0; i < text.length; i++) {
if (i < visibleChars) html += `<span class="decoded">${text[i]}</span>`;
else html += `<span class="pending">${text[i]}</span>`;
}
captionEl.innerHTML = html;
}
// ---------- audio (procedural, deterministic) ----------
let audioCtx = null;
function initAudio() {
audioCtx = new (window.AudioContext || window.webkitAudioContext)();
// simple drone
const osc = audioCtx.createOscillator();
osc.frequency.value = 55;
osc.type = 'sine';
const gain = audioCtx.createGain();
gain.gain.value = 0.1;
osc.connect(gain).connect(audioCtx.destination);
osc.start();
}
// ---------- main loop ----------
let lastTime = 0;
function animate(time) {
requestAnimationFrame(animate);
if (!isPlaying && !recordMode) return;
const now = performance.now() / 1000;
const dt = Math.min(now - lastTime, 0.1);
lastTime = now;
if (isPlaying) currentTime += dt;
if (currentTime > DURATION) currentTime = 0;
// update scene visibility
const currentScene = Math.floor(currentTime / 20);
setScene(currentScene);
// camera
updateCamera(currentTime);
// particles drift
const pos = particles.geometry.attributes.position.array;
for (let i = 0; i < pos.length; i += 3) {
pos[i] += Math.sin(currentTime + i) * 0.001;
pos[i+1] += Math.cos(currentTime + i) * 0.001;
}
particles.geometry.attributes.position.needsUpdate = true;
// ascii uniforms
asciiPass.uniforms.time.value = currentTime;
asciiPass.uniforms.cellSize.value = 6.0 + Math.sin(currentTime * 0.5) * 2.0;
// render
composer.render();
// captions
updateCaption(currentTime);
// HUD
if (debugHUD) {
document.getElementById('hud').style.display = 'block';
document.getElementById('hud').innerHTML = `t: ${currentTime.toFixed(2)}s<br>scene: ${scenes[currentScene]}<br>fps: ${(1/dt).toFixed(0)}<br>cell: ${asciiPass.uniforms.cellSize.value.toFixed(1)}<br>particles: ${particleCount}`;
} else {
document.getElementById('hud').style.display = 'none';
}
}
// ---------- controls ----------
document.getElementById('overlay').addEventListener('click', () => {
document.getElementById('overlay').classList.add('hidden');
initAudio();
isPlaying = true;
lastTime = performance.now() / 1000;
});
window.addEventListener('keydown', (e) => {
if (e.key === ' ') { isPlaying = !isPlaying; e.preventDefault(); }
if (e.key === 'ArrowLeft') currentTime = Math.max(0, currentTime - 1);
if (e.key === 'ArrowRight') currentTime = Math.min(DURATION, currentTime + 1);
if (e.key === 'h' || e.key === 'H') debugHUD = !debugHUD;
if (e.key >= '0' && e.key <= '6') {
const idx = parseInt(e.key);
currentTime = idx * 20;
setScene(idx);
}
});
// ---------- renderFrame for capture ----------
window.renderFrame = (t) => {
return new Promise((resolve) => {
currentTime = t;
const currentScene = Math.floor(t / 20);
setScene(currentScene);
updateCamera(t);
asciiPass.uniforms.time.value = t;
composer.render();
updateCaption(t);
resolve();
});
};
window.DURATION = DURATION;
window.FPS = FPS;
// initial render
renderer.render(scene, camera);
composer.render();
updateCaption(0);
// start animation
requestAnimationFrame(animate);
// handle resize
window.addEventListener('resize', () => {
if (recordMode) return;
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
renderer.setSize(canvas.width, canvas.height, false);
composer.setSize(canvas.width, canvas.height);
asciiPass.uniforms.resolution.value.set(canvas.width, canvas.height);
});
// expose for debugging
window.scene = scene;
window.camera = camera;
</script>
</body>
</html>
Connectez-vous pour voir le prompt complet
Continuer avec:
En vous connectant, vous acceptez nos Conditions et Confidentialité
Utilisation
Ce prompt est conçu pour ĂȘtre utilisĂ© avec creative. Copiez le contenu ci-dessus et collez-le dans votre outil dâIA prĂ©fĂ©rĂ©.
Pour de meilleurs résultats, personnalisez les espaces réservés (indiqués par des crochets ou des majuscules) selon vos besoins.
Références
- Catégorie: Prompts creative
- Source: https://x.com/chetaslua/status/2123689807595651289
Discussion
0 commentaires