GLSL Viewer

by iY0Yi
5
4
3
2
1
Score: 50/100

Description

Category: Coding & Technical Tools

The GLSL Viewer plugin lets you preview and run GLSL fragment shaders directly within your notes. It offers Shadertoy compatible syntax, making it easy to port existing shader code. Load custom textures from your vault using iChannel0-3 channels, with support for texture shortcuts and a visual browser for quick selection. Templates help you build complex shaders with minimal code - just define the template once and reuse it. Configure aspect ratio, autoplay behavior and code visibility through simple comment directives. Thumbnails generate automatically for shaders that don't autoplay. The plugin works alongside syntax highlighters without conflicts and provides all standard Shadertoy uniforms like iTime, iResolution and iMouse for interactive animations.

Reviews

No reviews yet.

Stats

9
stars
318
downloads
1
forks
95
days
74
days
74
days
4
total PRs
0
open PRs
1
closed PRs
3
merged PRs
0
total issues
0
open issues
0
closed issues
0
commits

Latest Version

3 months ago

Changelog

  • Add click-to-edit for GLSL code blocks in Live Preview (both with and without @viewer)
  • Fix copy button: use Obsidian native setIcon instead of broken custom SVG
  • Add copy button to @viewer blocks (edit mode and reading mode)
  • Make copy button hover-only to match native Obsidian behavior
  • Extract shared addCopyButton/navigateToCodeBlock helpers
  • Hide native edit-block-button in Live Preview (replaced by click-to-edit)

README file from

Github

GLSL Viewer

Preview GLSL shaders on Obsidian.

Features

Shadertoy Compatibility (Limited)

Shadertoy compatibility

Same syntax as Shadertoy - easily port your creations and reuse code snippets between platforms

Custom Textures

Custom Textures

Load images from your vault as textures (iChannel0-3)

Template System

Custom Template

Use templates to simplify complex shaders - write minimal code, get maximum results

And more

  • 📸 Thumbnail generation: Automatic thumbnails for non-autoplay shaders
  • ⚙️ Configurable canvas ratio, autoplay, and code visibility
  • 🔧 Flexible configuration using comments in code blocks
  • 🎯 Texture shortcuts: Quick reference to frequently used textures
  • 📁 Texture browser: Visual texture selection with folder filtering
  • 🙈 @hideCode: Show only the viewer or with code
  • 📁 Configurable folders: Set custom locations for templates and thumbnails
  • 🎯 Works with syntax highlighters: No conflicts with other code plugins (Shiki Highlighter)

Installation

  1. Copy this plugin to your Obsidian plugins folder
  2. Enable the plugin in Obsidian settings

Usage

Use standard glsl code blocks with @viewer directive:

Directive Styles:

Single-line comments:

```glsl
// @viewer
// @aspect: 0.75
// @autoplay: true
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    vec3 col = 0.5 + 0.5 * cos(iTime + uv.xxy + vec3(0, 2, 4));
    fragColor = vec4(col, 1.0);
}
```

Multi-line comments:

```glsl
/*
@viewer
@aspect: 0.75
@autoplay: true
@hideCode: true
@iChannel0: assets/texture.png
*/
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    vec3 col = 0.5 + 0.5 * cos(iTime + uv.xxy + vec3(0, 2, 4));
    fragColor = vec4(col, 1.0);
}
```

Basic Example

```glsl
// @viewer
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    vec3 col = 0.5 + 0.5 * cos(iTime + uv.xxy + vec3(0, 2, 4));
    fragColor = vec4(col, 1.0);
}
```

Setting Example


```glsl
// @viewer
// @aspect: 1.0
// @autoplay: true
// @iChannel0: assets/images/texture.jpg
// @hideCode: true
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord-iResolution.xy*.5) / iResolution.y;
    uv+=vec2(sin(iTime),cos(iTime));
    vec3 texColor = texture(iChannel0, uv * 2.0).rgb;
    vec3 col = texColor;
    fragColor = vec4(col, 1.0);
}
```

Template Example

Templates enable the creation of complex shader patterns with minimal code. Create custom templates in your configured templates folder (default: GLSL Templates/). Share complex setups across multiple shaders.

```glsl
// @viewer
// @template: raymarching.glsl
vec4 map(vec3 p) {
    float d = length(p) - .5;  // Sphere distance function
    return vec4(d, COL_S2);     // Return distance and material color
}
```

Using Textures

Three ways to specify textures:

  • Shortcuts: tex1 (configured in settings)
  • Filenames: wood.png (when Texture Folder is set)
  • Full paths: images/wood.png (relative to vault root)

Texture Shortcuts

Create shortcuts for frequently used textures in plugin settings. Shortcuts are always relative to your Texture Folder setting:

