Page 1 of 1
Lua Skybox
Posted: 11 May 2010, 21:06
by Beherith
Hi dear Lua Coders!
I highly dislike asking for favors, but could someone, who is better at lua and openGL than me, please make a widget that draws a skycube around the map? I would like to rotate it via lua to make it look like map is in orbit.
I would be very grateful, and help your project in return with whatever you need and I can provide.
Thanks!
Re: Lua Skybox
Posted: 12 May 2010, 01:20
by zwzsg
Can I have the texture? Or at least, know how you'd unwrap the cube?
Re: Lua Skybox
Posted: 12 May 2010, 01:26
by jK
The problem is that the current interface can't handle Cubemaps - except the engine ones and those only via shaders.
Re: Lua Skybox
Posted: 12 May 2010, 01:33
by Beherith
Well, I was thinking all I need is 6 drawn quads, I can set the textures for them manually. Dont know if 6 textures are better than 1 in this case.
Unwrap could be standard cross? But this wastes half the tex space, so maybe a compressed run of 2x3 squares? But thats not pow2 size...
Thanks zw:
Skybox:
http://beherith.eat-peet.net/stuff/Eta_ ... eherith.7z
jK, How much of a performance hit would it really be if i had lua just draw 6 quads way outside before drawworld?
Re: Lua Skybox
Posted: 12 May 2010, 01:35
by PicassoCT
Behe you are the meanest battering ram evar approaching the gates of featurecastle. We are going to have tumbling meteroids - Hurray
Re: Lua Skybox
Posted: 12 May 2010, 01:39
by jK
Beherith wrote:jK, How much of a performance hit would it really be if i had lua just draw 6 quads way outside before drawworld?
The advantages of Cubemaps are:
* you need to bind just 1 texture instead of 6
* you just need to render 1 fullscreen-quad instead of a cube
PS: a 24MB uncompressed dds is everything else than fast to render

Re: Lua Skybox
Posted: 12 May 2010, 09:59
by Beherith
I am familiar with the advantages of a cubemap, jK.
Though you yourself just pointed out that the bindings for such are unavailable at the moment. So the question was, is it gonna be that big of a performance hit on modern gpus to manually render the cube for a cubemap?
Re: Lua Skybox
Posted: 12 May 2010, 13:00
by zwzsg
Beherith wrote:please make a widget
I tested it as a \LuaRules\Gadgets\ but I assume it would work as well in LuaGaia. Read it for details about the texture.
In :nc: the :n: means nearest and the :c: clamped. You will probably want :l: (linear interpolation) instead of :n:
Since polygons are one-sided, I would have expected half my faces to be inverted, but somehow it's not the case. If it happened to be the case, then iterate through the vertice of each face the other way by exchanging some pair of lines positions in the script.
I am not sure about my TexCoord, feel free to edit their values if you find oddities in the UV-mapping.
Oh by the way, for the bottom face I recommend replacing the 1/3 by 0.33, so you have at least one pixel margin on the two edges of the bottom face that touch west and south faces. All the others /3 can stay /3 as anyway every other edge is either actually shared, touching border (and thanks to the :c: won't interpolate to the opposing border), or touching an unused UV space.
My local d= is too low. I'm pretty sure that you could see a face of the cube cutting a corner of the map if you look at it from the opposite corner while the cube is sideway. So replace 1.2 with 1.5. Also, instead of recalculating d every frame, you could make it a constant. Anything bigger than the map diagonal + camera height, but lower than whatever values makes OpenGL coordinates overflow.

Re: Lua Skybox
Posted: 12 May 2010, 15:03
by Beherith
Thank you very much, its all I ever dreamed it to be :D
What can I do for you?
Re: Lua Skybox
Posted: 12 May 2010, 21:48
by zwzsg
Beherith wrote:What can I do for you?
I want to just save that voucher for a Beherith hand for later. I'm sure I could use it, but I wouldn't want to waste such an offer only to find it spent when I'll really need it.
Re: Lua Skybox
Posted: 12 May 2010, 22:13
by Pxtl
Heheh, I'd love to see a Beherith-designed KP map, personally - not that I'm in the position to ask.
Re: Lua Skybox
Posted: 12 May 2010, 23:00
by CarRepairer
Does this mean we can finally draw a giant f--- in sky?
Oh man I just couldn't help myself. <3 emmanuel
Re: Lua Skybox
Posted: 13 May 2010, 12:04
by Tribulex
yeah and we can animate said f*** in sky
Re: Lua Skybox
Posted: 13 May 2010, 12:23
by Beherith
Thanks, looks pretty freakin sweet ingame :D
Re: Lua Skybox
Posted: 13 May 2010, 13:12
by luckywaldo7
Beherith wrote:I would like to rotate it via lua to make it look like map is in orbit.
I sense epicness incoming
Re: Lua Skybox
Posted: 13 May 2010, 14:29
by Satirik
did you stop working on the ice map behe ? :D