Using Shader Modifiers to Animate Texture in Scenekit Leads to Jittery Textures Over Time

Using shader modifiers to animate texture in SceneKit leads to jittery textures over time

It's definitely a floating point precision issue. you should probably try to do a modulo on (u_time*30.0) so that it loops within a reasonable range.

Can I use a PNG sequence as an animated material on a SceneKit object?

there is nothing that you can use out of the box.

I would do this using shader modifiers. If you pack all your images in a single image, you can use a modifier (at the SCNShaderModifierEntryPointGeometry entry point) to update the object's texture coordinates according to u_time so that every t ms another image (or sub-image of the atlas) is used.

How can I get the path of a compiled resource?

I've never done this before with executables... However, if it's an embedded resource, you can enumerate through the list of embedded resources in your application (or refer directly to it by name), when you find the one appropriate, write it to disk, and then execute it.

To extract:

Assembly assembly = Assembly.GetExecutingAssembly();
using (Stream stream = assembly.GetManifestResourceStream("resource name")
{
using FileStream fs= new FileStream("executable name")
{
byte[] buffer = new byte[32*1024];
int bytesRead;
while ((bytesRead= stream.Read(buffer, 0, buffer.Length)) > 0)
{
fs.Write(buffer, 0, bytesRead);
}
}
}

To execute:

using System.Diagnostics;

Process someProc;
someProc= Process.Start("executable name");

As Daniel L points out, don't forget to mark the resources as an "embedded resource".



Related Topics



Leave a reply



Submit