dexter
Inspiration
Every year, thousands of homicides go unsolved in the United States. The FBI's clearance rate for murder cases has dropped from 90% in 1965 to roughly 50% today. The problem isn't a lack of evidence — it's that detectives have no way to organize evidence through the psychological lens of the perpetrator. Crime scene photos, witness statements, and forensic data sit in folders. What's missing is a tool that maps how the criminal thinks.
We were inspired by Dexter Morgan — the fictional blood spatter analyst who could walk into a crime scene and reconstruct exactly what happened. He didn't have more data than anyone else. He had a model of the criminal mind. We asked: what if law enforcement had that same capability, powered by AI?
What it does
dexter is a forensic investigation platform with three integrated modules:
1. Criminal Brain Hive
Upload case files, interrogation transcripts, or suspect writings. dexter breaks every sentence into psychological vectors across 8 dimensions:
- Aggression
- Deception
- Fear
- Rationalization
- Planning
- Trauma
- Control
- Remorse
Each chunk becomes a glowing point in a 3D obsidian vector brain. The brain auto-rotates, showing thousands of interconnected thoughts. Click any neuron to read what it represents. Ask questions — dexter retrieves the top-matching memories using cosine similarity and streams answers in the killer's voice, grounded in the actual evidence.
2. Blood Spatter Analysis
Drop a crime scene photo. dexter detects every blood stain, calculates impact angle, velocity class, and area of origin. A 3D reconstruction lets investigators walk through the scene and see exactly where the blood tells the story. AI forensic analysis interprets the patterns and generates a full investigative report.
3. 3D Scene Reconstruction
Import .glb 3D models of crime scenes. Walk through the environment with orbit controls, analyze blood evidence in 3D space, and use AI to interpret the scene — identifying victim position, weapon type, and likely sequence of events.
How we built it
Tech Stack
| Layer | Technology |
|---|---|
| Frontend | Next.js 16 (App Router), React, TypeScript, Tailwind CSS |
| 3D Rendering | Three.js via @react-three/fiber + @react-three/drei |
| AI Chat | Groq API — Llama 3.3 70B Versatile (streaming) |
| AI Vision | Groq API — Llama 3.2 11B Vision Preview |
| Embeddings | Custom psychological word-category analyzer (8-dim feature vectors) |
| Dimensionality Reduction | Incremental PCA via power iteration |
| Similarity Search | Cosine similarity with top-K retrieval |
| State Management | Zustand (in-memory, no database) |
| Backend | Next.js API routes (Edge runtime for streaming) |
| Styling | Custom retro-macOS desktop aesthetic with glass-morphism |
Architecture
User uploads case file (.txt / image / .glb)
↓
Text chunked into ~500 token segments
↓
Each chunk → psychological embedder → 8-dim vector
↓
PCA reduces all vectors → 3D brain positions
↓
Brain renders as 5000+ point cloud with region-colored neurons
↓
User asks question → embed query → cosine similarity → top-5 chunks
↓
Top chunks + system prompt → Groq streaming → in-character answer
↓
Matching brain points glow during response
Blood Spatter Pipeline
Image upload → canvas rendering → stain detection
↓
Contour extraction → blob analysis → per-stain metrics
↓
Impact angle = arcsin(width / length)
Direction vectors → RANSAC convergence → 3D origin point
↓
Velocity classification by droplet size distribution
↓
AI interpretation → forensic report
Psychological Embedding Equation
Each chunk of text receives an 8-dimensional psychological vector $\vec{v}$ where each component is computed as:
$$v_i = \frac{1}{|w|}\sum_{j=1}^{|w|} \mathbf{1}[w_j \in C_i]$$
Where $|w|$ is the word count, $C_i$ is the word-category set for dimension $i$, and $\mathbf{1}$ is the indicator function. The vector is then L2-normalized:
$$\vec{v}_{\text{norm}} = \frac{\vec{v}}{||\vec{v}||_2}$$
PCA is applied via power iteration on the covariance matrix to reduce 8 dimensions to 3 spatial coordinates:
$$\mathbf{C} = \frac{1}{n-1}\mathbf{X}^T\mathbf{X}, \quad \mathbf{C}\mathbf{w} = \lambda\mathbf{w}$$
Challenges we ran into
1. Three.js GLTFLoader Compatibility
The biggest technical hurdle was loading .glb files in the browser. The original page used a custom CDN (artifactcdn) for Three.js that didn't include GLTFLoader. Switching to jsDelivr introduced API incompatibilities with the existing 3D scene code. We solved this by using import maps to load Three.js 0.160.0 and all addons from the same CDN, ensuring version consistency.
2. Psychological Embedding Without a Real Embedding Model
Groq doesn't offer a text embedding API. We couldn't use traditional 1536-dim semantic embeddings. Instead, we built a custom psych-category word-count embedder that maps text to 8 psychologically meaningful dimensions. This gave us real, interpretable vectors that actually cluster by psychological content — not random mock data.
3. Merging 2D Analysis with 3D Visualization
Blood spatter analysis is inherently 2D (photos), while our brain visualization is 3D. We needed both to feel like one product. We solved this by sharing state between modes and using the same AI pipeline for both — whether analyzing a 2D crime scene photo or a 3D model, the Groq API receives a viewport capture and returns structured forensic analysis.
4. Real-Time Vector Brain Without GPU Stress
Rendering 5000+ glowing points in Three.js while auto-rotating requires careful optimization. We use a single BufferGeometry with custom ShaderMaterial (additive blending, no depth write) and useFrame throttling. No bloom post-processing — just efficient glow math in the fragment shader.
5. Keeping Everything Working Live
A hackathon demo with live AI calls, 3D rendering, file uploads, and streaming responses has many failure points. We built mock fallbacks for every API endpoint so the demo works even without API keys, and uses actual Groq calls when keys are configured.
Accomplishments that we're proud of
Real psychological vectors — not mock data, not random. Each vector is computed from the actual psychological content of uploaded text. Aggressive words cluster in the amygdala region; planning words cluster in the prefrontal cortex.
Live AI interrogation — Ask the criminal brain a question and watch as matching neurons glow, then read a streaming answer in the killer's perspective. The AI doesn't just summarize — it roleplays.
Full forensic pipeline — from crime scene photo to blood stain detection to impact angle calculation to 3D origin reconstruction. The math is real: $\theta = \arcsin(\frac{w}{l})$ for impact angles.
Import maps fix — switching to jsDelivr CDN with import maps solved days of GLTFLoader compatibility issues in 10 minutes.
The "no thank you" demo ending — our pitch script doesn't end with "any questions?" It ends with silence. The demo speaks for itself.
Obsidian aesthetic — the entire UI uses a custom retro-macOS desktop theme with glass-morphism, gradient windows, and intentional letter-spacing. Every page feels like it belongs to one product.
What we learned
Import maps are underrated. Using
<script type="importmap">to resolvethreeandthree/addons/from the same CDN eliminated every version compatibility issue we encountered.Psychology-first vector design works. Traditional semantic embeddings (1536-dim) are great for general search, but for a domain-specific forensic tool, 8 psychologically-targeted dimensions produce more interpretable and meaningful results. A detective can look at a vector and understand why the system clustered something as "aggression" vs "planning."
Streaming AI changes the demo game. Watching the AI type character-by-character in the killer's voice is dramatically more compelling than waiting for a complete response. Edge runtime streaming made this feel instant.
The retro aesthetic is a differentiator. In a sea of dark-mode SaaS dashboards, a light
#f5f5f5macOS-themed interface stands out and feels deliberate. Design is part of the product story.
What's next for dexter
Near-term
- Real embedding model: Integrate an actual embedding API (OpenAI
text-embedding-3-smallor Jina AI) for higher-dimensional semantic search alongside the psychological vectors - Multi-suspect comparison: Load multiple case files side by side. Compare psychological profiles between suspects. Identify which suspect best matches the crime scene evidence.
- Mobile responsiveness: Full adaptive layout for field use on tablets
- Export to PDF: Generate formatted forensic reports with all metrics, AI analysis, and visualizations in a printable format
Medium-term
- Temporal analysis: Track how a suspect's psychological profile changes over time across multiple interviews or case files
- Predictive modeling: Given a suspect's psychological profile, predict next likely actions — location, victim type, time window
- Evidence linking: Cross-reference multiple cases to identify connections between seemingly unrelated crimes through psychological signature matching
Long-term vision
- Real law enforcement integration: Partner with police departments for pilot programs. Feed real case data to improve the psychological embedding dictionary
- Expert witness tool: Generate court-admissible forensic reports with full methodological transparency — every metric, every angle, every calculation is traceable
- Open source the embedding system: Release the psychological vector framework as an open-source library for forensic linguistics and criminal psychology research


Log in or sign up for Devpost to join the conversation.