Welcome to Fractal Forums

Fractal Software => Fragmentarium => Topic started by: JosLeys on October 07, 2015, 05:32:07 PM




Title: Using data from the previous frame in the next frame.
Post by: JosLeys on October 07, 2015, 05:32:07 PM
I have been looking for examples in Fragmentarium that do this, but have not found any. :fiery:
Here is what I want to do. (it's an animation)

I start with a collection of 3D points in a certain configuration.
I then apply a certain procedure that moves all these points. (the displacement is different for all the points as it depends on the point's location)
I end up with all the points in new positions.

I would like these positions to be the start position in the next frame, so that I have to apply the displacement procedure only once.
(as opposed to having to do n displacements in the n-th frame!)

I suppose I have to write the positions of the points in an array, but have not figured out how to do this so that the array I have at the end of the 1st frame becomes the starting position for the second frame, etc...

Can anybody help?

Jos



Title: Re: Using data from the previous frame in the next frame.
Post by: Patryk Kizny on October 07, 2015, 07:36:40 PM
You could handle that via QScript if it operates on uniforms.
Other than that the variables can't be shared between frames (as far as I know).
There are examples for writing data to frame buffer and reading from a frame buffer (the life game), but it works on a 2D image.
You could work around that buffering additional dimension as 2D tiles in one image. THis could work for even very high images using hires render feature, QScript and sampling a previously rendered bitmap, but I am not sure what is the max resolution you could handle.

As far as I understand you're probably trying to do something like a particle system. Probably an overkill for both Fragmentarium and GLSL.
If you're looking for a good particle environment, I'd recommend on a combination of 3Ds MAX, Krakatoa Renderer and writing custom DLLs for particles creation and manipulation.


Title: Re: Using data from the previous frame in the next frame.
Post by: JosLeys on October 07, 2015, 08:01:19 PM
Yes you could call what I have in mind a particle system.
I have just been tinkering with Fragmentarium/GLSL, and am no specialist by far.
I did look at the 'game of life' frag as it does just that, but as you say, it buffers something in 2D.

I can do what I want to do, to a certain extent, in Povray, by saving my point collection to a file between frames, but was hoping that I could get away with a lot more particles in Fragmentarium.
I do not have 3Ds MAX...


Title: Re: Using data from the previous frame in the next frame.
Post by: cKleinhuis on October 07, 2015, 08:54:58 PM
Please take a close look at synthclipse, it can do all kinds of shaders, and has a full javascripting engine out of the box


Title: Re: Using data from the previous frame in the next frame.
Post by: 3dickulus on October 08, 2015, 05:25:15 AM
How many points ? Lin or Win ?
I have reworked the texture code a bit so that...
Code:
/// in a frag this should create a mipmapped texture
uniform sampler2D myTexture; file[mytexture.png]
#TexParameter myTexture GL_TEXTURE_MAX_LEVEL 1000
#TexParameter myTexture GL_TEXTURE_WRAP_S GL_REPEAT
#TexParameter myTexture GL_TEXTURE_WRAP_T GL_REPEAT
#TexParameter myTexture GL_TEXTURE_MAG_FILTER GL_LINEAR
#TexParameter myTexture GL_TEXTURE_MIN_FILTER GL_LINEAR_MIPMAP_LINEAR
...and am thinking about adding access to more GL texture parameters and options, maybe real GL_TEXTURE_3D volume?

edit: would exr file with depth (RGBZ) be helpful?


Title: Re: Using data from the previous frame in the next frame.
Post by: JosLeys on October 08, 2015, 09:35:57 AM
#3dickulus
I'm in Windows.
I'm thinking a million points or so...
As I said, I'm an amateur in Fragmentarium. No idea how to work with these textures and exr files.


Title: Re: Using data from the previous frame in the next frame.
Post by: Patryk Kizny on October 08, 2015, 03:49:02 PM
Dick, if there's any chance to have a 3D texture in the future, that'd be awesome.
I already see a full 3D fractal to pointcloud renderer challenge :)


Title: Re: Using data from the previous frame in the next frame.
Post by: JosLeys on October 08, 2015, 06:38:56 PM
One thing I don't understand: the sort of thing I want to do appears to be perfectly possible in WebGL.
See : https://www.ibiblio.org/e-notes/webgl/gpu/chaos/lorenz_gpu.html


...but not in Fragmentarium?


Title: Re: Using data from the previous frame in the next frame.
Post by: 3dickulus on October 09, 2015, 04:29:53 AM
@JosLeys the fragment code from that page looks very simple but the rest of it, webgl, is doing a lot of setup and management specifically for that fragment.
Fragmentarium does not do any geometry stuff like instancing or 3D GL points, just DE for pixel colors on a gl surface.
the only thing I can think of would be to have a "persistent" array of points that are initialized at fragment load and altered as your fragment executes, RGBFloat texture can store xyz coords but I think it would require some specialized coding on the C++ side to manage/load/save.

The GL code in this proggie, http://www.digilanti.org/universe/ , would probably be of interest as it does basically what you want but in C++, it's a bit old but worked extremely well, it creates "clouds" of points, assigns a speed, direction and texture to each point then applies gravity formula to alter the positions.

The current state of EXR in Fragmentarium is that the output files contain RGBAF16 or RGBZF16, these files can be loaded and used as textures, but, I have to admit that I haven't had time to test extensively, only to the degree that it seems to be working. I don't think you want to load and save the point cloud between shader/frame passes, and iirc Fragmentarium doesn't (currently) do anything with the alpha channel as it's used internally for hit/color accumulation.

@PK if I add the complete list of options for GL textures to the parser someone is sure to find a use for them ;)


Title: Re: Using data from the previous frame in the next frame.
Post by: JosLeys on October 09, 2015, 09:37:24 AM
@3dickulus: thanks for the explanation!