Coder Social home page Coder Social logo

momentous's Introduction

Momentous

This is a reimplementation of the particle system from "fr-059: momentum", using D3D10 GPU hardware.

I was thinking about this a few days back; the original version was using several hacks to get good performance on shader level 2 hardware, and the actual particle system ran on the CPU.

Well, the particle system is actually really easy to run on the GPU provided there is support for floating point render targets and filtering of floating point volume textures. That used to be a problem in 2007 but not today.

Also, having actual HW instancing support instead of having to get by with shader instancing sure makes things easier.

Tricks from the original implementation that made it into this version:

  • Hard-edged cubes specified using 8 vertices only (to reduce VS load). The original version determined the (faceted) normal in the pixel shader using a cube map lookup from an interpolated object-space position (passed as an attribute). This was the easiest way to do this on shader level 2 hardware, but it did tend to cause some sparkling near the edges (exactly which cube map face a near-edge sample landed on depended on interpolation rounding, which was a bit dicey).

    This version passes the world-space position as an attribute and then determines the face normal as the cross product of the position's derivatives. This is simpler, has no texture lookup, and does not have any sparkling. (But it does require derivative instructions).

  • Instance all the things!

  • Trilinear interpolation using smoothstepped weights: much cheaper than spline interpolation and looks almost as good.

Bonus: this version also renders each cube as an indexed triangle strip (14 verts plus primitive restart) - again, the original version was written before primitive restart was a feature you could rely on. This should not make any significant difference compared to explicit quads, but it feels nicer. :)

This uses D3D10 because I'm writing this on a Laptop with Intel integrated graphics and drivers that haven't been updated for over 2 years; was I feeling lucky enough to try GL 3? Evidently not.

Oh and I really need to add some camera control and shadow mapping, like the original version had.

-Fabian 'ryg' Giesen, December 2013

momentous's People

Watchers

 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.