Skip to content

Skybox support #821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 18, 2025
Merged

Skybox support #821

merged 1 commit into from
Apr 18, 2025

Conversation

ArthurVoxowl
Copy link
Collaborator

@ArthurVoxowl ArthurVoxowl commented Apr 11, 2025

Implementation of Sky.Image to load skyboxes:

-- skybox loaded from cubemap file data
Sky.Image = Data:FromBundle("images/skybox.ktx")

-- filtering is ON by default, turn it OFF if using a pixelart skybox
Sky.Image = { Data:FromBundle("images/skybox.ktx"), filtering = false }

-- skybox loaded from a full set of images
Sky.Image = {
   top = Data:FromBundle("images/top.jpg"),
   bottom = Data:FromBundle("images/bottom.jpg"),
   right = Data:FromBundle("images/right.jpg"),
   left = Data:FromBundle("images/left.jpg"),
   front = Data:FromBundle("images/front.jpg"),
   back = Data:FromBundle("images/back.jpg")
}

-- skybox loaded from set of images, with replicated right, left, front, and back
Sky.Image = {
   top = Data:FromBundle("images/top.jpg"),
   bottom = Data:FromBundle("images/bottom.jpg"),
   sides = Data:FromBundle("images/seamlessLandscape.jpg")
}

-- skybox loaded from partial set of images, any missing face will be white (here top and bottom)
Sky.Image = {
   right = Data:FromBundle("images/right.jpg"),
   left = Data:FromBundle("images/left.jpg"),
   front = Data:FromBundle("images/front.jpg"),
   back = Data:FromBundle("images/back.jpg")
}

-- remove cubemap(s)
Sky.Image = nil -- or false

-- skybox colors are applied multiplicatively with cubemap
-- most common use-case is to set them to white, but it can be used to create interesting effects
Sky.SkyColor = Color.White
Sky.HorizonColor = Color.White
Sky.AbyssColor = Color.White

-- preload two cubemaps to lerp later
Sky.Image = {
   cubemap1, -- all options described above to load a cubemap can be used here
   cubemap2,
   t = 0.0
}

-- animate the lerp value later, for example in Client.Tick function
Sky.Image = { t = animatedValue }

@ArthurVoxowl ArthurVoxowl self-assigned this Apr 11, 2025
@ArthurVoxowl ArthurVoxowl added the do not merge yet not ready to be merged yet label Apr 11, 2025
@ArthurVoxowl ArthurVoxowl force-pushed the skybox branch 3 times, most recently from d6ccfc4 to c1577b5 Compare April 16, 2025 14:13
@ArthurVoxowl ArthurVoxowl removed the do not merge yet not ready to be merged yet label Apr 16, 2025
@ArthurVoxowl ArthurVoxowl force-pushed the skybox branch 2 times, most recently from 6b4372a to a14369e Compare April 18, 2025 06:24
Copy link
Collaborator

@aduermael aduermael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@aduermael aduermael merged commit b3cdb04 into main Apr 18, 2025
3 checks passed
@aduermael aduermael deleted the skybox branch April 18, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants