Coder Social home page Coder Social logo

hdrpvatexample's Introduction

VAT (Vertex Animation Texture) on Unity HDRP examples

This is a repository that contains examples of the use of VAT (Vertex Animation Texture) on Unity High Definition Render Pipeline (HDRP).

In this document, "VAT" refers explicitly to the texture encoding method used in Houdini and SideFX Labs.

gif gif gif gif

Several types of VAT: Soft, Rigid, Fluid and Sprite

System requirements

  • Unity 2019.4
  • HDRP 7.4

How to use VAT with Shader Graph

At first, export VAT files from Houdini. It consists of a geometry file (.fbx), texture files (.exr) and a realtime data file (.json). Then import .fbx and .exr files into Unity. The texture files must be imported with the following settings:

  • sRGB (Color Texture): Off
  • Non-Power of 2: None
  • Generate Mip Maps: Off
  • Format: "Automatic" is recommended. You can select a lower BPP format with sacrificing quality.
  • Compression: "None" is recommended. You can try other options, but usually, they don't work with non-power of two textures.

importer

There are three types of shader graphs under the "Shader Graph" group: Soft, Rigid, and Fluid. You can use corresponding VAT methods with these shader graphs.

These shader graphs have some VAT dependent properties.

material

The "_numOfFrames", "_posMax" and "_posMin" properties must be set based on the realtime data. Open the exported .json file with a text editor and copy-paste these values to the corresponding properties.

You can use the packed-normal encoding (the "Pack normals into Position Alpha" option in the VAT exporter) with enabling the "Use Packed Normals" option in the material settings. Note that this may significantly increase the quantization errors in normal vectors.

To animate the mesh, you have to control the "Current Frame" property manually. Using a timeline would be the handiest way to do it.

The structure of the shader graph is quite simple. You can easily extend it to add features, like adding a albedo map or support of different surface types.

For example, an extended shader graph named "Soft Lerp" is used in the Soft example, that interpolates positions/normals between consecutive frames to achieve smooth animation.

How to use VAT with Visual Effect Graph

You can use a Sprite VAT to move particles in a Visual Effect graph; Other methods are not supported at the moment.

This project contains the following three subgraph operators that are designed to be used with VAT.

VAT Particle Count -- Calculates the number of particles contained in VAT. This is convenient to determine the number of particles to emit in the Spawn context.

VAT Particle UV -- Calculates the texture coordinates for each particle. This can be used to retrieve data from a position map.

VAT Convert Position -- Converts position data into a object space position vector.

For detailed usage of these operators, see Sprite example in this project.

Frequently Asked Questions

Is it possible to support Universal RP?

Yes. Although these examples are created with HDRP, you can use the same approach on Universal RP. These shader graphs and VFX graphs can be converted by changing a few options. Check the URP branch for details.

hdrpvatexample's People

Contributors

keijiro 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hdrpvatexample's Issues

Question : How to unpack normals

I have a question about how to unpack a texture.

https://github.com/keijiro/HdrpVatExample/blob/master/Assets/VAT/VATHelper.hlsl#L30

I am not sure what the process is for extracting the normals packed in the textures.
I have searched the internet and could not find any information on this.
Also, I could not find the source code to pack normals in the SideFX source code.
I am very sorry for the inconvenience, but could you please tell me what the process is?
Thank you in advance.

Set VAT Framerate

Hi Keijiro!

Is it somehow possible to set the playback framerate within unity? I have a houdini sim with 25 fps and since unity plays at 60 it would be great to adjust for this timing-difference.
Thanks a lot!

Compilation errors with Unity 2019.3.0b7

I installed everythings but I have errors
I use Unity 2019.3.0b7
image

image

Library\PackageCache\[email protected]\Runtime\RenderPipeline\HDRenderPipeline.cs(652,19): error CS0117: 'SupportedRenderingFeatures' does not contain a definition for 'overridesLODBias'

Asset import failed, "Assets/Cloth/Cloth.shadergraph" > NullReferenceException: Object reference not set to an instance of an object
UnityEditor.ShaderGraph.ShaderGraphImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at Library/PackageCache/[email protected]/Editor/Importers/ShaderGraphImporter.cs:135)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at <2a08bc3d8f9c4796ba99475f6f6c6a6b>:0)

Library\PackageCache\[email protected]\Runtime\RenderPipeline\HDRenderPipeline.cs(653,19): error CS0117: 'SupportedRenderingFeatures' does not contain a definition for 'overridesMaximumLODLevel'

