Logo by Sockratease - 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: Follow us on Twitter
 
*
Welcome, Guest. Please login or register. April 19, 2024, 10:05:17 AM


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] 3   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: Orbit Trap in GI frag  (Read 7406 times)
0 Members and 1 Guest are viewing this topic.
eiffie
Guest
« Reply #15 on: June 11, 2013, 06:20:30 PM »

1. Since lightColor is a uniform it can't be changed so add a variable called emColor and change it in your mapL function depending on which light is closer. Then near the end of the scene() routine there is a line like:
else tcol=lightColor/...
change it to
else tcol=emColor/...
but be warned adding lights like this will have some new strange effects (maybe some good ones).

2. Yes those are some of the issues I would like to fix and to add the correct selection of diffuse or spec lighting.
Logged
vinz
Iterator
*
Posts: 154


« Reply #16 on: June 11, 2013, 07:33:38 PM »

Thanks For your Help Eiffie

i'm not sure how to do this:"change it in your mapL function depending on which light is closer"
as you can imagine there is 90% of the script that i don't understand this is the first time that i code something hahaha  embarrass...

EDIT: HAHAHAHAH,i've found something , not shure if it's correct but it works Grin with closed eyes cheesy

Code:
	float p;
p= dot(lightPosition,z);
if (p>0) emColor= lightColor2;
else emColor=lightColor;



« Last Edit: June 11, 2013, 08:38:25 PM by vinz, Reason: Parce que je suis un gros noob hahahaha ! » Logged
eiffie
Guest
« Reply #17 on: June 11, 2013, 08:52:22 PM »

Well whatever works! I meant like this:

float d=length(z-lightPosition)-lightSize;
float d2=min(d,length(z-lightPosition2)-lightSize2);
if(d2==d)emColor=lightColor else emColor=lightColor2;

Now that I look at it I guess it would make more sense to only do this once in getEmissiveDir not in mapL.

And I'm glad your learning some coding - I knew there was a reason for my sketchy coding smiley
Logged
vinz
Iterator
*
Posts: 154


« Reply #18 on: June 11, 2013, 09:04:08 PM »

HA! Great Thanks Eiffie ... i'm going to do That !

Quote
I knew there was a reason for my sketchy coding
Hahah, i always dream to understand how render engine works, but i've no mathematical neither programming background,
with fragmentarium i found a door, to learn both ( also trying to learn wink ) with the speed of the gpu hahahaha ! ... the idea to render my own fractal on a  render engine that i can
custom is simply enormous!!!!! ... and as i love Pathtracing  and Gi Grin with closed eyes your "sketchy" code is a gold mine cheesy

Edit : it works perfectlyThanks Eiffie

Code:
vec4 getEmissiveDir( in vec3 pos)
{//get the direction to a DE based light
vec2 vt=vec2(mapL(pos),0.0);//find emissive light dir by triangulating its nearest point

float d=length(pos-lightPosition)-lightSize;
float d2=min(d,length(pos-lightPosition2)-lightSize2);
if(d2==d) emColor=lightColor; else emColor=lightColor2;

return vec4(-normalize(vec3(-mapL(pos-vt.xyy)+mapL(pos+vt.xyy),
-mapL(pos-vt.yxy)+mapL(pos+vt.yxy),-mapL(pos-vt.yyx)+mapL(pos+vt.yyx))),vt.x);
}
« Last Edit: June 11, 2013, 09:30:37 PM by vinz » Logged
vinz
Iterator
*
Posts: 154


« Reply #19 on: June 12, 2013, 11:22:52 AM »

Hi

i'm trying to add a spherical map as sky texture, i've tried for few hours , now i've lost hope.
here some code i've tryed:

1. this code seems working well in all others frags that use spherical image, as the dir variable is defined in the 3d.frag it seems i can use it.
but the result a brown sky.
Code:
vec2 spherical(vec3 n) {
return vec2 (acos(n.z)/PI, atan(n.y,n.x)/(2.0*PI) );
}
and
Code:
	if(UseBackgroundPicture){
backColor = texture2D(texture,spherical(normalize(dir)).yx).xyz;
}


i've also used
Code:
	if(UseBackgroundPicture){
backColor = texture2D(texture,spherical(normalize(rd)).yx).xyz;
}


 it give a better result but the background is not aligned properly.

i also tryed a lot of other things and conversions functions cartesian to spherical to cartesian etc... nothing to do !
do you have any clue ?

Many Thanks !!!!!!!!!!!!!!!

Edit: i used the equirectangular camera in this screenshot, so i think i should have the equirectangular background if everything is fine.


i should have something like that :
Code:
	if(UseBackgroundPicture){
vec2 position =  (viewCoord+vec2(1.0))/2.0;
position.y = 1.0-position.y;
backColor = texture2D( texture, position).xyz;
}
but this code is independent/not locked to the camera view


« Last Edit: June 12, 2013, 11:34:59 AM by vinz » Logged
vinz
Iterator
*
Posts: 154


