::TUTORIAL:: Making A Skybox

DJ99X
Posts: 15523
Joined: Tue Jan 15, 2008 11:36 am
Location: Land Down Under

Re: ::TUTORIAL:: Making A Skybox

Post by DJ99X »

Oh. I probably should have included that it was done using spherical co-ordinates, so the vector is normalised (magnitude=1)
Shadow
Posts: 2772
Joined: Sun Dec 02, 2007 5:10 pm
Team: FSK
Location: Finland

Re: ::TUTORIAL:: Making A Skybox

Post 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:
Image
Those who possess strength have also known adversity.
mace-x
Posts: 2303
Joined: Wed Jan 02, 2008 5:53 am
Team: your sister´s fan!
Location: candy planet.

Re: ::TUTORIAL:: Making A Skybox

Post 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 :)
Image
Massacre ftw!

the human stupidity and the universe are unlimited, and im not totally sure about the universe...
yzmxer608
Posts: 15352
Joined: Mon Dec 29, 2008 4:30 am
Team: SYS
Location: Wisconsin, U.S.A

Re: ::TUTORIAL:: Making A Skybox

Post 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?
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.
yzmxer608
Posts: 15352
Joined: Mon Dec 29, 2008 4:30 am
Team: SYS
Location: Wisconsin, U.S.A

Re: ::TUTORIAL:: Making A Skybox

Post 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 :?.
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.
DJ99X
Posts: 15523
Joined: Tue Jan 15, 2008 11:36 am
Location: Land Down Under

Re: ::TUTORIAL:: Making A Skybox

Post by DJ99X »

[0.68 0.52 0.51]
yzmxer608
Posts: 15352
Joined: Mon Dec 29, 2008 4:30 am
Team: SYS
Location: Wisconsin, U.S.A

Re: ::TUTORIAL:: Making A Skybox

Post by yzmxer608 »

How'd you get that? I have to be doing something wrong somewhere.
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.
DJ99X
Posts: 15523
Joined: Tue Jan 15, 2008 11:36 am
Location: Land Down Under

Re: ::TUTORIAL:: Making A Skybox

Post 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 ]
DJ99X
Posts: 15523
Joined: Tue Jan 15, 2008 11:36 am
Location: Land Down Under

Re: ::TUTORIAL:: Making A Skybox

Post by DJ99X »

Doh, messed that up too

[ -0.092 0.62 0.78 ]
yzmxer608
Posts: 15352
Joined: Mon Dec 29, 2008 4:30 am
Team: SYS
Location: Wisconsin, U.S.A

Re: ::TUTORIAL:: Making A Skybox

Post by yzmxer608 »

I'll try that out, thanks man.

DJ, 30m TC NOW.
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.
DJ99X
Posts: 15523
Joined: Tue Jan 15, 2008 11:36 am
Location: Land Down Under

Re: ::TUTORIAL:: Making A Skybox

Post by DJ99X »

What? LOL
yzmxer608
Posts: 15352
Joined: Mon Dec 29, 2008 4:30 am
Team: SYS
Location: Wisconsin, U.S.A

Re: ::TUTORIAL:: Making A Skybox

Post by yzmxer608 »

30 minute track contest on xfire, everyone is uploading now.
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.
yzmxer608
Posts: 15352
Joined: Mon Dec 29, 2008 4:30 am
Team: SYS
Location: Wisconsin, U.S.A

Re: ::TUTORIAL:: Making A Skybox

Post 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.
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.
DJ99X
Posts: 15523
Joined: Tue Jan 15, 2008 11:36 am
Location: Land Down Under

Re: ::TUTORIAL:: Making A Skybox

Post 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
yzmxer608
Posts: 15352
Joined: Mon Dec 29, 2008 4:30 am
Team: SYS
Location: Wisconsin, U.S.A

Re: ::TUTORIAL:: Making A Skybox

Post 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 ;).
TeamHavocRacing wrote:If I had a nickel for every time someone asked for this, I would have a whole shitload of nickels.
Post Reply