Hi,
I’m trying to recreate the particle material tutorial. It works with the Color shader example:
shader ColorShader : ComputeColor
{
override float4 Compute()
{
return float4(0, 1, 0, 1);
}
};
However, I want to modify the RadialParticleTexture:
shader TextureShader<float4 ColorCenter, float4 ColorEdge> : ComputeColor, Texturing
{
override float4 Compute()
{
float radialDistance = length(streams.TexCoord - float2(0.5, 0.5)) * 2;
float4 unclamped = lerp(ColorCenter, ColorEdge, radialDistance);
// We want to allow the intensity to grow a lot, but cap the alpha to 1
float4 clamped = clamp(unclamped, float4(0, 0, 0, 0), float4(1000, 1000, 1000, 1));
// Remember that we use a premultiplied alpha pipeline so all color values should be premultiplied
clamped.rgb *= clamped.a;
return clamped;
}
};
I get the following error in Game Studio:
System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
at SiliconStudio.Xenko.Shaders.Parser.ShaderMixinParser.Parse(ShaderMixinSource shaderMixinSource, ShaderMacro[] macros) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders.Parser\ShaderMixinParser.cs:line 205
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompiler.Compile(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders.Compiler\EffectCompiler.cs:line 142
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompilerCache.CompileBytecode(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters, ObjectId mixinObjectId, DatabaseFileProvider database, String compiledUrl) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\EffectCompilerCache.cs:line 169
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompilerCache.<>c__DisplayClass21_1.<Compile>b__0() in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\EffectCompilerCache.cs:line 149
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at SiliconStudio.Xenko.Rendering.EffectSystem.<>c__DisplayClass21_0.<LoadEffect>b__0(Task`1 x) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Rendering\EffectSystem.cs:line 188
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at SiliconStudio.Xenko.Rendering.RootEffectRenderFeature.PrepareEffectPermutations(RenderDrawContext context) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Rendering\RootEffectRenderFeature.cs:line 556
at SiliconStudio.Xenko.Rendering.RenderSystem.Prepare(RenderDrawContext context) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Rendering\RenderSystem.cs:line 231
at SiliconStudio.Xenko.Rendering.Compositing.GraphicsCompositor.DrawCore(RenderDrawContext context) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Rendering\Compositing\GraphicsCompositor.cs:line 111
at SiliconStudio.Xenko.Rendering.RendererBase.Draw(RenderDrawContext context) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Rendering\RendererBase.cs:line 50
at SiliconStudio.Xenko.Engine.SceneSystem.Draw(GameTime gameTime) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Engine\SceneSystem.cs:line 209
at SiliconStudio.Xenko.Games.GameSystemCollection.Draw(GameTime gameTime) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Games\GameSystemCollection.cs:line 128
at SiliconStudio.Xenko.Games.GameBase.Draw(GameTime gameTime) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Games\GameBase.cs:line 785
at SiliconStudio.Xenko.Editor.EditorGame.Game.EditorServiceGame.Draw(GameTime gameTime) in C:\TeamCity\work\80a49494ba341a6a\sources\editor\SiliconStudio.Xenko.Editor\EditorGame\Game\EditorServiceGame.cs:line 135
---> (Inner Exception #0) System.AggregateException: One or more errors occurred. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
at SiliconStudio.Xenko.Shaders.Parser.ShaderMixinParser.Parse(ShaderMixinSource shaderMixinSource, ShaderMacro[] macros) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders.Parser\ShaderMixinParser.cs:line 205
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompiler.Compile(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders.Compiler\EffectCompiler.cs:line 142
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompilerCache.CompileBytecode(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters, ObjectId mixinObjectId, DatabaseFileProvider database, String compiledUrl) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\EffectCompilerCache.cs:line 169
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompilerCache.<>c__DisplayClass21_1.<Compile>b__0() in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\EffectCompilerCache.cs:line 149
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at SiliconStudio.Xenko.Rendering.EffectSystem.<>c__DisplayClass21_0.<LoadEffect>b__0(Task`1 x) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Rendering\EffectSystem.cs:line 188
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
---> (Inner Exception #0) System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
at SiliconStudio.Xenko.Shaders.Parser.ShaderMixinParser.Parse(ShaderMixinSource shaderMixinSource, ShaderMacro[] macros) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders.Parser\ShaderMixinParser.cs:line 205
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompiler.Compile(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders.Compiler\EffectCompiler.cs:line 142
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompilerCache.CompileBytecode(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters, ObjectId mixinObjectId, DatabaseFileProvider database, String compiledUrl) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\EffectCompilerCache.cs:line 169
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompilerCache.<>c__DisplayClass21_1.<Compile>b__0() in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\EffectCompilerCache.cs:line 149
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()<---
<---
_Otherwise I have tried to follow the documentation and sample: _
- In VS 2017:
- Add a code file TextureShader.xksl
- Copy the code from the sample, changing the name to TextureShader
- Compile.
When I set the shader to the particle material Right channel, I get:
System.AggregateException: One or more errors occurred. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
at SiliconStudio.Xenko.Shaders.Parser.ShaderMixinParser.Parse(ShaderMixinSource shaderMixinSource, ShaderMacro[] macros) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders.Parser\ShaderMixinParser.cs:line 205
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompiler.Compile(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders.Compiler\EffectCompiler.cs:line 142
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompilerCache.CompileBytecode(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters, ObjectId mixinObjectId, DatabaseFileProvider database, String compiledUrl) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\EffectCompilerCache.cs:line 169
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompilerCache.<>c__DisplayClass21_1.<Compile>b__0() in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\EffectCompilerCache.cs:line 149
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at SiliconStudio.Xenko.Shaders.Compiler.TaskOrResult`1.GetCurrentResult() in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\TaskOrResult.cs:line 55
at SiliconStudio.Xenko.Rendering.EffectSystem.<>c__DisplayClass25_0.<UpdateEffects>b__0(CompilerResults results) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Rendering\EffectSystem.cs:line 348
at System.Collections.Generic.List`1.RemoveAll(Predicate`1 match)
at SiliconStudio.Xenko.Rendering.EffectSystem.UpdateEffects() in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Engine\Rendering\EffectSystem.cs:line 346
at SiliconStudio.Xenko.Games.GameSystemCollection.Update(GameTime gameTime) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Games\GameSystemCollection.cs:line 94
at SiliconStudio.Xenko.Editor.EditorGame.Game.EditorServiceGame.Update(GameTime gameTime) in C:\TeamCity\work\80a49494ba341a6a\sources\editor\SiliconStudio.Xenko.Editor\EditorGame\Game\EditorServiceGame.cs:line 112
---> (Inner Exception #0) System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
at SiliconStudio.Xenko.Shaders.Parser.ShaderMixinParser.Parse(ShaderMixinSource shaderMixinSource, ShaderMacro[] macros) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders.Parser\ShaderMixinParser.cs:line 205
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompiler.Compile(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders.Compiler\EffectCompiler.cs:line 142
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompilerCache.CompileBytecode(ShaderMixinSource mixinTree, EffectCompilerParameters effectParameters, CompilerParameters compilerParameters, ObjectId mixinObjectId, DatabaseFileProvider database, String compiledUrl) in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\EffectCompilerCache.cs:line 169
at SiliconStudio.Xenko.Shaders.Compiler.EffectCompilerCache.<>c__DisplayClass21_1.<Compile>b__0() in C:\TeamCity\work\80a49494ba341a6a\sources\engine\SiliconStudio.Xenko.Shaders\Compiler\EffectCompilerCache.cs:line 149
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()<---
I can run the sample project fine so I must be doing something wrong, I just can’t figure out what it would be?
I have duplicated the particle source Material settings 100 times, and they are copied exactly from the sample. Is there anything outside the particle material settings I need to consider to get this working?
Any suggestions appreciated, thanks!
/F