Skip to content

Commit 787eff3

Browse files
julienf-unityPaulDemeulenaereiTris666gabrieldelacruzThomas Iché
authored andcommitted
[10.x.x][VFX] Remove some shader warnings (#3248)
* Fix Event connected directly to Output Event (revival) #154 * Restore disabled 26_NonUnifomScale due to a wrong merge (need backport to 10.x.x) * [HDRP] Fix debug view material (albedo/normal/...) * Force ui update when shader might be reimported in StaticMeshOutput (#158) * Don't create VFXGraph during import callbacks (#148) * do not Create VFXGraph in import callbacks * error when graph missing. Better test code for asset creation * Select node on create (#166) * Select node on create * Fix for right click in block and add doesn't deselect clicked block * fix for subgraph not being selected on drag and drop * Select converted node/block after convert subgraph * Fix for selection undo separate in some cases. Fixed flow anchor drag context selection. * Fix for undo of add subgraph operator * Dont flag dirty in vfxgraph is the model modified is a copy (#165) * Added excludeFromTAA setting to VFX outputs * Fix Custom Spawn serialization (#132) * Fix case 1294180 : Error feedback throwing an error while changing capacity (#174) * Fix Preset (with exclusion) (#177) * Trick ExcludeFromPreset Since this attribute is declared with "Inherited = false", we can't use it directly on VFXObject. Extend the VFXInfo is valid to filter out preset. * Fix missing ExcludeFromPreset for subgraph * *Update changelog * Fix 1276602 incorrect uchar pcache import (#129) * Base Commit * Updated Documentation with explicit limitations. * Fixed incorrect Merge * Add regression Test * Removed Test as It can't handle Exceptions thrown in Custom Importers * Fixed value divider Co-authored-by: Thomas ICHÉ <[email protected]> * Update gradient test (#151) * Update gradient test * Update CHANGELOG.md Co-authored-by: Julien Fryer <[email protected]> * Fix incorrect compilation condition for linux build (#184) * Fix GPUEvent & SubGraph (#178) * Fix SelectionHasCompleteSystems Detect correctly if there are dependencies due to GPUEvent (or stripAttribute) * Add allDependenciesIncludingNotCompilable in VFXData This helper is usefull for UI + use it in SelectionHasCompleteSystems * Add note without change the beahvior * Remove debug ToArray() * Sample Point Cache operator (#92) * Fix Case 1223747 - NaN caused by normal bending (#181) * [Subgraph] Prevent Pasting Context invalid subgraph (#191) * Fix Mouse Event Binder in player (#175) * Fix missing call to CreateVFXEventAttribute OnValidate is only called in editor, in runtime, we should init cache data with OnEnable * *Update changelog.md * Vfx/docs/bugfixes (#188) * Resolved 1272101 * Resolved 1264943 * Removed uncertainty around 'should' * Resolved 1298031 * Added snippets file * Resolved 1292127 * Fixed typos * Resolved 1295296 Co-authored-by: Lewis Jordan <[email protected]> * Update HDRP project assets * Change VisualEffect inspector "Edit" button to "New" when no asset is set * Spawn State documentation (#195) * Added Spawn State doc * Fixed formatting Co-authored-by: Lewis Jordan <[email protected]> * Added what's new page and moved blocks out one level in the table of … * backout update gradien test * Update ref images + deactivate test 26 * update URP assets * DEactivate test 32 + clean ribbon template vfx * Fix 1290493 - Spaceship specific warnings (#176) * Fix regression from #176 Co-authored-by: Paul Demeulenaere <[email protected]> Co-authored-by: Tristan Genevet <[email protected]> Co-authored-by: Gabriel de la Cruz <[email protected]> Co-authored-by: Thomas Iché <[email protected]> Co-authored-by: Thomas ICHÉ <[email protected]> Co-authored-by: Ludovic Theobald <[email protected]> Co-authored-by: Lewis Jordan <[email protected]> Co-authored-by: Lewis Jordan <[email protected]> Co-authored-by: sebastienlagarde <[email protected]>
1 parent c95b108 commit 787eff3

File tree

4 files changed

+32
-6
lines changed

4 files changed

+32
-6
lines changed

com.unity.render-pipelines.high-definition/Editor/VFXGraph/Shaders/VFXLitVaryings.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ o.VFX_VARYING_METALLIC = metallic;
6767
#elif HDRP_MATERIAL_TYPE_SPECULAR
6868
#ifdef VFX_VARYING_SPECULAR
6969
${VFXLoadParameter:{specularColor}}
70-
o.VFX_VARYING_SPECULAR = specularColor;
70+
o.VFX_VARYING_SPECULAR = specularColor.rgb;
7171
#endif
7272
#elif HDRP_MATERIAL_TYPE_TRANSLUCENT
7373
#ifdef VFX_VARYING_THICKNESS
@@ -92,7 +92,7 @@ o.VFX_VARYING_EMISSIVESCALE = emissiveScale;
9292
o.VFX_VARYING_EMISSIVE = attributes.color;
9393
#elif HDRP_USE_ADDITIONAL_EMISSIVE_COLOR
9494
${VFXLoadParameter:{emissiveColor}}
95-
o.VFX_VARYING_EMISSIVE = emissiveColor;
95+
o.VFX_VARYING_EMISSIVE = emissiveColor.rgb;
9696
#endif
9797
#endif
9898
#if HDRP_USE_ADDITIONAL_BASE_COLOR

com.unity.visualeffectgraph/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2222
- Fix [Case 1223747](https://fogbugz.unity3d.com/f/cases/1223747/)
2323
- Prevent pasting context within operator/block subgraph [Case 1235269](https://issuetracker.unity3d.com/product/unity/issues/guid/1235269/)
2424
- VFXEventBinderBase throwing a null reference exception in runtime
25+
- Fix [Case 1290493](https://fogbugz.unity3d.com/f/cases/1290493/#BugEvent.1072735759)
2526

2627
## [10.2.0] - 2020-10-19
2728
### Added

com.unity.visualeffectgraph/Editor/Models/Operators/Implementations/Normalize.cs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,44 @@
11
using System;
2+
using System.Collections.Generic;
23
using UnityEngine;
34

45
namespace UnityEditor.VFX.Operator
56
{
6-
[VFXInfo(category = "Math/Vector")]
7+
class SafeNormalizationVariantProvider : VariantProvider
8+
{
9+
protected override sealed Dictionary<string, object[]> variants
10+
{
11+
get
12+
{
13+
return new Dictionary<string, object[]>
14+
{
15+
{ "safeNormalize", new object[]{true, false} }
16+
};
17+
}
18+
}
19+
}
20+
21+
22+
[VFXInfo(category = "Math/Vector", variantProvider = typeof(SafeNormalizationVariantProvider))]
723
class Normalize : VFXOperatorNumericUniform
824
{
925
public class InputProperties
1026
{
1127
public Vector3 x = Vector3.one;
1228
}
1329

14-
protected override sealed string operatorName { get { return "Normalize"; } }
30+
[VFXSetting(VFXSettingAttribute.VisibleFlags.InInspector), SerializeField, Tooltip("Specifies if the operator should check if the vector to be normalized is a vero vector.")]
31+
bool safeNormalize = false;
32+
33+
34+
protected override sealed string operatorName { get {return safeNormalize ? "Safe Normalize" : "Normalize"; } }
1535

1636
protected override sealed VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
1737
{
18-
return new[] { VFXOperatorUtility.Normalize(inputExpression[0]) };
38+
if(safeNormalize)
39+
return new[] { VFXOperatorUtility.SafeNormalize(inputExpression[0]) };
40+
else
41+
return new[] { VFXOperatorUtility.Normalize(inputExpression[0]) };
1942
}
2043

2144
protected override sealed ValidTypeRule typeFilter

com.unity.visualeffectgraph/Editor/Models/Operators/VFXOperatorUtility.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ public static Dictionary<VFXValueType, VFXExpression> GenerateExpressionConstant
3333
public static readonly Dictionary<VFXValueType, VFXExpression> TauExpression = GenerateExpressionConstant(2.0f * Mathf.PI);
3434
public static readonly Dictionary<VFXValueType, VFXExpression> E_NapierConstantExpression = GenerateExpressionConstant(Mathf.Exp(1));
3535
public static readonly Dictionary<VFXValueType, VFXExpression> EpsilonExpression = GenerateExpressionConstant(1e-5f);
36+
public static readonly Dictionary<VFXValueType, VFXExpression> EpsilonSqrExpression = GenerateExpressionConstant(1e-10f);
37+
3638

3739
public enum Base
3840
{
@@ -269,7 +271,7 @@ static public VFXExpression Normalize(VFXExpression v)
269271
static public VFXExpression SafeNormalize(VFXExpression v)
270272
{
271273
var sqrDist = Dot(v,v);
272-
var condition = new VFXExpressionCondition(VFXValueType.Float, VFXCondition.Equal, VFXOperatorUtility.ZeroExpression[VFXValueType.Float], sqrDist);
274+
var condition = new VFXExpressionCondition(VFXValueType.Float, VFXCondition.Less, sqrDist, VFXOperatorUtility.EpsilonSqrExpression[VFXValueType.Float]);
273275
return new VFXExpressionBranch(condition, VFXOperatorUtility.ZeroExpression[v.valueType], Normalize(v));
274276
}
275277

0 commit comments

Comments
 (0)