Page 2 of 3

Re: ::TUTORIAL:: Making A Skybox

Posted: Sun May 09, 2010 11:27 am
by DJ99X
Oh. I probably should have included that it was done using spherical co-ordinates, so the vector is normalised (magnitude=1)

Re: ::TUTORIAL:: Making A Skybox

Posted: Sun May 09, 2010 11:34 am
by Shadow
DJ wrote:Yeah, I've had the solution for a while now. I just never bothered updating this thread
Thanks a f*cking lot! I just spent 3 and a half hours trying to figure out why I couldn't get the flare into the sun's position. :lol:

Re: ::TUTORIAL:: Making A Skybox

Posted: Wed Jun 30, 2010 3:18 am
by mace-x
DJ, thanks a lot for this, i´ve never looked at it and damn!, it´s so usefull and you can create some AWESOME! environments.
thanks man, it´s really appreciated :)

Re: ::TUTORIAL:: Making A Skybox

Posted: Fri Jul 16, 2010 5:16 pm
by yzmxer608
I'm having a problem getting my sunflare to work. I can't figure out why it's not showing. Is there something wrong with the lighting file?

Code: Select all

sun_vector [ -1.00 .79 .99 ]
sun_color [ 1.00 0.78 0.50 ]
ambient [ 0.25 0.25 0.50 ]
sky_n @hillbrookraceway/sky-n.png
sky_e @hillbrookraceway/sky-e.png
sky_s @hillbrookraceway/sky-s.png
sky_w @hillbrookraceway/sky-w.png
sky_u @hillbrookraceway/sky-u.png
sky_env @hillbrookraceway/sky-env.png
flare_element [ 0.0 1.0 ] [ 1.0 0.64 0.29 ] 1.0 @hillbrookraceway/skysunsetflare.png
flare_vector [ -1.00 .79 .99 ]
fog [0.67 0.66 0.70] .001
Or would it be a math error?

Re: ::TUTORIAL:: Making A Skybox

Posted: Fri Jul 16, 2010 5:29 pm
by yzmxer608
Sun Heading: 186.75 (Q3)
Sun Altitude: 38.25

Must have something to do with that post Shadow made, but it looks like the sun is on the West image, but the sun heading is in quadrant 3, which Shadows says nothing about in that explanation for West :?.

Re: ::TUTORIAL:: Making A Skybox

Posted: Sat Jul 17, 2010 1:41 am
by DJ99X
[0.68 0.52 0.51]

Re: ::TUTORIAL:: Making A Skybox

Posted: Sat Jul 17, 2010 2:03 am
by yzmxer608
How'd you get that? I have to be doing something wrong somewhere.

Re: ::TUTORIAL:: Making A Skybox

Posted: Sat Jul 17, 2010 2:18 am
by DJ99X
I use modified spherical co-ordinate equations. Convert the heading angle to a proper catesian angle (in your case, it is -96° [number should never exceed 180 or -180]). Then, use these equations:

x=cos(altitudeangle)*cos(headingangle)
y=sin(altitudeangle)
z=-cos(altitudeangle)*sin(headingangle)

So, using altitudeangle=38.25 and headingangle=-96.75, you get a completely different answer to what I gave you... DOH

I used google for a calculator, which uses radians instead of degrees. So make sure you use something which uses degrees.

Should be

[ 0.78 -0.092 0.62 ]

Re: ::TUTORIAL:: Making A Skybox

Posted: Sat Jul 17, 2010 2:19 am
by DJ99X
Doh, messed that up too

[ -0.092 0.62 0.78 ]

Re: ::TUTORIAL:: Making A Skybox

Posted: Sat Jul 17, 2010 2:32 am
by yzmxer608
I'll try that out, thanks man.

DJ, 30m TC NOW.

Re: ::TUTORIAL:: Making A Skybox

Posted: Sat Jul 17, 2010 2:34 am
by DJ99X
What? LOL

Re: ::TUTORIAL:: Making A Skybox

Posted: Sat Jul 17, 2010 3:24 am
by yzmxer608
30 minute track contest on xfire, everyone is uploading now.

Re: ::TUTORIAL:: Making A Skybox

Posted: Sat Jul 17, 2010 4:51 am
by yzmxer608
That didn't work either, I screwed something up somewhere. I'll have to look into it later, thank you for the math though, I appreciate it.

Re: ::TUTORIAL:: Making A Skybox

Posted: Sat Jul 17, 2010 5:34 am
by DJ99X
Did you use JLV's povray thingy to make it a skybox? If so, post the reflection image. Its easy to work out the vector from that. If you feel like having a go, here are the instructions I had given Garasaki:
Say the image is 512x512.

256,256 is straight up (ie centre of the image) ie [ 0 1 0 ]

Anywhere along the edge of the circle is straight down.

Halfway along the radius of the circle is the horizon, eg at 256,384 this will be the horizon in the east direction ie [ 1 0 0 ]

The angle is linear with the pixels. So in a 512 image, 512 pixels is 360 degrees, 256 pixels is 180 degrees, 128 pixels is 90 degrees, 64 pixels is 45 degrees...... etc.......

North is the top, East is the right etc

See if that helps is determining the sun/flare coordinates
Resizing it to 360x360 works good as well, as 1°=1 pixel

Re: ::TUTORIAL:: Making A Skybox

Posted: Sun Jul 18, 2010 8:38 pm
by yzmxer608
Yeah I used the POV-ray script. I'll try doing it that way, no promises on me being able to do it right though ;).