• Stars
    star
    302
  • Rank 138,030 (Top 3 %)
  • Language ShaderLab
  • License
    MIT License
  • Created almost 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A port of Evan Wallace's "Water Demo" for WebGL to Unity.

Water Demo

Water demo GIF showing caustics.

This is a port of Evan Wallace's Water Demo from WebGL to Unity.

Motivation

I ported this as an exercise to investigate different real-time caustics implementations. I've only surveyed a handful of research papers on real-time caustics, but it seems like Evan's work would be suitable for publication for both its simplicity and performance.

Requirements

  • Unity 2018.2.17f1

Usage

Create a new project using Unity 2018.2.17f1. Clone this repo into the "Assets" directory. Open the "cube-of-water" scene and hit play.

Click on water to cause a wave.

You can click on the water to cause a wave. You can drag to move the camera around. Hit "space" key to pause water simulation. Hit "n" key to update the simulation one time step.

Implementation Notes

This is a pretty faithful reproduction of Evan's demo. As such there are a number of cases where it deviates from Unity's conventions.

For instance, the shader that renders the sphere has variable sphereCenter, so the sphere rendering object is expected to located at the origin and if you change that, it probably will not look right.

The light direction is provided to shaders as a direction vector. It doesn't use Unity's lighting at all.

The shaders do not use the models' UV coordinates. For instance the cube's minimum and maximum model position are (-1, -1, -1) and (1, 1, 1), so any point on its surface is often just mapped directly to a UV coordinate [0, 1]^2 by transforming the point p by p * 0.5 + 0.5. This works fine for the purposes of the demo, but one would probably want to switch to UV coordinates in the future.

A lot of this is smoke and mirrors. The cube knows where the sphere is, so it renders its shadow. Great for a tech demo, but if you want to allow for multiple spheres or other objects, this will need to be reformulated significantly.

Bugs

  • WebGL build not working (major regression from original project).

  • Not all UI elements from original are preserved.

  • Underside of water does not reflect like it should. Seems like a HLSL lerp problem.

See the todo.org file for more details.

License

This project is released under the MIT license.

The tiles texture appears to be Patrick Hoesly's and was released under the Creative Commons Attribution (CC-BY) license.

Contact

I won't be providing any support for this, but if you want to follow me and the strange things I make you can find me on twitter @shanecelis.

More Repositories

1

emacsy

An embeddable Emacs-like library for GNU Guile Scheme
Scheme
108
star
2

hideshow-org

Provides org-mode like hide and show for hideshow.el
Emacs Lisp
75
star
3

trowel

A sprig firmware implementation in rust
Rust
23
star
4

SeawispHunter.RolePlay.Attributes

Defines role playing attributes like "health" using generics that are modified non-destructively and notify on changes
C#
15
star
5

unity-package-template

Creates a Unity 3D package from a template
C#
11
star
6

creatures

Thomas Miconi's code for evolving virtual creatures for numerous things, reworked for my purposes
Shell
10
star
7

contacts

Display contacts from the AddressBook database
Objective-C
9
star
8

push-forth-dotnet

Push-forth is a light-weight, strongly-typed, stack-based genetic programming language for .NET
C#
7
star
9

SeawispHunter.Maths

Computes Entropy, Conditional Entropy, Mutual Information, and probabilities from tallies.
C#
7
star
10

eureqa-mathematica-client

A Eureqa Client for Mathematica
C
7
star
11

yasnippet-latex-mode

Collection of latex-mode snippets for yasnippet in Emacs
6
star
12

emacsy-webkit-gtk

A barebones browser with an echo-area/minibuffer any Emacsian will love
C
6
star
13

code-cite

Tool to cite code from various sources
Shell
5
star
14

hello-emacsy

A Minimal Emacsy Example Program
Shell
5
star
15

delta-forth-net

Delta Forth .NET Compiler
C#
5
star
16

KeySequences

C#
4
star
17

minimal-emacsy-example

Minimal Emacsy Example Program
C
4
star
18

shanecelis.github.com-defunct

Blog
HTML
3
star
19

guile-osc

A guile library to interact with Open Sound Control
Scheme
3
star
20

amhello

A "hello world" for autoconf and automake
C
3
star
21

MetaDotNetBook

Code from the book Metaprogramming in .NET by Hazzard and Bock. https://archive.codeplex.com/?p=metadotnetbook
C#
2
star
22

sussex-thesis-doc

Sussex Master's thesis and code.
Objective-C
2
star
23

nuweb

My personal fork of the literate programming tool nuweb 1.58
C
2
star
24

unity-compiler-definitions

Show all the operant Unity platform specific compiler definitions.
C#
2
star
25

minibuffer-arcadia-support

Adds lisp support to Minibuffer using Arcadia, a Clojure development environment for Unity3D.
Clojure
2
star
26

FileOpener

A file opener for Unity3d's editor, ensures Emacs and vim go to the right line and column
C#
2
star
27

the-garden

The Garden v2.0: A Parable Inspired by the Church of Emacs
1
star
28

guile-nsga-ii

A guile wrapper for the NSGA-II library
C
1
star
29

HyperSharpNEAT

C#
1
star
30

mEngine

Robert Zhang's tool to connect Mathematica to MATLAB
C
1
star
31

guile-mathematica

Bare bones library to evaluate a Mathematica expression
Scheme
1
star
32

ode-0.12-drawstuff

Open Dynamics Engine version 0.12 that can install the drawstuff library
C++
1
star
33

guile-noweb-autotools-template

A project template for guile libraries that use Noweb and Autotools
Scheme
1
star
34

sussex-thesis

Code for Sussex Master's thesis
Objective-C
1
star
35

guile-bullet

A guile wrapper for the Bullet library
Scheme
1
star
36

guile-unified-procedure

A convenience library for easy interchange of C function pointers and Scheme procedures
Scheme
1
star
37

csys-395-assignments

CSYS-395 Evolutionary Robotics Assignments
C++
1
star
38

guile-minimal-cognition

Guile library for doing Beer minimal cognition simulations with CTRNN, vision, and first order dynamics
Scheme
1
star
39

guile-logging

A guile wrapper for the log4c logging library
Scheme
1
star
40

qemacs

C
1
star
41

bevy_terminal_shader

An old school terminal shader for the bevy game engine
WGSL
1
star