Title: My first Fragmentarium movie Post by: JosLeys on June 18, 2013, 11:36:58 AM With some help from Knighty to get me started, here is my first attempt to create something in Fragmentarium :
http://www.youtube.com/v/hFsihHKTUmk?fs=1&hl=en_US&hd=1 Title: Re: My first Fragmentarium movie Post by: cKleinhuis on June 18, 2013, 12:28:38 PM nice one, how did you manage the different camera pathes ?! sticking together independent parts of the rendering ?!
that mountain type rendering i like very much, a little bit more zoom depth would be welcome Title: Re: My first Fragmentarium movie Post by: JosLeys on June 18, 2013, 01:27:34 PM Thanks!
The camera path consists of 12 consecutive sub-paths, obtained by combining the time parameter with some function of the camera position, target, up-vector en field-of view parameter. To render a sub-path, I comment out all the other ones.. One has to be careful to make sure that the movement between sub-paths remains smooth. Zooming more does not work very well as one hits the single precision accuracy : to show the fractal detail some accuracy setting gets too small for single precision. Title: Re: My first Fragmentarium movie Post by: cKleinhuis on June 18, 2013, 01:40:41 PM ah, right the 3d view needs a higher precision, fragmentarium can handle double uniforms/variables as well, but for that you would need another gpu,
beside of that, i sense that the cuttings of the sub pathes are somehow not really smooth, i mean, i just see when a camera path is changing, are you sure you interpolate all values correctly? be sure to use a interpolation method that exactly hits the points the whole animation this is quite messy with fragmentarium, because the logik for the animation is handled in the scripts, which blows them unneccessary up arrh, i think i really have to look into the code to check how hard it would be to assign a controller to a variable, as a starter i would love to just have an assignable sinewave option for each float param ;) Title: Re: My first Fragmentarium movie Post by: 3dickulus on June 24, 2013, 06:46:19 PM A trip to the mountains is always refreshing :beer: skiing anyone?
Title: Re: My first Fragmentarium movie Post by: Syntopia on June 25, 2013, 12:08:19 AM Great animation, Jos. Guess that proves it is possible to do moving camera animation in Fragmentarium - even though it takes some effort!
beside of that, i sense that the cuttings of the sub pathes are somehow not really smooth, i mean, i just see when a camera path is changing, are you sure you interpolate all values correctly? be sure to use a interpolation method that exactly hits the points The camera uniforms look continuous to me. I think the transitions are visible because the derived quantities probably are not. Quote arrh, i think i really have to look into the code to check how hard it would be to assign a controller to a variable, as a starter i would love to just have an assignable sinewave option for each float param ;) It is easy to assign the uniforms in the code, but hard to come up with a general scheme, I guess. Title: Re: My first Fragmentarium movie Post by: cKleinhuis on June 25, 2013, 12:26:02 AM the scheme would be as easy as possible, each axis - one sine wave defined by frequency and amplitude, ideally this should be stackable for each axis, including a general weight for the additions to get it smooth in or out :D
haha, this is just my basic idea how i would like to hack it into, it is by far not the best way to do it, or even something that could lead to a keyframe animation system, but hence it is a realtime application anyways, why not think about the realtime animation possibilities ? to achieve stuff like kali did with his living sea creatures, that just rely on various parameters animated - in realtime .... Title: Re: My first Fragmentarium movie Post by: JosLeys on June 25, 2013, 12:30:11 AM I'm still using the scene in the film to test and learn about other features.
When I try to use a jpg file as a background, I get an ugly black vertical line in the middle. I'm converting to sperical coordinates as follows: Code: vec3 equirectangularMap(sampler2D sampler, vec3 dir) {Any ideas? Title: Re: My first Fragmentarium movie Post by: Syntopia on June 26, 2013, 05:05:17 PM I'm still using the scene in the film to test and learn about other features. When I try to use a jpg file as a background, I get an ugly black vertical line in the middle. I'm converting to sperical coordinates as follows: Code: vec3 equirectangularMap(sampler2D sampler, vec3 dir) {Any ideas? Yes, I also see that on JPG's. There is line when the first argument to atan(y,z) is close to zero, and the second argument is negative. There is a discontinuity in atan2 here: the result jump from -pi to pi depending on the the sign of the first argument. Now that shouldn't matter, since the texture wraps (is periodic). But it does. It might be a half-texel offset interpolation thing, but I haven't found a work around. What is really weird is that I don't see this error on the HDR textures I use for backgrounds. Title: Re: My first Fragmentarium movie Post by: cKleinhuis on June 26, 2013, 05:08:34 PM i think i has to do with a division by zero error, check that when using the atan function... just my 5 cents
Title: Re: My first Fragmentarium movie Post by: JosLeys on June 27, 2013, 09:04:37 AM No I don't think it is division by zero. This only happens when dir.z=0.
I got rid of the tangent by changing to the code below, but the result is the same : still a black line : Code: vec3 equirectangularMap(sampler2D sampler, vec3 dir) {If I leave out the sign of the x-direction, I obviously get an imaged mirrored on the vertical axis, but there is no black line! Fragmentarium seems only to recognize jpeg and hdr images, but png works also (and with png, the black line is there also) Are other formats possible, like tiff ? Title: Re: My first Fragmentarium movie Post by: cKleinhuis on June 27, 2013, 10:13:08 AM you might try a very big image as well, with the goal to make the line as small as possible with the hope to get rid of it completely
Title: Re: My first Fragmentarium movie Post by: JosLeys on June 27, 2013, 10:56:24 AM The solution for using jpg files as a 360° background is to convert them to hdr using Picturenaut (http://www.hdrlabs.com/picturenaut/index.html).
We need to adapt some signs as otherwise the image gets flipped : Code: vec3 equirectangularMap(sampler2D sampler, vec3 dir) {This gets rid of the black line! Title: Re: My first Fragmentarium movie Post by: knighty on June 27, 2013, 09:30:59 PM As syntopia noted, it is due to the discontinuity of atan() function. More specifically, the derivative (which is used for mipmap) is not defined at the discontinuity. It is possible to remove the artifacts by using texture2DLod() instead. Just give a good value to the "lod" parameter by trying a value of 0. first then bigger values. It could be computed as function of the zoom factor.
IIRC, float textures (which are used for hdr) don't support mipmapping. Right? That should be the reason why there is no artifacts when using hdr format. Very nice video BTW! Title: Re: My first Fragmentarium movie Post by: Syntopia on June 27, 2013, 11:48:00 PM As syntopia noted, it is due to the discontinuity of atan() function. More specifically, the derivative (which is used for mipmap) is not defined at the discontinuity. It is possible to remove the artifacts by using texture2DLod() instead. Just give a good value to the "lod" parameter by trying a value of 0. first then bigger values. It could be computed as function of the zoom factor. IIRC, float textures (which are used for hdr) don't support mipmapping. Right? That should be the reason why there is no artifacts when using hdr format. Very nice video BTW! Excellent catch, Knighty! I really couldn't figure out why this didn't work. Now, I think float textures do support mip mapping, but since I handle HDR textures myself (Qt handles png and jpg textures), I actually explictly disables mip maps in the HDR texture setup (because I never got it to work when they were enabled!). Fragmentarium has support for setting texture parameters, so the easiest way to fix this is by adding the following line after the texture definitions: Code: uniform sampler2D texture; file[Ditch-River_2k.hdr] Title: Re: My first Fragmentarium movie Post by: JosLeys on June 28, 2013, 08:57:38 AM Maybe I misunderstand, but adding
#TexParameter texture GL_TEXTURE_MIN_FILTER GL_LINEAR after a Sampler definition for a jpg file does not get rid of the black line. Title: Re: My first Fragmentarium movie Post by: Syntopia on June 28, 2013, 04:11:55 PM Maybe I misunderstand, but adding #TexParameter texture GL_TEXTURE_MIN_FILTER GL_LINEAR after a Sampler definition for a jpg file does not get rid of the black line. Really? It worked for me. Could you try an example like this: Code: #include "3D.frag" Title: Re: My first Fragmentarium movie Post by: JosLeys on June 28, 2013, 04:46:50 PM Changed the jpg file to something else, but I get nothing but a black screen.
Title: Re: My first Fragmentarium movie Post by: Syntopia on June 28, 2013, 04:59:17 PM Try restarting Fragmentarium, and change the jpg to an existing file before running the script.
Title: Re: My first Fragmentarium movie Post by: JosLeys on June 28, 2013, 06:30:17 PM Yes, it worked...no black line.
Note that I had to change it to : vec2 longlat = vec2(atan(dir.x,dir.z),-acos(dir.y)); to get the image in the right position. (probably, when I tried it earlier, I did'nt restart) Thanks Title: Re: My first Fragmentarium movie Post by: JosLeys on June 28, 2013, 07:00:03 PM One more thing about 360° backgrounds :
In : Code: vec3 equirectangularMap(sampler2D sampler, vec3 dir) {'dir' has the orthogonal basis Eye-Target, up, Right, which is not the same as x,y,z. So, to catch the right background point, dir needs to be transformed to the x,y,z orthogonal basis, if not the background gets distorted when changing Eye, Target or Up... I'm looking at that now, but maybe someone has done it before.. Title: Re: My first Fragmentarium movie Post by: Syntopia on June 28, 2013, 07:37:32 PM 'dir' has the orthogonal basis Eye-Target, up, Right, which is not the same as x,y,z. The 'dir' vector is expressed in normal cartesian world coordinates, not in the camera frame. If the 'dir' vector was expressed in the camera frame, the image would not change when changing direction of the camera. Title: Re: My first Fragmentarium movie Post by: JosLeys on June 28, 2013, 11:02:26 PM Quote The 'dir' vector is expressed in normal cartesian world coordinates, not in the camera frame. OOps, sorry, you are right of course.. |