GithubHelp home page GithubHelp logo

unitytechnologies / urp-defender-character-demo Goto Github PK

View Code? Open in Web Editor NEW
211.0 8.0 33.0 660.06 MB

TressFX Hair plugin (Beta), Character Package, and Hairstyles assets for Universal

License: Other

C# 34.51% HLSL 65.49%

urp-defender-character-demo's Introduction

(URP) Defender Character Demo

Character Package, and Hairstyles assets released

Defender Defender

Please note: The digital character in this package is provided under a restricted license for educational and non-commercial use only and attribution to Unity is required. Please read the license terms.

The technology stack is under Unity’s standard Asset Store EULA.

Animation Demo

YouTube
Bilibili

Description

This package includes a new strand base hair system that integrated from the AMD’s TressFX hair system. This hair system supports both Universal Render Pipeline (URP) and High Definition Render Pipeline (HDRP). Our goal is that this real-time strand hair simulation and rendering system support for cross platform from desktop computer, consoles to mobile devices.

While this hair system has a lot more work remains to be done, we’re sharing what we have at the moment. You’re free to use or modify it to fit your productions and build if needed.

For more information of the hair creation workflow, please check out our Blog

HairFX Core package only is also available on github here

Requirements

  • Unity 2021.2.13f1 +
  • Universal Render Pipeline 12.1.4 +
  • Git for Package installation in Unity Editor

Here’s what’s in the box

  • Defender character with Multi-Hair styles
  • Custom ShaderGraph shader for URP:
    • Marschner lighting hair shader
    • Pre-Integrated skin lighting shader
    • Parallax eye shader
    • Anisotropic lighting shader
    • Multi Detail or Thread map shader

Instruction

  1. Option 1: Clone via Git or GitHub Desktop (Recommended)

    • After Clone the repository that it needs to Enable 'Git LFS'

    Option 2: Direct Download the Zip file

  2. Launch the project with Unity Editor

  3. Open the sample scene: Assets/(URP) Defender - Character Demo/Scenes/Char_Test.unity

Note

  • The TressFX Exporter plugin for Maya is in Libray/PackageCache/cn.unity.hairfx.core/Maya_TressFX_Exporter~ folder or download here
  • This hair system is not the same hair system that show in ENEMIES demo video, which is separate hair system that created by Unity DemoTeam, you can find it on github here
  • Looking for High Definition Render Pipeline (HDRP)? --> HDRP project

Tips

If you build this hair system to mobile platform, please try to limit the total hair strand count less then 10 thousand in the viewing screen to maintain good frame rate. The performance of FPS is also depend on your device hardware.

Known Issues

Currently not supports Huawei mobile phones due to some device does not support StructuredBuffer for vertex program in shader

Also this hair system tested mainly on iPhone, it may not compatible all Android mobile device

Related links

AMD TressFX github

urp-defender-character-demo's People

Contributors

michael430 avatar michael430unity 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

urp-defender-character-demo's Issues

Using too much memory

"I ran the 'Defender' demo on iOS, and I noticed that the memory usage keeps increasing when I change outfits or switch hairstyles. When I try to destroy the previous hairstyle, the memory growth slows down, but it still continues to increase, eventually causing the phone to crash due to excessive memory usage. I can see that the 'DestroyHairObjects' method is being called in the 'HairFXGroom' code, but for some reason, it's not releasing all the memory. What should I do?"

If you are facing memory issues in the 'Defender' demo on iOS, it might be a technical problem related to the game's code or how memory management is handled within the application. You may want to reach out to the developers of the demo or the game's support team for assistance in troubleshooting and resolving this memory-related problem.

我在ios上运行了defender这个demo,当我换装、切换头发的时候,我发现内存越来越高,当我尝试销毁上一个头发的时候,增速放缓,但是依然会增加,导致手机因内存过大而崩溃,我看HairFXGroom代码里也确实走了DestroyHairObjects这个方法,但是不知什么原因无法全部释放,我该如何操作?

Device: iPhone15, iOS17.0

截屏2023-10-19 15 49 17
截屏2023-10-19 15 56 47
截屏2023-10-19 15 57 25
截屏2023-10-19 16 36 34
IMG_0001