Low poly problem in Unity

Hi I tried to use your example but something is wrong!

image

Record_2020_01_24_10_03_10_319

image

image

oh it's because of Normals
I don't know why I couldn't export normals!

image

Benefit of VAT with RBD over standard anim?

Hey there,
I saw you added the rigid body variation of the vertex animation texture. I had originally tried that out myself with no luck but was attempting to use the cloth shader just to see if it would work. Great to see this example. I had a question though, in your opinion, is there a benefit to using this method over just exporting with the RBD_to_FBX node? In my current project, I did it using that node and then just added the animation to Timeline as I wanted to use a Substance material on the RBD object, which it didn't look like I could export out of Houdini directly, so I had to add it on after importation into Unity.

By the looks of your shader, one could simply add the additional channels for textures to end up with a similar output as just using the lit node, so I am wondering if there might be some sort of performance benefit or what situation it might be best to use VAT over standard RBD_to_FBX animation?

Thanks again for all the work and amazing samples you put out for the community. Not sure what we would do without you. :D
-MH

Particle ID not consistent during playback

Hey Keijiro!

Thanks a lot for the reference, it was a great tool to fiddle around and understand how the VAT workflow will be within Unity.

I was trying to achieve an effect where every particle will have a different sprite on an Atlas based on the particle ID, but found out that the particle ID will suddenly swap (in the case of the lava example is every 1/3 of the playback). Any help would be greatly appreciated!

Cheers!

Vertex Anim Export options in Houdini

Heya,
When I open the .hip file and look at the output vertex animation node, but then try to make one of my own, I seem to be lacking some of the options.

Here is when I click on your node:

https://i.imgur.com/1QqJQ9F.png

But when I make one, I see this:

https://i.imgur.com/dPpyoX6.png

Are there options or a different node that I am supposed to use? I don't see the BBOX settings of anything that you used as the input within Unity.

Thanks,
-MH

Creating texture from Houdini

Hi!

First of all do appreciate Hdrp integration of Vat :)

I am trying to create VAT textures based on your Houdini file but seems to be some error when I try to open hip file.
vat_error

if I ignore those and render all via Houdini vat, animation goes wrong(positions seems wrong)
difference

Am using Houdini Indie 18.5.672 at the moment.
Would you be able to help on how to create vat textures from Houdini? or version you used to create example textures?

Thank you so very much :)

Possability of using this for blood?

Hey there,
This looks great! I just picked up a Houdini Indie license two weeks ago as I have been having a hard time trying to find nice looking blood effects that work for HDRP so I wanted to try to learn enough Houdini to accomplish this. I was wondering if perhaps this method you used here might be useful for that? I was going to try and use Albemic but I don't know enough about it yet, or even enough about Houdini to create liquid to try and test anything out. It would be great to get your input so I can try to steer what I am trying to learn toward whatever might end up working out best.

Thanks!
-MH

What an excellent example!

Dear Keijiro,

this is not an issue at all but since now my poc is working I really feel to say thank you so much for this excellent example. It gave me a mega boost in implementing realtime AND simulation vertex animation to Unity -> VR. It took me a while to figure out how to export particles from Houdini the "right" way in terms of framelength and particle-count to get a correct power of two exr-texture (which is actually super trivial but not obvious right from the start) ... The Unity project and the Houdini example are stripped down to the most needed tools to get it right. In combination with Vfx + Brekels PointCloud v2 tool (which is extremely nice too) I'm finally feel completely free artistically. So thank you again!

Edit:
BUT there is one tiny question though. In your Sprite example you are exporting a power of two amount of particles (at least towards the end of the sim -> 8192) makes a texture 2048x512 with 128 frames -> which i get. But what i don't get (and this is giving me still an headache on how to make my own animations a perfect loop) is that in the exposed properties settings you were setting the y-value of the texture to 640 instead of 512 + in the graph itself i also don't get the mathematical relationship bewteen the burst delay = 3.8 and the lifetime = 4. The Houdini project is set to 24fps and 128 frames total. I'd really appreciate if you could point out on how to put these values into a context that can be adjusted without getting weird loop-behaviours on my own textures/ animations.

Vat universal RP Question

Great job!
You open up a huge field of possibilities.
I admit that I looked at the universal RP approach a lot, but I failed to obtain a result.
would you have tracks to convert the VFX graph and the shader graph to universal RP format for android development?
sorry if the question has already been asked but I admit that I have not found any answer

Thanks again for your great work.

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.