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.
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...
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?
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.
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.
Attachments:
File comment: V2 - Corrected comments about faces. - Made it spin in a dizzier way. - Texture not mirrored anymore. - Bug: When interpolating on the picture border, Spring fades to transparent. GreatCubeInTheSky.lua [2.72 KiB]
Downloaded 109 times
Users browsing this forum: No registered users and 1 guest
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum