All Projects → Cold-0 → godot-shader-to-image

Cold-0 / godot-shader-to-image

Licence: MIT license
A simple tool to render Image from Shader with Godot (Tested on 3.2)

Programming Languages

GLSL
2045 projects
GDScript
375 projects

Projects that are alternatives of or similar to godot-shader-to-image

3d Game Shaders For Beginners
🎮 A step-by-step guide to implementing SSAO, depth of field, lighting, normal mapping, and more for your 3D game.
Stars: ✭ 11,698 (+38893.33%)
Mutual labels:  shader, godot
godot-local-notification
Godot module for local notifications (android and iOS)
Stars: ✭ 111 (+270%)
Mutual labels:  godotengine, godot
Godot Cel Shader
A Cel Shader for the Godot Engine
Stars: ✭ 145 (+383.33%)
Mutual labels:  shader, godot
GodotTerrainEditorPainter
Heightmap based terrain editor plugin for GODOT with vertex color based terrain shader painting
Stars: ✭ 23 (-23.33%)
Mutual labels:  shader, godot
Godot-DialogPlugin
🗨️ A Dialog Node for Godot Engine
Stars: ✭ 194 (+546.67%)
Mutual labels:  godotengine, godot
particles-sandbox
GPU-accelerated cellular automata in Godot (WIP)
Stars: ✭ 17 (-43.33%)
Mutual labels:  shader, godot
Simplegodotcrtshader
A simple Godot shader that simulates CRT Displays
Stars: ✭ 236 (+686.67%)
Mutual labels:  shader, godot
godot-performance-comparison
Godot performance comparison between the `3.x` and `master` branch
Stars: ✭ 12 (-60%)
Mutual labels:  godotengine, godot
GDGotm
Official Godot plugin for gotm.io - the Godot Platform!
Stars: ✭ 43 (+43.33%)
Mutual labels:  godotengine, godot
godot-practice-shaders
Some practice shaders in Godot
Stars: ✭ 79 (+163.33%)
Mutual labels:  godotengine, godot
Godot
Godot Engine – Multi-platform 2D and 3D game engine
Stars: ✭ 44,556 (+148420%)
Mutual labels:  godotengine, godot
godot-openvr-asset
Godot asset for the openvr module
Stars: ✭ 52 (+73.33%)
Mutual labels:  godotengine, godot
Pixelorama
A free & open-source 2D sprite editor, made with the Godot Engine! Available on Windows, Linux, macOS and the Web!
Stars: ✭ 2,535 (+8350%)
Mutual labels:  godotengine, godot
godot-cmvalley
Port of the Sauerbraten clanmap cm|Valley to Godot 4.0
Stars: ✭ 28 (-6.67%)
Mutual labels:  godotengine, godot
godot-exporter
Godot Engine Automation Pipeline Android – iOS – Linux – MacOS – Windows – HTML5 – Itch.io.
Stars: ✭ 54 (+80%)
Mutual labels:  godotengine, godot
Godot Realistic Water
Godot - Realistic Water Shader
Stars: ✭ 235 (+683.33%)
Mutual labels:  shader, godot
DartGodot
Godot + Dart 🎯
Stars: ✭ 79 (+163.33%)
Mutual labels:  godotengine, godot
godot-interpolated-camera3d
Provides an InterpolatedCamera3D node that replicates its 3.2.x functionality (and more)
Stars: ✭ 40 (+33.33%)
Mutual labels:  godotengine, godot
RPG-Databases
Godot Engine addon to manage RPG databases
Stars: ✭ 15 (-50%)
Mutual labels:  godotengine, godot
novemberdev soulslike darksouls godot
Dark Souls clone in 3D with Godot
Stars: ✭ 51 (+70%)
Mutual labels:  godotengine, godot

godot-shader-to-image

A simple tool to render Image with Godot (Tested on 3.2). It use tricks with viewport and image rendering. It's usefull because you can generate thing GPU side then use them CPU side and because godot doesn't have easy way to get a Texture to an Image POST shading.

How to use

Drop the "ShaderToImage" folder into your Godot project.

Instance the scene ShaderToImage.tscn in your current scene.

Then generate the Image :

my_material = load("some_material_path.material")
shader_to_image.generate_image(my_material) # Start generating the image
yield(shader_to_image, "generated") # Wait the image to be rendered, it take 3 frams
var my_image = shader_to_image.get_image()

Reference

Functions

func generate_image(material : Material, resolution := Vector2(512,512), multiplier := 1.0, args := {}):

Generate the new image. It is avaiable only when the Signal "generated" is emited.

  • material (Material) : the material you want to render
  • resolution (Vector2) : the final Image resolution, it can be passed to your shader as a uniform
  • multiplier (float) : if you have an uniform it will "zoom in" "zoom out" on your shader will keeping the output resolution
  • args (Dictionary) : You can pass argument to the uniform of the shader with a Dictionary. Ex : {"time": 50.2, "mod1" : 0.8, "mod2" : 0.45}
func get_image() -> Image:

Return the image reference, if no image have been generated return null and print an error

Signal

signal generated

Signal emited everytime an image is generated. (It need 3 frames to be generated)

Shader Uniform

uniform vec2 resolution

Add it to your shader to handle the surface resoltion, it will take the value from the value resolution*multiply from generate_image function

Shader example

shader_type canvas_item;

uniform vec2 resolution;
uniform float time;

float random (vec2 source) 
{
  return fract(sin(dot(source.xy,vec2(12.9898,78.233)))*43758.5453);
}

void fragment() 
{
    vec2 coordo = FRAGCOORD.xy/resolution.xy;
    float rand = random(coordo*time);
    COLOR = vec4( vec3(rand), 1.0);
}

Licence Info

The MIT licence doesn't include the shaders inside the folder "ExampleShaders"

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].