public void SetOutputSizeEnumTest() { Substance.Game.Substance subs = SubstanceExtensionsTestData.Instance.TestSubstance; SubstanceGraph graph = subs.graphs[0]; int cachedSize = graph.GetInputVector2Int(SubstanceGraphExtensions.OutputSizeParameter)[0]; SubstanceOutputSize newSize = cachedSize == 9 ? SubstanceOutputSize._1024 : SubstanceOutputSize._512; Debug.Log(graph.GetGeneratedTextures()[0].width); graph.SetOutputSize(newSize); //NativeFunctions.cppProcessOutputQueue(); graph.QueueForRender(); Substance.Game.Substance.RenderSubstancesSync(); int width = graph.GetGeneratedTextures()[0].width; Debug.Log(graph.GetGeneratedTextures()[0].width); Assert.AreEqual(width, (newSize == SubstanceOutputSize._1024 ? 1024 : 512)); graph.SetOutputSize(cachedSize); //NativeFunctions.cppProcessOutputQueue(); graph.QueueForRender(); Substance.Game.Substance.RenderSubstancesSync(); }
private void Update() { if (Input.GetKeyDown(randomizeKey)) { graph.RandomizeSeed(); graph.QueueForRender(); } if (Input.GetKeyDown(outputSizeKey)) { graph.SetOutputSize(SubstanceOutputSize._1024); graph.QueueForRender(); } }
private void Update() { if (Input.GetKeyDown(randomizeKey)) { graph.RandomizeSeed(); graph.QueueForRender(); } if (Input.GetKeyDown(outputSizeKey)) { graph.SetOutputSize(size); graph.QueueForRender(); } if (Input.GetKeyDown(renderKey)) { Substance.Game.Substance.RenderSubstancesAsync(); } }
public void AddScratches() { var scratches = graph.GetInputInt("Metal_Scratches_Amount"); scratches += (int)(scratchSpeed * Time.fixedDeltaTime); graph.SetInputInt("Metal_Scratches_Amount", scratches); graph.QueueForRender(); Substance.Game.Substance.RenderSubstancesAsync(); }
public void SetOutputSizeTest() { Substance.Game.Substance subs = SubstanceExtensionsTestData.Instance.TestSubstance; SubstanceGraph graph = subs.graphs[0]; int cachedSize = graph.GetInputVector2Int(SubstanceGraphExtensions.OutputSizeParameter)[0]; int newSize = cachedSize == 9 ? 10 : 9; graph.SetOutputSize(newSize); graph.QueueForRender(); Substance.Game.Substance.RenderSubstancesSync(); int width = graph.GetGeneratedTextures()[0].width; Debug.Log(string.Format("{0} | {1} | {2} - {3}", width, (newSize == 10 ? 1024 : 512), cachedSize, newSize)); Assert.AreEqual(width, (newSize == 10 ? 1024 : 512)); graph.SetOutputSize(cachedSize); graph.QueueForRender(); Substance.Game.Substance.RenderSubstancesSync(); }
void Update() { if (substance == null) { GetMat(); Debug.LogWarning("No Graph"); return; } time += Time.smoothDeltaTime; if (lava) { substance.SetInputFloat("flow_speed", flow); } substance.SetInputFloat("$time", time); substance.QueueForRender(); }
public void generateNewCubemap() { //set the procedural material's properties if needed, before rendering inputMaterial.SetInputFloat("$randomseed", Random.Range(0.0f, 10000.0f)); //have the procedural material render a new texture inputMaterial.QueueForRender(); Substance.Game.Substance.RenderSubstancesAsync(); /* render the cubemap * This takes the input material and renders it to a cubemap of the specified size. * * Remember, this is not increasing the resolution at which the procedural material is rendering the texture, * that must be set in the procedural material itself. You will likely want the cubemap to be the same size * or larger than the procedural material's size to retain all the quality. */ cubemap = CubemapGeneratorHelper.instance.generateCubemap(inputMaterial, CubemapGenerator.Sizes._512); //set the skybox material to use the cubemap which was just rendered skyboxMaterial.SetTexture("_Tex", cubemap); }
private void Update() { if (!_right) { _value += Time.deltaTime / Velocity; if (_value > 1) { _right = true; } } else { _value -= Time.deltaTime / Velocity; if (_value < 0) { _right = false; } } WaterSubstance.SetInputFloat("disorder", _value); WaterSubstance.QueueForRender(); }
private void OnRefreshClicked() { graph.QueueForRender(); Substance.Game.Substance.RenderSubstancesSync(); }