public void ChangeHairStyle(int index)
{
    //Debug.Log($"index: {index}");
    
    if (lastHair != null)
    {
        if (lastHair.TryGetComponent<HairFXSimulation>(out var simulation))
        {
            simulation.enableSimulation = false;
            Destroy(simulation);
        }
        
        if (lastHair.TryGetComponent<HairFXGroom>(out var groom))
        {
            groom.enabled = false;
            Destroy(groom);
        }
        
        Destroy(lastHair);
    }
    index %= hairStyles.Length;
    GameObject hair = Instantiate(hairStyles[index], Vector3.zero, quaternion.identity, hairGroups.transform);
    lastHair = hair;
}

Thread Performance Checker: Thread running at User-interactive quality-of-service class waiting on a thread without a QoS class specified. Investigate ways to avoid priority inversions
PID: 25760, TID: 1672985
Backtrace

3 UnityFramework 0x000000010aac14d4 _ZN12UnityClassic31Baselib_SystemSemaphore_AcquireENS_30Baselib_SystemSemaphore_HandleE + 28
4 UnityFramework 0x000000010a6f11c8 _ZN15GfxDeviceClient16CreateGpuProgramE20ShaderGpuProgramTypeRK13dynamic_arrayIhLm0EER22CreateGpuProgramOutput + 424
5 UnityFramework 0x000000010a5e256c _ZN9ShaderLab10SubProgram7CompileERNS_15CompilationDataE + 1156
6 UnityFramework 0x000000010a5e3a2c _ZNK9ShaderLab7Program40EnsureCompiledAndMarkUnsupportedIfFailedEPKNS_10SubProgramEiRKN8keywords17LocalKeywordStateEPS5_R19ShaderSnippetResult + 164
7 UnityFramework 0x000000010a5e3ea4 _ZNK9ShaderLab7Program21GetMatchingSubProgramEPK6ShaderPKNS_4PassERKN8keywords17LocalKeywordStateEjPS8_R19ShaderSnippetResult26AsyncShaderCompilationModebii + 888
8 UnityFramework 0x000000010a5dba48 _ZNK9ShaderLab11ShaderState20FindSubProgramsToUseEPK6ShaderPKNS_4PassERNS_11SubProgramsERK17ShaderPassContextRKN8keywords17LocalKeywordStateEbii + 204
9 UnityFramework 0x000000010a5d9508 _ZNK9ShaderLab11ShaderState16ApplyShaderStateEjPK19ShaderPropertySheetRK17ShaderPassContextRKN8keywords17LocalKeywordStateEP6ShaderPNS_4PassEPbPNS_11SubProgramsEPK22DeviceRenderStateBlockii + 144
10 UnityFramework 0x000000010a5d941c _ZN9ShaderLab4Pass9ApplyPassEjPK19ShaderPropertySheetR17ShaderPassContextRKN8keywords17LocalKeywordStateEP6ShaderiiPbPKNS_10GrabPassesEPNS_11SubProgramsEPK22DeviceRenderStateBlock + 160
11 UnityFramework 0x000000010a5c3f14 _Z26ApplyMaterialPassWithCacheRK18SharedMaterialDataR17ShaderPassContextP6ShaderPN9ShaderLab4PassEiibPKNS6_10GrabPassesEPNS6_11SubProgramsEPK22DeviceRenderStateBlock + 356
12 UnityFramework 0x000000010a5b2f10 _ZN8Material11SetPassFastEPN9ShaderLab4PassER17ShaderPassContextP6ShaderiibPNS0_11SubProgramsE + 276
13 UnityFramework 0x000000010a5b307c _ZN8Material21SetPassSlowWithShaderEP6ShaderiR17ShaderPassContextib + 104
14 UnityFramework 0x000000010a812480 ZN2UI6Canvas11DrawRawMeshERNS_5BatchEP9GfxBufferS4 + 492
15 UnityFramework 0x000000010a8127dc _ZN2UI6Canvas14RenderOverlaysEv + 172
16 UnityFramework 0x000000010a81ca8c _ZN2UI13CanvasManager14RenderOverlaysEi + 228
17 UnityFramework 0x000000010a588460 _Z12PlayerRenderb + 712
18 UnityFramework 0x000000010a5896d8 _Z17ExecutePlayerLoopP22NativePlayerLoopSystem + 100
19 UnityFramework 0x000000010a589718 _Z17ExecutePlayerLoopP22NativePlayerLoopSystem + 164
20 UnityFramework 0x000000010a589974 _Z10PlayerLoopv + 272
21 UnityFramework 0x000000010aa1b974 _ZL19UnityPlayerLoopImplb + 112
22 UnityFramework 0x0000000109e2b678 UnityRepaint + 28
23 UnityFramework 0x0000000109e2b64c -[UnityAppController(Rendering) repaint] + 116
24 UnityFramework 0x0000000109e2b59c -[UnityAppController(Rendering) repaintDisplayLink] + 120
25 QuartzCore 0x00000001b317c0f4 0FB9E837-C0AA-3977-A0BE-28BA0F207A50 + 196852
26 QuartzCore 0x00000001b317f2dc 0FB9E837-C0AA-3977-A0BE-28BA0F207A50 + 209628
27 QuartzCore 0x00000001b317ede8 0FB9E837-C0AA-3977-A0BE-28BA0F207A50 + 208360
28 QuartzCore 0x00000001b31fd378 0FB9E837-C0AA-3977-A0BE-28BA0F207A50 + 725880
29 UIKitCore 0x00000001b3e12d94 948B271A-D49D-3B3F-AC08-2223908F51AB + 699796
30 UIKitCore 0x00000001b3e12484 948B271A-D49D-3B3F-AC08-2223908F51AB + 697476
31 UIKitCore 0x00000001b3e12540 948B271A-D49D-3B3F-AC08-2223908F51AB + 697664
32 CoreFoundation 0x00000001b1b8cacc CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 228044
33 CoreFoundation 0x00000001b1b8bd48 CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 224584
34 CoreFoundation 0x00000001b1b8a4fc CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 218364
35 CoreFoundation 0x00000001b1b89238 CEB74A0C-5EA4-3F5A-9DE8-73F0DAD2F4CB + 213560
36 CoreFoundation 0x00000001b1b88e18 CFRunLoopRunSpecific + 608
37 GraphicsServices 0x00000001f46455ec GSEventRunModal + 164
38 UIKitCore 0x00000001b3f97350 948B271A-D49D-3B3F-AC08-2223908F51AB + 2290512
39 UIKitCore 0x00000001b3f9698c UIApplicationMain + 340
40 UnityFramework 0x0000000109e2ae68 -[UnityFramework runUIApplicationMainWithArgc:argv:] + 136
41 HairFX-TressFX 0x00000001005f41d0 main + 76
42 dyld 0x00000001d436bd44 1366C02B-1A31-33C8-BE06-D44C8C8E0310 + 23876
<0x1090b4a90> Gesture: System gesture gate timed out.

