Logo by MarkJayBee - Contribute your own Logo!

END OF AN ERA, FRACTALFORUMS.COM IS CONTINUED ON FRACTALFORUMS.ORG

it was a great time but no longer maintainable by c.Kleinhuis contact him for any data retrieval,
thanks and see you perhaps in 10 years again

this forum will stay online for reference
News: Support us via Flattr FLATTR Link
 
*
Welcome, Guest. Please login or register. March 28, 2024, 11:30:36 PM


Login with username, password and session length


The All New FractalForums is now in Public Beta Testing! Visit FractalForums.org and check it out!


Pages: 1 [2]   Go Down
  Print  
Share this topic on DiggShare this topic on FacebookShare this topic on GoogleShare this topic on RedditShare this topic on StumbleUponShare this topic on Twitter
Author Topic: My first Fragmentarium movie  (Read 2015 times)
0 Members and 1 Guest are viewing this topic.
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #15 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.
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #16 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"
uniform sampler2D texture; file[equirectangular_projection.jpg]

#TexParameter texture GL_TEXTURE_MIN_FILTER GL_LINEAR

#define PI  3.14159265358979323846264
vec3 equirectangularMap(vec3 dir, sampler2D sampler) {
dir = normalize(dir);
vec2 longlat = vec2(atan(dir.y,dir.x),acos(dir.z));
  return texture2D(sampler,longlat/vec2(2.0*PI,PI) ).xyz;
}

vec3 color(vec3 pos, vec3 dir) {
return equirectangularMap(dir,texture);
}
Logged
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #17 on: June 28, 2013, 04:46:50 PM »

Changed the jpg file to something else, but I get nothing but a black screen.
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #18 on: June 28, 2013, 04:59:17 PM »

Try restarting Fragmentarium, and change the jpg to an existing file before running the script.
Logged
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #19 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
Logged
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #20 on: June 28, 2013, 07:00:03 PM »

One more thing about 360° backgrounds :

In :
Code:
vec3 equirectangularMap(sampler2D sampler, vec3 dir) {
// Convert (normalized) dir to spherical coordinates.
dir = normalize(dir);
vec2 longlat = vec2(-atan(dir.x,dir.z),acos(dir.y));
// Normalize, and lookup in equirectangular map.
  return texture2D(sampler,longlat/vec2(2.0*pi,pi)).xyz;
}

'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..
Logged
Syntopia
Fractal Molossus
**
Posts: 681



syntopiadk
WWW
« Reply #21 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.
« Last Edit: June 28, 2013, 07:52:20 PM by Syntopia, Reason: Clarification » Logged
JosLeys
Strange Attractor
***
Posts: 258


WWW
« Reply #22 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..
Logged
Pages: 1 [2]   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
having fun with fragmentarium Images Showcase (Rate My Fractal) ker2x 5 2246 Last post January 14, 2012, 12:26:39 PM
by ker2x
Fragmentarium 0.9.1 Released Fragmentarium « 1 2 » Syntopia 19 4573 Last post June 10, 2012, 10:27:46 AM
by Syntopia
Help in Fragmentarium Fragmentarium Tim Emit 2 832 Last post January 15, 2013, 10:05:24 PM
by Tim Emit
.obj output from Fragmentarium Help & Support 5yF0Rc3 7 1127 Last post April 24, 2013, 10:41:35 PM
by Sockratease
Fragmentarium programming Fragmentarium JosLeys 5 1997 Last post May 26, 2013, 09:30:49 PM
by knighty

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS! Dilber MC Theme by HarzeM
Page created in 0.16 seconds with 25 queries. (Pretty URLs adds 0.006s, 2q)