```glsl
// @viewer
// @iChannel0: tex1      // Uses shortcut 'tex1' → {TextureFolder}/wood.png
// @iChannel1: noise     // Uses shortcut 'noise' → {TextureFolder}/noise.jpg
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    vec3 tex = texture(iChannel0, uv).rgb;    // wood texture
    vec3 n = texture(iChannel1, uv).rgb;      // noise texture
    fragColor = vec4(mix(tex, n, 0.5), 1.0);
}
```

Configure shortcuts in Settings → GLSL Viewer → Texture Shortcuts

Configuration Options

Comment Settings

Setting Description Default
@viewer Enable viewer for glsl code blocks -
@aspect: number Canvas aspect ratio (height/width) 0.5625
@autoplay: true/false Auto-start animation false
@hideCode: true/false Hide code block, show viewer only false
@template: filename Use template from templates folder -

Note: @viewer directive is required only for glsl code blocks. glsl-viewer blocks are always processed.

Available Uniforms

  • vec3 iResolution - Screen resolution ✅
  • float iTime - Elapsed time ✅
  • float iTimeDelta - Frame delta time ✅
  • int iFrame - Frame number ✅
  • vec4 iMouse - Mouse position (Shadertoy-compatible) ✅
  • vec4 iDate - Date info (year, month, day, seconds) ✅
  • sampler2D iChannel0-3 - Textures ✅
  • vec3 iChannelResolution[4] - Texture resolutions (width, height, 1.0) ✅

Technical Details

  • Shader Type: Fragment shaders only
  • Entry Point: mainImage(out vec4 fragColor, in vec2 fragCoord)
  • Textures: Load images from anywhere in your vault with flexible path resolution
  • Templates: Custom templates with @TEMPLATE_LINES placeholder replacement
  • Thumbnails: Auto-generated for non-autoplay shaders, stored in configurable folder
  • Texture Folder: Serves as base directory for relative texture paths and shortcuts

Plugin Settings

Access via Settings → Community plugins → GLSL Viewer:

Display Settings:

  • Default Aspect Ratio: Canvas ratio for new shaders
  • Default Autoplay: Whether new shaders auto-start by default
  • Default Hide Code: Whether to hide code blocks by default

Folders: (in setup priority order)

  • Thumbnails Folder: Where generated thumbnails are stored (default: GLSL Thumbnails)
  • Texture Folder: Base folder for texture paths and browsing (optional)
  • Templates Folder: Where GLSL templates are stored (default: GLSL Templates)

Texture Shortcuts:

  • Create shortcuts for frequently used textures (e.g., tex1, noise)
  • All shortcuts are relative to the Texture Folder setting

Creating Templates

  1. Create a .glsl file in your Templates Folder (default: GLSL Templates/)
  2. Use @TEMPLATE_LINES where your code should be inserted
  3. Reference with // @template: filename.glsl

Development

npm install
npm run dev    # Development mode
npm run build  # Production build

License

MIT License

Compatibility

  • Obsidian: v1.0.0+
  • Shiki-highlighter

Similar Plugins

