Giter Site home page Giter Site logo

sdyby2006 / starrailnprshader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stalomeow/starrailnprshader

0.0 0.0 0.0 14.31 MB

Fan-made shaders for Unity URP attempting to replicate the shading of Honkai: Star Rail.

License: GNU General Public License v3.0

Python 1.60% C# 39.64% HLSL 28.69% ShaderLab 30.07%

starrailnprshader's Introduction

StarRailNPRShader

Important

Please read this file before using the shaders!!!

中文翻译点这里

Fan-made shaders for Unity URP attempting to replicate the shading of Honkai: Star Rail. The shaders are not 100% accurate because this project is not a reverse engineering - what I do is to replicate the in-game looks to the best of my ability.

my wife 0

↑↑↑ My Wife ↑↑↑

my wife 1

↑↑↑ My Wife ↑↑↑

my wife 2

↑↑↑ Also My Wife ↑↑↑

our mum

↑↑↑ Our Mum ↑↑↑

Character Shaders

  • Honkai Star Rail/Character/Body
  • Honkai Star Rail/Character/Body (Transparent)
  • Honkai Star Rail/Character/EyeShadow
  • Honkai Star Rail/Character/Face
  • Honkai Star Rail/Character/Hair

The rendering of character takes advantage of MRT whose pass is always executed after UniversalForward. As a result, when it comes to transparent objects, the rendering result may go wrong.

*To maintain this project more easily, I won't rewrite the whole render pipeline. You can do it yourself.

Post-processing

  • Custom bloom using the method shared by Jack He in Unite 2018.

  • Custom ACES tonemapping. The formula is

    $$f(x)=\frac{x(ax+b)}{x(cx+d)+e}$$

    where $a,b,c,d,e$ are all parameters.

Requirements

  • Basic knowledge of anime style rendering!!!
  • Unity >= 2022.3.
  • Universal RP >= 14.0.
  • My ShaderUtilsForSRP package.
  • (Optional) Newtonsoft Json package >= 3.2.1.

Newtonsoft Json is used by a custom editor util called Game Material Inspector which can help us read Material JSON files ripped by a certain tool. To enable that util, add the scripting define symbol PACKAGE_NEWTONSOFT_JSON in player settings after importing Newtonsoft Json package.

Guide

  • Use linear color space instead of gamma.
  • HDR should be enabled.
  • Depth priming must be disabled.
  • Depth texture must be enabled and generated by a depth prepass.
  • Rendering path must be forward currently.
  • Renderer Feature StarRailForward must be added to the renderer.
  • Reset the material after changing its shader.

Recommended post-processing settings

post-processing settings

Working with asset preprocessor

The asset preprocessor can

  • Automatically smooth the normals of character models and store them into tangents.
  • Automatically process textures.

The path patterns of the assets that need preprocessing can be configured in Project Settings/Honkai Star Rail/NPR Shader. The default patterns are designed to align with the naming style of in-game assets.

asset-path-patterns

For MMD models

Some extra steps must be done:

  • Switch Model Type to MMD on each material.

  • Add component SyncMMDHeadBone to the GameObject to which SkinnedMeshRenderer is attached.

    sync-mmd-head-bone

    Now, you can override the direction values of the head bone. Besides, two presets are provided in the context menu of the component.

    sync-mmd-head-bone-ex

Note that MMD models do not contain some detailed information so the final rendering result may not fully meet your expectation.

Rules

In addition to GPL-3.0 license, please give proper credits as well as a link to this repo when redistributing or using my code.

Special thanks

  • miHoYo
  • Related posts on Zhihu
  • Related videos on bilibili
  • °Nya°222

FAQ

Why outlines/rim-lights do not work?

Change the Model Scale at the top of the material.

starrailnprshader's People

Contributors

stalomeow 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.