https://github.com/crcdng/flutter_shader_examples

Some examples of shaders written in Flutter / the Flame game engine.

https://github.com/crcdng/flutter_shader_examples

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.6%) to scientific vocabulary

Keywords

dart flutter shader shaders
Last synced: 5 months ago · JSON representation

Repository

Some examples of shaders written in Flutter / the Flame game engine.

Basic Info
  • Host: GitHub
  • Owner: crcdng
  • Language: GLSL
  • Default Branch: main
  • Homepage:
  • Size: 13.2 MB
Statistics
  • Stars: 4
  • Watchers: 3
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Topics
dart flutter shader shaders
Created about 1 year ago · Last pushed 7 months ago
Metadata Files
Readme

README.md

Flutter Shader Examples

I collected a few examples for shaders in Flutter. Most code is originaly from others and rewritten / updated by me. Original sources are referenced below. Some examples below show the same shader in Flutter and in Flame engine. The goal is to demonstrate a number different techniques to integrate custom shaders in your Flutter/Flame app. On Flutter, shaders are hot-reloaded!

To run the demo app, you need Flutter. Clone this repository with git or download and unzip it and add a platform, e.g. flutter create --platforms=macos . , then flutter run.

examples

  1. solid: solid color
  2. gradient: color gradient, FlutterFragCoord().xy
  3. animated_gradient: ShaderMask / RadialGradient, derived from https://api.flutter.dev/flutter/widgets/ShaderMask-class.html and https://stackoverflow.com/questions/76496575/animate-linear-gradient-background-of-container-in-flutter
  4. laser: converted from https://www.shadertoy.com/view/4f2GRR by ctrst
  5. water: https://www.shadertoy.com/view/Ms2SD1 by Alexander Alekseev aka TDM, CC BY-NC-SA 3.0, adapted from https://github.com/wolfenrain/fluttershadersexample/ (performance issues) LICENSE
  6. jam: https://www.shadertoy.com/view/ldfSW2 by srtuss, adapted from https://github.com/wolfenrain/fluttershadersexample/ (Android: performance issues) LICENSE
  7. stars: interactive, https://www.shadertoy.com/view/XlfGRj by Pablo Roman Andrioli, MIT License, adapted from https://github.com/wolfenrain/fluttershadersexample/ (performance issues) LICENSE
  8. stars_flame: flame engine, interactive, https://www.shadertoy.com/view/XlfGRj by Pablo Roman Andrioli, MIT License (performance issues)
  9. mario_flame: flame engine https://www.shadertoy.com/view/XtlSD7 by Krzysztof Narkowicz @knarkowicz (Android: screen size issue)
  10. snow: timer, fluttershaders, texture sampler, https://www.shadertoy.com/view/XlSBz1 by antoineMoPa, adapted from https://github.com/wolfenrain/fluttershaders_example/ LICENSE
  11. glitch: fluttershaders, texture sampler (the whole interactive app window is glitched), adapted from https://github.com/wolfenrain/fluttershaders_example/ LICENSE
  12. pixelate: fluttershaders, texture sampler from https://github.com/jonahwilliams/fluttershaders/ LICENSE
  13. lava_flame: flame engine, Hexler KodeLife start example
  14. barrelblur: fluttershaders, interactive, adapted from: https://github.com/renancaraujo/shaders_playground by Renan C. Araújo
  15. overscroll: fluttershaders, interactive, adapted from: https://github.com/renancaraujo/shadersplayground bvy Renan C. Araújo

open issues

  • Rewrite snow, which does not need an Animated Sampler
  • tested on macOS, needs tests on other platforms
  • NEW (0.3.0) compiles on Android (tested on Samsung Galaxy A26 5G and even on a Moto G8 Plus)
  • Some shaders need optimisation (see notes above)

resources

https://docs.flutter.dev/ui/design/graphics/fragment-shaders
https://github.com/flutter/engine/blob/main/impeller/docs/shader_optimization.md

https://pub.dev/packages/flutter_shaders helpers and texture samplers

https://fluttershaders.com/
https://blog.codemagic.io/shady-flutter/
https://github.com/wolfenrain/fluttershadersexample

Owner

  • Name: crcdng
  • Login: crcdng
  • Kind: user

may the farce be with you

GitHub Events

Total
  • Watch event: 4
  • Push event: 7
  • Fork event: 1
  • Create event: 2
Last Year
  • Watch event: 4
  • Push event: 7
  • Fork event: 1
  • Create event: 2

Dependencies

pubspec.lock pub
  • async 2.11.0
  • boolean_selector 2.1.1
  • characters 1.3.0
  • clock 1.1.1
  • collection 1.19.0
  • fake_async 1.3.1
  • flame 1.22.0
  • flutter 0.0.0
  • flutter_lints 5.0.0
  • flutter_shaders 0.1.3
  • flutter_test 0.0.0
  • leak_tracker 10.0.7
  • leak_tracker_flutter_testing 3.0.8
  • leak_tracker_testing 3.0.1
  • lints 5.1.1
  • matcher 0.12.16+1
  • material_color_utilities 0.11.1
  • meta 1.15.0
  • ordered_set 6.1.1
  • path 1.9.0
  • sky_engine 0.0.0
  • source_span 1.10.0
  • stack_trace 1.12.0
  • stream_channel 2.1.2
  • string_scanner 1.3.0
  • term_glyph 1.2.1
  • test_api 0.7.3
  • vector_math 2.1.4
  • vm_service 14.3.0
pubspec.yaml pub
  • flutter_lints ^5.0.0 development
  • flutter_test {"sdk"=>"flutter"} development
  • flame ^1.22.0
  • flutter {"sdk"=>"flutter"}
  • flutter_shaders ^0.1.3