info
• Similar plugins are suggested based on the common tags between the plugins.
Excalidraw
5 years ago by Zsolt Viczian
A plugin to edit and view Excalidraw drawings in Obsidian
Advanced Canvas
2 years ago by Developer-Mike
⚡ Supercharge your canvas experience! Graph view integration and unlimited styling options empower flowcharts, dynamic presentations, and interconnected knowledge.
Markmind
5 years ago by Mark
A mind map, outline for obsidian,It support mobile and desktop
Heatmap Calendar
4 years ago by Richard Slettevoll
An Obsidian plugin for displaying data in a calendar similar to the github activity calendar
Map View
5 years ago by esm
Interactive map view for Obsidian.md
Contribution Graph
2 years ago by vran
generate interactive gitxxx style contribution graph for obsidian, use it to track your goals, habits, or anything else you want to track.
Extended Graph
a year ago by Kapirklaa
Community plugin to add features to the graph view.
Diagrams.Net
4 years ago by Jens M Gleditsch
This repository contains a plugin for Obsidian for inserting and editing diagrams.net (previously draw.io) diagrams.
Open vault in VS Code
5 years ago by NomarCub
Open vault in VSCode button for Obsidian.md
Maps
7 months ago by Obsidian
Map layout for Obsidian Bases. Display your notes as an interactive map view.
Note Gallery
2 years ago by Pash Shocky
A masonry note gallery for obsidian.
Heatmap Tracker
a year ago by Maksim Rubanau
A customizable heatmap tracker plugin for Obsidian to visualize daily data trends with intuitive navigation and flexible settings.
Mehrmaid
2 years ago by huterguier
Rendering Obsidian Markdown inside Mermaid diagrams.
Smart Connections Visualizer
2 years ago by Evan Moscoso
Visualize your notes and see links to related content with AI embeddings. Use local models or 100+ via APIs like Claude, Gemini, ChatGPT & Llama 3
Link Exploder
3 years ago by Ben Hughes
Pieces for Developers
3 years ago by Pieces For Developers
Pieces' powerful extension for Obsidian-MD that allows users to access their code snippets directly within the Obsidian workspace
Optimize Canvas Connections
3 years ago by Félix Chénier
An Obsidian plugin that declutters a canvas by reconnecting notes using their nearest edges
Desmos
4 years ago by Nigecat
Embed graphs directly into your obsidian notes
React Components
5 years ago by Elias Sundqvist
Write and use React (Jsx) components in your Obsidian notes.
Graph Banner
2 years ago by ras0q
An Obsidian plugin to display a relation graph view on the note header.
InfraNodus AI Graph View
2 years ago by Nodus Labs
Advanced graph view for Obsidian: text analysis, topic modeling, and AI with InfraNodus AI text analysis tool: https://infranodus.com
Habit Tracker
5 years ago by duo
This plguin for Obsidian creates a simple month view for visualizing your punch records.
HTML Tags Autocomplete
5 years ago by bicarlsen
Autocomplete HTML formatting tags.
D2
3 years ago by Terrastruct
The official D2 plugin for Obsidian. D2 is a modern diagram scripting language thats turns text to diagrams.
Obsidian Graphviz
4 years ago by Feng Peng
Graphviz plugin for obsidian md.
Canvas Links
3 years ago by aqav
Show the links between "Canvas" and "File"
Mindmap
2 years ago by YunXiaoYi
An Obsidian plugin for creating Mindmaps.
Canvas Filter
3 years ago by Ivan Koshelev
Obsidian Canvas plugin that let's you show only pages / arrows with specific tags / colors / connections.
Show Whitespace
2 years ago by Erin Schnabel
Show leading/trailing whitespace
CardNote
2 years ago by cycsd
Help you extract your thoughts more quickly in canvas
Neo4j Graph View
5 years ago by Emile van Krieken
Advanced Progress Bars
a year ago by cactuzhead
Obsidian plugin to create custom progress bars
Enhanced Canvas
a year ago by RobertttBS
When editing on Canvas, properties and Markdown links to notes are automatically updated, enabling backlinks in Canvas.
Graph Link Types
2 years ago by natefrisch01
Link types for Obsidian graph view.
Release Timeline
4 years ago by cakechaser
Chessboard Viewer
5 years ago by Davide Aversa
Plugin to render chessboards in Obsidian using chessboardjs
Habit Tracker
4 years ago by David Moeller
A Plugin to display a Habit Tracker in Obsidian.
Nifty Links
3 years ago by x-Ai
Generating elegant, Notion-styled rich link cards to enhance your note-taking experience.
Tasks Map
7 months ago by NicoKNL
A graph view of your tasks.
Canvas Mindmap Helper
2 years ago by Tim Smart
JupyMD
a year ago by Deniz Terzioglu
JupyMD: Use Obsidian as a Jupyter notebook IDE
New 3D Graph
10 months ago by Aryan Gupta
Visualize your vault in 3D with a powerful, highly customizable, and filterable graph.
Arrows
2 years ago by artisticat
Draw arrows across different parts of your notes, similar to on paper
Export Graph View
a year ago by Sean McGhee
Plugin to export your vault's graph view.
Argument Map with Argdown
5 years ago by amdecker
Dirtreeist
3 years ago by kasahala
Render a directory Structure Diagram from a markdown lists in codeblock.
Snippets
5 years ago by Pelao
Chemical Structure Renderer
3 years ago by xaya1001
Render chemical structures from SMILES strings into PNG or SVG format using Ketcher and Indigo Service.
Tracker+
3 years ago by GreaterThan (original by pyrochlore)
A plugin for Obsidian that tracks and visualizes in your notes. A continuation of the plugin originally developed by @pyrochlore
Content Cards
a year ago by leo
Insert content cards in Markdown, such as timeline, highlightblock, target card, book information card, music information card, movie information card, photoes ablum, business card, content subfield, countdown, SWOT,BCG.
WaveDrom
5 years ago by Alex Stewart
Console Markdown Plugin
3 years ago by Daniel Ellermann
An Obsidian plugin which renders console commands and their output.
Adamantine Pick
3 years ago by Urist McMiner
Embeddable Pikchr(https://pikchr.org) diagrams renderer plugin for Obsidian(https://obsidian.md)
historica
2 years ago by Nhan Nguyen
Not (smart) to help you create your timeline in obsidian like a ... bro
Stack Overflow Answers
4 years ago by bramses
Fetch Stack Oveflow answers and copy paste them directly into Obsidian
Lilypond
3 years ago by DOT-ASTERISK
Lilypond for Obsidian
YourPulse - Your Writing Activity Visualised
a year ago by Jiri Sifalda
YourPulse.cc - Obsidian.md plugin that turns your vault into a reflection of your creativity, and put your writing on steroids 💪
Desk
2 years ago by David Landry
A desk for obsidian
Node Factor
a year ago by CalfMoon
Customize factors effecting node size in obsidian graph.
Lineup Builder
4 years ago by James Fallon
An Obsidian plugin that lets you build football lineups
Flowcharts
a year ago by land0r
Flowchart Plugin for Obsidian – Create and customize flowcharts seamlessly within your Obsidian vault. Powered by Flowchart.js and designed for productivity
Laws of Form
3 years ago by Kevin German
Generate Timeline
a year ago by Shanshuimei
An obsidian plugin to generate timelines from tags, folders, files or metadata automatically. 根据标签,文件夹,文件或者属性自动生成时间轴的插件。
Storyclock Viewer
2 years ago by Jonathan Fisher
Obsidian plugin for creating a storyclock
BattleSnake Board Viewer
3 years ago by EnderInvader
Plugin to render battlesnake boards in Obsidian
Tier List
a year ago by Mox Alehin
Obsidian plugin for visual ranking and organizing content into customizable Tier Lists.
Mathematica Plot
2 years ago by Marcos Nicolau
Insert functions on Obsidian using Wolfram Mathematica!
Folder Canvas
a year ago by Nancy Lee
Generate a canvas view of your folder structure
Easy Timeline
a year ago by Romeliun
The Easy Timeline plugin for Obsidian allows you to create timelines easily.
Markline
2 years ago by 闲耘
Markline: Markdown timeline view in Obsidian.
ASCII Tree Generator
a year ago by Matěj Michálek
Alfonso Money Manager
2 years ago by SmartLifeGPT Innovation
This is the repository for the obsidian plugin of the Alfonso Money Manager mobile application
Extended File Support
a year ago by Nick de Bruin
Adds opening and embedding support for various filetypes to Obsidian
Livecodes Playground
2 years ago by @gapmiss
Open-source client-side code editor plugin for Obsidian.md - powered by LiveCodes.io
Smart Vault Visualizer
a year ago by Evan Moscoso
Mermaid Icons
3 months ago by toshs
Obsidian plugin enabling the use of icons in Mermaid diagrams.
Mapbox Location Image
2 years ago by Aaron Czichon
Render a mapbox location image based on provided coordinates
Canvas Explorer
2 years ago by Henri Jamet
A plugin that enables users to explore their vault by iteratively adding or ignoring linked notes, ultimately generating a customizable canvas that visually represents the preserved notes and their connections.
Textgrams
a year ago by Akop Kesheshyan
Create and store ASCII graphics in your Obsidian
Weather Widget
3 months ago by mr-asa
Weather widget for display in notes, Canvas, and a separate tab.
Magic Move
2 years ago by imfenghuang
Animating Code Blocks in Obsidian
Tagvis
a year ago by Mason Bryant
NodeFlow
a year ago by LincZero
Render node streams like `ComfyUi`, `UE`, `Houdini`, `Blender`, etc., to make it easy to write relevant notes. json describes the chart, compared to screenshots, making it easier to modify later. The plugin is also compatible with blogs.",
Waveform Player
a year ago by Zhou Hua
Timelive
a year ago by aNNiMON
Turn a list of dates into a timeline
Every Day Calendar
a year ago by QuBe
Obsidian plugin to create calendars inspired by Simone Giertz's Every Day Calendar
Boardgame Search
a year ago by Marlon May
A plugin to create notes for boardgames based on the BGG API
Life in Weeks Calendar
6 months ago by Jeff Szuc
Plugin for the Obsidian markdown editor. Displays a calendar of your life in weeks with weekly Periodic Notes plugin integration. Includes options for the traditional Memento Mori/Stoic style calendar, as well as a Gregorian calendar accurate version.
Inline Local Graph
3 months ago by TKOxff
Inline Local Graph of Obsidian
Visited Countries
7 months ago by Ivan Peshykov
Obsidian plugin to mark and visualize the countries you've visited on an interactive world map.
NyanBar
2 years ago by xhyabunny
Give life to your Obsidian notes with NyanBar !
Kale Graph
a year ago by Oli
Render mathematical graphs in Obsidian
Auto Close Tags
9 months ago by k0src
Obsidian MD plugin to auto-close HTML tags.
Poker Range
2 years ago by marplek
Easily create, view, and interact with poker hand ranges in your obsidian.
ShaahMaat-md
a year ago by Mihail Kovachev
Class Relation Visualization
a year ago by Yong
Mahgen Renderer
a year ago by Michael Francis Williams
Obsidian plugin to render mahgen automatically
Mahjong Renderer
2 years ago by hypersphere
GoBoard
4 months ago by Dmitry I. Sokolov
Obsidian plugin for rendering Go game diagrams from markdown code blocks