Git Product home page Git Product logo

generic-raymarch-unity's Introduction

Distance Field Raymarcher for Unity

This is an implementation of Distance Field Raymarching in the Unity game engine. It was created to be used as a reference implementation in future projects. For a comprehensive technical writeup about how Distance Field Raymarching works, see this article on my blog.

Below are a few of the major features of this implementation:

  1. Complete Implementation of Distance Field Raymarching. This repository demonstrates how to construct a fully working implementation of Distance Field Raymarching. Using this repository as a base, you can focus on implementation details instead of the more technical aspects of raymarching. Additionally, I include a number of useful Distance Field primitives (sphere, box, torus, cylinder, etc) and Combine Operations (Union, Intersection, Subtraction) - see DistanceFunc.cginc for details. Below is a gif of the included demo scene:
  2. Interaction with mesh-based Objects. This implementation takes Unity's depth buffer into account, so your raymarched objects can intersect and interact with traditional mesh-based objects.
  3. Heatmap-based Performance Testing. The system has support for heatmap-based performance testing using a color ramp. Below is an example of this output (red = many samples per pixel, blue = fewer samples):
  4. Open Source and License. This implementation is released under the liberal MIT License, so it is easy use it in your projects.

generic-raymarch-unity's People

Contributors

flafla2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

generic-raymarch-unity's Issues

Weird behavior on macOS

I just tried your example on macOS Sierra and it looks odd: http://imgur.com/CnCddg0

This is with unity version 5.4.1f1 Personal.

Note: I haven't tried on any other unity versions or OSes so the title might be overly specific.

VR Support

I'll try and take a look myself but I'm trying to find a raymarcher that blits directly to the camera that does work in VR to use as an example. Most tend to use a quad parented to the camera.

Object Overlapping and Self Overlapping Bug

when viewing shapes overlapping other shapes or even themselves at extreme angles, strange artifacts tend to occur. It's best explained with pictures.
Maybe I'm just misunderstanding and this is the nature of an acceptably fast step size, but it seems pretty strange, such as the exponential artifact on the cube.

image

thing

thing2

Building to Android

When trying to build to Android I get an Error on the vert shader, that should be fixed to this:
o.ray = mul(_CameraInvViewMatrix, float4(o.ray, 0));

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.