Giter Site home page Giter Site logo

honsa / godot-shaders-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gamedevserj/godot-shaders

0.0 1.0 0.0 3.84 MB

A collection of various shader effects for Godot game engine

License: MIT License

GDScript 11.87% GAP 26.88% GLSL 61.25%

godot-shaders-1's Introduction

Godot shaders

A collection of shaders that I wrote in Unity converted to be used in Godot.

Godot version 3.2.1

Reflective water

This shader uses SCREEN_TEXTURE to display reflective image to simulate water. Just like the one in Unity it has some limitations.

Reflection is calculated using object's position, which means if you want to have reflection from top of the object then you need to set Y axis offset to half its height. Visible height of the water object can not exceed the distance to the top of the screen.

Adjustable parameters:
Reflection offset
Reflection blur(1)
Distortion
Waves
Shoreline
Shoreline foam

(1) Reflection blur is only available when project's dirver is set to GLES3, which might break effect stacking (eg. impact effect might completely remove water). A way to deal with this is described here.

Here's an example of the limitations.

In the first image the water starts from the bottom of the screen and goes up to the middle. Which means its visible height is equal to the distance to the top of the screen. In the second image camera is moved lower, which results in water height being greater than the distance to the top. In the third image the water is way higher than the middle of the screen, but its height is smaller that the distance to the top, so reflections work properly. Examples 2 and 3 do not feature reflections squashing, squashing the reflection results in a greater area being reflected which means that object's visible height must be smaller.

The scene contains a script that allows camera to move(WASD keys) and zoom(mouse scroll).

Impact effect/shockwave

Impact effect similar to the one produced by a shockwave during explosion. Can be used as a magic spell, terrain deformation effect.

Uses SCREEN_TEXTURE and offsets color using the circular gradient noise as a guide.

Click anywhere in the demo scene to produce the effect.

Dissolve

Dissolves the image using the noise as a guide.

Left click in the demo scene to dissolve sprite, right click to undo.

Magnifying glass

Magnifying glass effect. The script uses get_global_transform_with_canvas() to set the correct offset for the current position. When testing it on monitor with 1920x1080 resolution the magnification didn't work correctly if the display height was set above 850 and game window had border enabled. Without window border everything worked perfectly.

Changing edge distortion strength to positive/negative values results in simulating glass being concave/convex.

Use mouse wheel to zoom in/out.

Stealth cloak effect

Essentially this is a dissolve effect, that overlays one texture over another instead of simply changing the alpha.

Grass sway effect

A basic grass sway effect that modifies vertex positions to skew the object. In order for the effect to work properly modify offset to make object's origin to be at the bottom.

godot-shaders-1's People

Contributors

gamedevserj avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.