Maya plugin does not work with 2023.2

After following the installation instructions I'm getting this error:
// Error: file: C:/Program Files/Autodesk/Maya2023/scripts/others/pluginWin.mel line 316: (TressFX_Exporter)

The Plugin-Manager sees it, but it will not let me select the "Loaded" option without giving me the error above.

What version(s) of Maya work with this plugin? Thanks.

Errors when opening zip file in Unity 2022.2.18

Im getting these errors after using Option 2: Direct Download.

Library\PackageCache\cn.unity.hairfx.urp@bbb80d9f95\Editor\ShaderGraph\UniversalPipeline\PhysicalHair\AssetCallbacks\UniversalPhysicalHairSubTarget.cs(35,61): error CS0117: 'CorePragmas' does not contain a definition for 'ForwardSM45'
Library\PackageCache\cn.unity.hairfx.urp@bbb80d9f95\Editor\ShaderGraph\UniversalPipeline\PhysicalHair\AssetCallbacks\UniversalPhysicalHairSubTarget.cs(36,61): error CS0117: 'CorePragmas' does not contain a definition for 'InstancedSM45'
Library\PackageCache\cn.unity.hairfx.urp@bbb80d9f95\Editor\ShaderGraph\UniversalPipeline\PhysicalHair\AssetCallbacks\UniversalPhysicalHairSubTarget.cs(37,61): error CS0117: 'CorePragmas' does not contain a definition for 'DefaultSM45'

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.