-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[rtextures/rlgl] Load mipmaps for cubemaps #4429
Conversation
6d20ec7
to
5a66053
Compare
@Not-Nik Thanks for the improvement! |
@Not-Nik I'm afraid this PR breaks |
I just put a quick fix to avoid the crash in the |
The fix should comment out both mipmap generations, other wise OpenGL will try to read mipmaps that aren't properly generated |
I found the bug, I'll create a fixup PR in 20 minutes |
* [rlgl] Load cubemap mipmaps * [rtextures] Only generate mipmaps that don't already exist * [rtextures] ImageDraw(): Implement drawing to mipmaps * [rtextures] Load cubemap mipmaps
Load all mipmaps for cubemaps to the GPU and enable the proper filters for them. This is especially important for image based lighting (IBL), where for different roughness levels, different pre-filtered environment maps are stored in mipmaps. Calculating these filters is rather expensive, so it is often done offline and the pre-filtered cubemaps are shipped with the game.
The implementation did require some reworking; notably
rlLoadTextureCubemap
gains a newmipmapCount
parameter, andImageMipmaps
no longer regenerates already existing mipmaps.I structured the PR to be able to just be rebased onto master if you want all the different changes to reflect in the tree.