« Reply #20 on: June 12, 2013, 11:54:05 PM »

HAHAHAHAHA! i've just found empiricaly that with using the rd variable the background needed a rotation of 90° around x axis,
After a lot of search i've for the first time understood how the rotating matrix work ! Excellent cheesy

so the code is now
Code:
	if(UseBackgroundPicture){
float theta = 1.57079633;
backColor = texture2D( texture, spherical(normalize(vec3(rd.x,rd.y*cos(theta)-rd.z*sin(theta), rd.y*sin(theta)+  rd.z*cos(theta) ))).yx).xyz;
}

here the result hehehe !



Pfiou that was not easy !! A Beer Cup A Beer Cup A Beer Cup A Beer Cup A Beer Cup A Beer Cup to me and myself  cheesy
« Last Edit: June 12, 2013, 11:59:08 PM by vinz » Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #21 on: June 13, 2013, 12:08:58 AM »

 rolling on floor laughing have fun dude cheesy congrats!
Logged

---

divide and conquer - iterate and rule - chaos is No random!
vinz
Iterator
*
Posts: 154


« Reply #22 on: June 13, 2013, 12:13:43 AM »

Hahahaha ! cKleinhuis  embarrass .... don't laugh at me i never imagine that i was able to do that cheesy
Thanks for supporting me in this road plenty of fractal traps  hurt
« Last Edit: June 13, 2013, 12:20:12 AM by vinz » Logged
cKleinhuis
Administrator
Fractal Senior
*******
Posts: 7044


formerly known as 'Trifox'


WWW
« Reply #23 on: June 13, 2013, 12:55:19 AM »

i do not laugh at you, i am enjoying that you are having fun!!!
actually this is exactly the feeling when i see that someone has learned something and is having fun with it!
Logged

---

divide and conquer - iterate and rule - chaos is No random!
vinz
Iterator
*
Posts: 154


« Reply #24 on: June 13, 2013, 01:04:27 AM »

Hehe ! you're are seeing the little padawan with the eyes of the master Yoda wink
i am aware of your wisdom ....  cheesy

edit: hahaha i'm a navigator now Grin with closed eyes
« Last Edit: June 13, 2013, 01:08:52 AM by vinz » Logged
hgjf2
Fractal Phenom
******
Posts: 456


« Reply #25 on: June 13, 2013, 11:47:38 AM »

Nice image effect like in site WWW.PAULBOURKE.NET at chapter "images" and chapter "domes" where is many stereos images and effects.
 A peacock Repeating Zooming Self-Silimilar Thumb Up, by Craig

Logged
eiffie
Guest
« Reply #26 on: June 13, 2013, 06:21:06 PM »

OK vinz I updated the eiffieGI2.zip script in the other thread and now a black object will still have specular reflections.
The only change is in the scene function so you should be able to plop that in your script.
Logged
vinz
Iterator
*
Posts: 154


« Reply #27 on: June 13, 2013, 06:28:26 PM »

YeaHHHHHHHH !!! Thanks you very much Eiffie for taking the time to improve your Script and sharing it ... Excellent shocked, you made my Day  cheesy
and i will have some new clues to understand how the script work...
Logged
vinz
Iterator
*
Posts: 154


« Reply #28 on: June 13, 2013, 06:47:28 PM »

Nice image effect like in site WWW.PAULBOURKE.NET at chapter "images" and chapter "domes" where is many stereos images and effects.

Hey Hgjf2 , i dind't found what you spoke about Sceptical
Logged
vinz
Iterator
*
Posts: 154


« Reply #29 on: June 13, 2013, 09:24:11 PM »

Eiffie,

i've just finished adding your new code , and it works very well.
it was not easy as i thought, because you have modified a lot of function outside the scene one cheesy.

i've found a new strange behaviour, at first i though it was my bad code.
but i obtain the same result on the lastest version of the script.
in fact when i switch off all the light in the scene (emissive,sky,sun etc...) and then i increase the gamma and brigthness
the scene appear to be lighten! .. i'm asking to myself where does this light come from.


Logged
Pages: 1 [2] 3   Go Down
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
Convergent Orbit Trap Images Showcase (Rate My Fractal) Ross Hilbert 0 2842 Last post August 12, 2008, 08:37:13 PM
by Ross Hilbert
Circle Orbit Trap Images Showcase (Rate My Fractal) Ross Hilbert 1 2123 Last post February 13, 2009, 07:10:24 PM
by cKleinhuis
Orbit Trap is closing down (BUT... has re-opened) Fractal Website of the Month ker2x 8 10095 Last post October 28, 2012, 05:31:49 AM
by taurus
orbit trap feature request « 1 2 » ericr 24 4764 Last post March 25, 2013, 01:24:16 PM
by ericr
Blue Orbit Trap Images Showcase (Rate My Fractal) Fracticality 0 1568 Last post April 06, 2017, 01:16:03 AM
by Fracticality

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.162 seconds with 25 queries. (Pretty URLs adds 0.011s, 2q)