Easl – Enhanced Abstraction Shader Language

Hacker News by 2 min read 8x views
Easl – Enhanced Abstraction Shader Language

Share Post

the Enhanced Abstraction Shader Language

A lispy shader tongue alongside closures, higher-order functions, sum types, and another high-level features. It can additionally run from the CPU and portion province throughout the CPU/GPU border without any synchronization code.

Read the guide

Quick commencement guide:

git copy https://github.com/Ella-Hoeppner/easl_cli cd easl_cli && cargo instal --path . easl run examples/simple.easl 

You can additionally instal the easl CLI direct from cargo:

cargo instal --locked easl_cli 

Easl is a activity in progress; anticipate breaking changes.

The backdrop of this leaf is an easl program, operating live in your browser. Open it in the editor.

This program is normally the backdrop of this page, but your browser doesn't assistance WebGPU.

(defn vert []: vec4f ([(vec4f -1. -1. 0. 1.) (vec4f -1. 3. 0. 1.) (vec4f 3. -1. 0. 1.)] (vertex-index))) (defn frag []: vec4f (let [pos (/ (.xy (position)) (f32 (.y (window-resolution)))) distort (fn [x dir drift factor] (+ x (* factor (cos (+ (dot x dir) (* drift (window-time))))))) f (fn [x] (-> x (distort (vec2f -400. 150.) 10.1 0.001) (distort (vec2f -12.9 -3.3) 0.15 0.2) (distort (vec2f -14.9 8.3) 0.2 0.2) (distort (vec2f 13.9 -7.3) -0.1 0.9) (distance x) (pow 1.75) (smoothstep 0. 2.8 <>))) center (f pos)] (-> (vec3f (- (f (+ pos (vec2f 0.01 0.))) center) (- (f (+ pos (vec2f 0. 0.01))) center) 0.01) normalize .z (mix 0.1 1. <>) (* (vec3f (f (- pos 0.0065)) center (f (+ pos 0.0065)))) (pow ~(/ 2.2)) (vec4f 1.)))) @cpu (defn chief [] (spawn-window (fn [] (dispatch-render-shaders vert frag 3))))
Other Article Hacker News
↑
Close Right Ads
Close Left Ads