Coder Social home page Coder Social logo

moto2002 / particlemotionvector Goto Github PK

View Code? Open in Web Editor NEW

This project forked from keijiro/particlemotionvector

0.0 2.0 0.0 1.17 MB

Shows how to support rendering motion vectors within the standard particle system of Unity.

C# 39.64% HLSL 43.85% ShaderLab 16.50%

particlemotionvector's Introduction

ParticleMotionVector

This is an example that shows how to support rendering motion vectors within the standard particle system of Unity.

Particles/Standard Opaque with Motion Vectors

inspector

This shader only supports rendering mesh particles without transparency. It may not sound very useful for particle effects in a general sense, but actually useful in some specific cases, like when rendering many small moving objects (asteroids, confetti, etc.) by using a particle system.

movec gif

When using this shader, "Simulation Space" in the main module and "Render Alignment" in the renderer module have to be set to "World". This is needed to calculate rotations correctly in the motion vector writer.

inspector

Also the custom vertex streams have to be set up in the following order:

  • UV (TEXCOORD0.xy)
  • Center (TEXCOORD0.zw|x)
  • Velocity (TEXCOORD1.yzw)
  • Rotation3D (TEXCOORD2.xyz)
  • RotationSpeed3D (TEXCOORD2.w|xy)

vertex streams

System requirements

  • Unity 2017.1 or later

Current limitations

In the current implementation, change of the particle size is ignored in the calculation of motion vectors. This may introduce artifacts when animating the particle size with using the "Size over Lifetime" module or the "Size by Speed" module.

How about transparency?

I haven't tried transparency with motion vectors because I think it works only if someone tweaks it very carefully (and I have no time to invest in it). I won't recommend it, but you can try it anyway.

License

Copyright (c) 2017 Unity Technologies

This repository is to be treated as an example content of Unity; you can use the code freely in your projects. Also see the FAQ about example contents.

particlemotionvector's People

Contributors

keijiro avatar

Watchers

James Cloos avatar  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.