New extension: Environment Map #1692
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Provides two ways to create environment map. (Cube Map and Equirectangular Map)
It applies the image texture to the threejs environment map. and It has also option to apply same texture to the gdevelop scene background. On this one it override the gdevelop render. Because on default gdevelop's only option for background is color picker, we can't put images to the scene backgrounds. So that makes the game freeze at the beginning till the images load for the background.
For the Equirectangular image method: Because threejs scene is Y up the background and environment map created is not suitable for Z up games.
Unless gdevelop start to use threejs version 162 and above. 162 is the first time environment map and background rotations implemented. When Gdevelop migrates to newer threejs version I will update this extension to provide easy way to rotate environment map to Z up.
For the cube map: images can be edited externally to get the desired orientation.
Also when Gdevelop adds a .hdr file support this extension can be updated for that too.
How to use the extension
Why do you need this?
3D models with reflective surfaces (metalness/roughness) will reflect this Environment Map.
Your scene will be illuminated realisticly with this Environment Map.
Good for creating static Skyboxes that covers entire 360° Scene background.
How to use this?
Cube Map: Use tools like https://matheowis.github.io/HDRI-to-CubeMap/ to create a CubeMap from HDRI images.
Equirectangular Map: Use HDRI preview images from sites like https://polyhaven.com/
Make sure to choose "Keep Model Material" in 3D model's object properties
Limitations
This is not for realtime reflections, your reflections are gonna be static image.
Gdevelop doesn't have .hdr file format support, Only image formats (png, jpg etc.) can be used.
In Gdevelop Threejs scene is Y up oriented. For your Z up game, Cube Map textures needs to be setup manually for desired result.
Checklist
What tier of review do you aim for your extension?
Community (Unreviewed)
Example file
Environment Map Example.zip
Extension file
EnvironmentMap.zip
Extension by @Eldarduil
You can update the extension on this "Pull Request" by commenting the update command: in the comment field, type
!update
, then drag and drop a zip file with your extension file in the commenting field, like how you initially submitted the extension. It should look like this:It can take a few seconds for the file to fully upload and show as the above. Once it is like shown above, click "Comment" and let the bot do the rest!