-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/uber lit shader #32
Merged
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
248c0ea
Merge branch 'main' into feature/uber_lit_gui
CyTakayukiKiyohara 1a7a04b
Implementation GUI for lit.
CyTakayukiKiyohara 5959f8b
New UberLit features include normalMap, metallicMap, and smoothnessMap.
CyTakayukiKiyohara e6b0de0
Implement Lit( On the way).
CyTakayukiKiyohara 305f217
Implementation Lit( On the way ).
CyTakayukiKiyohara 360a352
Finished the Metallic WorkflowMode is Implemented.
CyTakayukiKiyohara 1258079
Add _NormalMapBumpScale property.
CyTakayukiKiyohara 2596758
Implementation UberLit test
CyTakayukiKiyohara 356dcd8
Add tests for uber lit.
CyTakayukiKiyohara 702257f
Bug Fix : URP and NOVA have different lighting on android.
CyTakayukiKiyohara 4a8ba3c
Merge branch 'develop_lit' into feature/uber_lit_shader
CyTakayukiKiyohara f084a5c
Add a comment.
CyTakayukiKiyohara dfe1976
Implement to Picking and SceneSelectionPass.
CyTakayukiKiyohara 8380b8e
Implement DepthNormalPass And DepthOnlyPass.
CyTakayukiKiyohara 51143a8
Add UberLit Test.
CyTakayukiKiyohara 0a86615
Rename the file.
CyTakayukiKiyohara 231e0b7
Fixed : Don't move TestUberLit_00.
CyTakayukiKiyohara 96eab88
Remove useless include files.
CyTakayukiKiyohara 81c3df1
Fixed warning.
CyTakayukiKiyohara 79fad49
Move files from Test folder to Demo folder.
CyTakayukiKiyohara fca73df
Rebuild Reflection Probe
CyTakayukiKiyohara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Implement Lit( On the way).
- Loading branch information
commit e6b0de028878619bf3961af4c22a88f5a95b5e06
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
123 changes: 123 additions & 0 deletions
123
Assets/Nova/Editor/Core/Scripts/Shaders/ParticlesUberLitForward.hlsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#ifndef NOVA_PARTICLESUBERLITFORWARD_INCLUDED | ||
#define NOVA_PARTICLESUBERLITFORWARD_INCLUDED | ||
|
||
#define FRAGMENT_USE_NORMAL_WS | ||
#define FRAGMENT_USE_VIEW_DIR_WS | ||
// todo If _SPECULARHIGHLIGHTS_OFF is defined, specular highlight is disabled. | ||
#define _SPECULARHIGHLIGHTS_OFF | ||
// todo If _ENVIRONMENTREFLECTIONS_OFF is defined, environment reflections are desabled。 | ||
#define _ENVIRONMENTREFLECTIONS_OFF | ||
// todo If _NORMALMAP is defind, normal map is used. | ||
#define _NORMALMAP | ||
// todo If REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR is defined, uv coords of shadow map is calculated in vertex shader. | ||
#define REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR | ||
// todo If MAIN_LIGHT_CALCULATE_SHADOWS is defined, shadow are cast on the objects. | ||
#ifdef _MAIN_LIGHT_CALCULATE_SHADOWS | ||
#define MAIN_LIGHT_CALCULATE_SHADOWS | ||
#endif | ||
|
||
#include "ParticlesUberUnlitForward.hlsl" | ||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" | ||
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl" | ||
#include "ParticlesUberLit.hlsl" | ||
|
||
VaryingsLit vertLit(AttributesLit input) | ||
{ | ||
VaryingsLit output = (VaryingsLit)0; | ||
output.varyingsUnlit = vert(input.attributesUnlit); | ||
|
||
output.positionWS.xyz = TransformObjectToWorld(input.attributesUnlit.positionOS.xyz); | ||
|
||
// Calculate tanget and binormal | ||
#ifdef _NORMALMAP | ||
output.tangentWS.xyz = TransformObjectToWorldDir(input.tangentOS.xyz, true); | ||
output.tangentWS.w = input.tangentOS.w; | ||
output.binormalWS = cross(output.varyingsUnlit.normalWS, output.tangentWS) * input.tangentOS.w; | ||
#endif | ||
|
||
half3 vertexLight = VertexLighting(output.positionWS, output.varyingsUnlit.normalWS); | ||
half fogFactor = ComputeFogFactor(output.varyingsUnlit.positionHCS.z); | ||
output.positionWS.w = fogFactor; | ||
|
||
OUTPUT_SH(output.varyingsUnlit.normalWS.xyz, output.vertexSH); | ||
|
||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) | ||
output.shadowCoord = TransformWorldToShadowCoord(output.positionWS.xyz); | ||
#endif | ||
|
||
return output; | ||
} | ||
half GetMetallic( float3 uvw ) | ||
{ | ||
half4 metallic = SAMPLE_METALLIC_MAP(uvw.xy, uvw.z); | ||
return metallic[(int)_MetallicMapChannelsX.x];; | ||
} | ||
half GetSmoothness( float3 uvw ) | ||
{ | ||
const half4 smoothness = SAMPLE_SMOOTHNESS_MAP(uvw.xy, uvw.z); | ||
return smoothness[(int)_SmoothnessMapChannelsX.x]; | ||
} | ||
half4 fragLit(VaryingsLit input) : SV_Target | ||
{ | ||
Varyings inputUnlit = input.varyingsUnlit; | ||
half4 color = frag(inputUnlit); | ||
SurfaceData surfaceData = (SurfaceData)0; | ||
// OK | ||
surfaceData.albedo = color.xyz; | ||
// TODO Survey the SampleNormalTS Function in Particels.hlsl in URP package. | ||
surfaceData.normalTS = SAMPLE_NORMAL_MAP(inputUnlit.baseMapUVAndProgresses.xy, inputUnlit.baseMapUVAndProgresses.z); | ||
// TODO Specular Workflow is not implemented. | ||
// OK | ||
surfaceData.metallic = GetMetallic(inputUnlit.baseMapUVAndProgresses.xyz); | ||
// OK | ||
surfaceData.specular = half3( 0, 0, 0); | ||
surfaceData.smoothness = GetSmoothness(inputUnlit.baseMapUVAndProgresses.xyz); | ||
surfaceData.alpha = color.a; | ||
// The values of clearCoatMask,clearCoatSmoothness and occlusion is referenced from ParticlesLitInput.hlsl in UPR Package. | ||
surfaceData.clearCoatMask = 0; | ||
surfaceData.clearCoatSmoothness = 1; | ||
surfaceData.occlusion = 1; | ||
// todo : What to do emission? | ||
surfaceData.emission = 0; | ||
|
||
InputData inputData = (InputData)0; | ||
// OK | ||
inputData.positionWS = input.positionWS.xyz; | ||
#ifdef _NORMALMAP | ||
// OK | ||
inputData.normalWS = TransformTangentToWorld( | ||
surfaceData.normalTS, | ||
half3x3( | ||
input.tangentWS.xyz, | ||
input.binormalWS.xyz, | ||
inputUnlit.normalWS.xyz)); | ||
|
||
#else | ||
inputData.normalWS = inputUnlit.normalWS.xyz; | ||
#endif | ||
inputData.normalWS = NormalizeNormalPerPixel(inputData.normalWS); | ||
// OK | ||
inputData.viewDirectionWS = inputUnlit.viewDirWS; | ||
#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) | ||
// OK | ||
inputData.shadowCoord = input.shadowCoord; | ||
#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) | ||
// todo : Not implemented yet. | ||
inputData.shadowCoord = TransformWorldToShadowCoord(input.positionWS.xyz); | ||
#else | ||
inputData.shadowCoord = float4(0, 0, 0, 0); | ||
#endif | ||
inputData.fogCoord = input.positionWS.w; | ||
// todo : What to do vertexLighting? | ||
|
||
inputData.bakedGI = SampleSHPixel(input.vertexSH, inputData.normalWS); | ||
inputData.normalizedScreenSpaceUV = GetNormalizedScreenSpaceUV(inputUnlit.positionHCS); | ||
// The values of shadowMask and vertexLighting are referenced from ParticlesLitForwardPass.hlsl in UPR Package. | ||
inputData.shadowMask = half4(1, 1, 1, 1); | ||
inputData.vertexLighting = half3(0, 0, 0); | ||
|
||
color = UniversalFragmentPBR(inputData, surfaceData); | ||
return color; | ||
} | ||
|
||
#endif |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
66 changes: 0 additions & 66 deletions
66
Assets/Nova/Runtime/Core/Shaders/ParticlesUberLitForward.hlsl
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
こんな使い方ができるんですね 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
できるんです!