Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Historica Fantasia, Development Blog 06, ShaderForge Character Shader

955 views

Published on

Historica Fantasia, Development Blog 06, ShaderForge Character Shader

Published in: Technology
  • DOWNLOAD FULL eBOOK INTO AVAILABLE FORMAT ......................................................................................................................... ......................................................................................................................... 1.DOWNLOAD FULL. PDF eBook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB eBook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc eBook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. PDF eBook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. EPUB eBook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... 1.DOWNLOAD FULL. doc eBook here { https://tinyurl.com/y6a5rkg5 } ......................................................................................................................... ......................................................................................................................... ......................................................................................................................... .............. Browse by Genre Available eBooks ......................................................................................................................... Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, CookeBOOK Crime, eeBOOK Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult,
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Historica Fantasia, Development Blog 06, ShaderForge Character Shader

  1. 1. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 1 By Matumit Sombunjaroen V1.1 2017/04/17 Historica Fantasia Dev Blog Chapter6: Character Shader Hypothesis
  2. 2. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 2 The Reason this is done before Programming Historica Fantasia will field Up to a Maximum of 100-200 individual Characters at once. Most Models will be duplicate. But Processing test is still needed to see the Limits. Depending on the result of this Experiment, Certain Battle Presentations cannot be Use Best Case Scenario: Full3D Just put everyone on the field like in TotalWars Worst Case Scenario: Cut-in Battle Only do full render on Units that are taking part in a Battle
  3. 3. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 3 Rendering Objective Flesh Cloth02 Leather01 Metal Faction Color Leather02 Every Characters will all share the Same Materials. This is done by allocating UV to a color slot in the texture. Pros: Minimal Resources Needed for Rendering Can field vast amount of Characters with Shared Materials Cons: Cannot use Normal or Occlusion Map Need High PolyCount to obtain Hi-Quality Visual Because there will be no close-up shots of the Characters, The Cons should not be much of an issue.
  4. 4. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 4 Toon Ramp Shading Flesh Cloth02 Leather01 Faction Color Leather02 Non Metallic parts will use Toon Ramp Shader With Maximum of 3 Ramps for Shadow => Base => Highlight The Shader will also receive Lighting from Environment.
  5. 5. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 5 Toon Metallic Shading Gloss Highlight Fresnel Light (Not sure if it’s the correct term) Rim Light On top of Toon Ramp Shading, Add Gloss Fresnel and Rim Lights. Variations for various Metals
  6. 6. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 6 Shader Forge For various Reasons, Shader Forge, will be use for the Experiment
  7. 7. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 7 Experiment 1 Faction Color
  8. 8. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 8 Issues Player and Enemy will have Different Color Clothing. But increasing Materials or SubMesh will increase SetPass. The Problem is, Adjusting a Material will make a Global Effect As such, the same Material cannot be use for both Faction Primary Solutions: Using Script to relocate Cloth’s UV to another Color’s coordinate. Secondary Solutions: Add another Material per Faction. Add SubMesh to Model.
  9. 9. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 9 Experiment – Relocating UV This Script successfully allocate the 1st 50UVs To Blue Coordinate (0.5,0.5). The Problem is, In order for this to work, You need to know which UV Indexes are used for the Faction Cloth Mesh. Because there is no effective way of finding it out, Other than Trials & Errors per Model, This is really impractical.
  10. 10. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 10 Experiment – Relocating UV 1.1FIXED This will get Tri index Arrays from Submesh UV Index is the same as Triangle
  11. 11. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 11 Experiment – Multiple Objects By increasing the exact same objects. Batches & SetPass Calls do not get increase. Adding another Material to same Object Increase Batches & SetPass. Adding a different Object with same Material Increase Batches, But do not increase SetPass. Therefore, it is preferable to Increase Object Count, than to Increase Material.
  12. 12. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 12 Experiment – SubMesh This one is an Object with a SubMesh, And Have 2 Materials assigned to it. The Result is similar to having 2 of the same Object With different Material. Because SubMesh is part of the same Object, It also has the issue with UV index
  13. 13. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 13 Conclusion Make Faction Cloth a separate Mesh, Share the Same Material with Every Factions, Then use Script to reallocate just the Cloth UVs.
  14. 14. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 14 Experiment 2 Multiple Shader Material
  15. 15. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 15 Issues Using Masking in ShaderForge, Is it possible to obtain different Shadings in different Color Slot In a Single Material? We will try a simple Experiment, Where only Red Slot will have a different Shading.
  16. 16. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 16 ShaderForge Test …..IT WORKED….. This is more simple than I thought. Basically, all I had to do is Multiply Masking ----------------------------------------------------- In the case of very Complex Masking, Pre-Multiply each Shading Scheme to a Mask => Then Add everything with Add Node.
  17. 17. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 17 Conclusion By Using ShaderForge Masking, There is no need to separate Metal to a different Materials As such, only 1 Material is needed
  18. 18. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 18 Experiment 3 Shader Setup
  19. 19. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 19 Toon Ramp This part of the Shader will create Toon Ramp The Color is affected by Environmental Light Ramp is created by Multiplying a Gradient Texture ----------- As an alternative, Light Color can be replace with Colored Ramp. This will reduce needed Processing Power. But the Color will no longer be affected by Environmental Light
  20. 20. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 20 Metallic Toon I cannot remember what I did any more, Let just say it worked Rim Light Gloss
  21. 21. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 21 Toon Ramp V02 A Different Version, This one Create Ramp Step from Float Value Compare to Ramp Texture, it is faster to update, But it cannot do Smooth Shadowing on Steps. ----------- The Process is made by Unity’s Kobayashi-San You can reference his shader from here https://www.slideshare.net/nyaakobayashi/unity-14- shader-forge-102-shaderforge
  22. 22. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 22 Experiment 4 Try Mass Field Units
  23. 23. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 23 Characters to use I am using Aoi Character Pack, from Asset Store. It has Multiple Preset Characters with 3 LODs each. Since each Model are from different Files, We can use each of them to represent a Model We will try with HiRes Models first, then down to LowRes Models 10 Models were randomly selected as Base
  24. 24. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 24 Setup In the case of a Single Character, FPS: 124.4 Tri: 52k Batches: 22 SetPass Calls: 7 After Filling in the Scene with 200 Characters, FPS: 76.1 Tri: 4.8M Batches: 2062 SetPass Calls: 8
  25. 25. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 25 …..Try Animating Using Walking Motion from Blendshape & Tails FPS: 56.7 Tri: 4.8M Batches: 2062 SetPass Calls: 8 ….This turned out way better than I thought…..
  26. 26. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 26 What else can we do? Even if I were to go for a relatively high Polycount for the Final Product, it should be no more than 5k per Model 5k*200 = 1M Tri => Nearly 5times lower than what we tested. + The Models will not be shown all at once on Screen So, In Conclusion, there should be no Problem With Method Selection But just for the sake of Science, I will try to see how many Models can I fit in to get it down lower than 30FPS
  27. 27. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 27 After several try, 600 Characters FPS: 24.7 Tri: 12.8M Batches: 5458 SetPass Calls: 8 As a Side note, this is my PC Spec
  28. 28. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 28 Try the Original Try Animating 200 Characters w/10 Different Base Models + Original Materials FPS: 95.8 Tri: 168k Batches: 71 SetPass Calls: 71 FPS: 39.6 Tri: 3.3M Batches: 1401 SetPass Calls: 1401 There’s a really big differences when compared to using a Single Material
  29. 29. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 29 One Final Try Originally, each Model has Submeshes with 4 Materials We tried using one Material per Model instead FPS: 92.5 Tri: 188.6k Batches: 81 SetPass Calls: 23 FPS: 39.3 Tri: 3.7M Batches: 1601 SetPass Calls: 441 Even if the Models do have Submeshes, Assigning them with the same Material lower it down
  30. 30. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 30 Final Comparison Single Material FPS: 56.7 Tri: 4.8M Batches: 2062 SetPass Calls: 8 10 Materials FPS: 39.3 Tri: 3.7M Batches: 1601 SetPass Calls: 441 Original FPS: 39.6 Tri: 3.3M Batches: 1401 SetPass Calls: 1401
  31. 31. @OtakuEatMama : @HistoricaFantasiaDevBlog : Zenneth@zodiac-alliance.com 31 Final Conclusion Put every character on the field like Total Wars is possible With this Single Material Method

×