-
Notifications
You must be signed in to change notification settings - Fork 9
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
Feat: Scene Shader #55
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
447679d
Change the shader to "DCL/Scene" for Standalone
mikhail-dcl cd9a20d
Enable keywords for the "DCL/Scene" shader
mikhail-dcl fad06ef
Grpahics changes and converter variant changes
GBirch33 bfe2f41
Merge remote-tracking branch 'origin/main' into feat/scene-shader
mikhail-dcl 50f55eb
Automatically switch Forward/Forward Plus Rendering paths
mikhail-dcl e404493
Upgrade to Unity 2022.3.12f1
mikhail-dcl 135b2a6
Disable forced keywords change
mikhail-dcl ca58063
Assign Shader Variants to the same asset bundle
mikhail-dcl 27ff587
Upgrade shared-dependencies
mikhail-dcl e0e3ff1
Fast-forward the submodule
mikhail-dcl 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
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
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
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
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
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
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
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
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
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
35 changes: 33 additions & 2 deletions
35
...BundleConverter/Wrappers/Implementations/Default/AssetBundleConverterMaterialGenerator.cs
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 |
---|---|---|
@@ -1,9 +1,40 @@ | ||
using DCL.GLTFast.Wrappers; | ||
using DCL.Shaders; | ||
using GLTFast; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace AssetBundleConverter.Wrappers.Implementations.Default | ||
{ | ||
public class AssetBundleConverterMaterialGenerator : DecentralandMaterialGenerator | ||
{ | ||
public AssetBundleConverterMaterialGenerator() : base("DCL/Universal Render Pipeline/Lit") { } | ||
private readonly bool useSceneShader; | ||
|
||
public AssetBundleConverterMaterialGenerator(bool useSceneShader) : base(GetShaderName(useSceneShader)) | ||
{ | ||
this.useSceneShader = useSceneShader; | ||
} | ||
|
||
public static bool UseNewShader(BuildTarget buildTarget) => | ||
buildTarget != BuildTarget.WebGL; | ||
|
||
private static string GetShaderName(bool useSceneShader) => | ||
useSceneShader ? "DCL/Scene" : "DCL/Universal Render Pipeline/Lit"; | ||
|
||
public override Material GenerateMaterial(int materialIndex, GLTFast.Schema.Material gltfMaterial, IGltfReadable gltf, bool pointsSupport = false) | ||
{ | ||
var mat = base.GenerateMaterial(materialIndex, gltfMaterial, gltf, pointsSupport); | ||
|
||
if (useSceneShader) | ||
{ | ||
// Enable Forward+ and soft shadows | ||
mat.EnableKeyword(ShaderUtils.FW_PLUS); | ||
mat.EnableKeyword(ShaderUtils.FW_PLUS_LIGHT_SHADOWS); | ||
mat.EnableKeyword(ShaderUtils.FW_PLUS_SHADOWS_CASCADE); | ||
mat.EnableKeyword(ShaderUtils.FW_PLUS_SHADOWS_SOFT); | ||
} | ||
|
||
return mat; | ||
} | ||
} | ||
} | ||
} |
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
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
Oops, something went wrong.
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.
This was QOL debug code, to avoid creating multiple materials when re-running the conversion on the same scene over and over without re-downloading everything from scratch
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.
I will revert it 👌
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.
I think I recall why I removed it: it's not needed as we override it later