Realtime Lightmaps & Skyboxes

Hey guys, it me again… This time trying to get some DEVELOPER INFO on realtime lightmaps…

I cant find anything other than CHECK THE LIGHTMAPPED BOX…

Using the Engine Only … How do i use runtime lightmaps ???

P.S. If i have to pay for a pro account to get the docs for playcanvas (even though i will never propobly use the online editor for my real games… i will pay for an account if it gets me DOCUMENTATION)… Is that what i have to do to get DOCS on how to setup realtime lightmaps…

Also … I wanna setup Skyboxes… But cant find the details on how to dow so…

How so setup a 6 sided LDR skybox using six seperate images and how to use a pre filtered DDS as the skybox…

In other engine there is a SKYBOX… usally a DDS with 1 MIP level and NO radiance to use as the actual sky… could be big like 1024 x 1024… then you have a ENV HDR/DDS for reflections that is usally much smaller like 128 or 256 and the WHOLE mip chain and could be RadianceHDR or SpecularHDR…

But again, no info in playcanvas how to use the raw assets… Just DRAG six images to the editor and dont worry your pretty little head about what the editor is doing behind the scenes to setup that skybox… Dont worry about what properties are being set on the scene… I cant get over that :frowning:

Again… I am the A-HOLE bringing this up again… but for real what are we supposed to do ???

I give you this one. Skyboxes is a bit of mystery with the engine only. Will has an example here which should help you get partway there: [SOLVED] Calling pc.prefilterCubemap

I never figured out how to load the DDS only. The closest I got was here: Unable to load JSON skybox

Edit: The tone you are giving off in the posts are not helping encouraging people to help you.

I can only apologize for the negative tone… was long night for me.

I have and am still going thru the raw code. But being a newbie that doesn’t tell me much about the right way to stuff… more there is a property called whatever, but not really how to use them to accomplish a task…

I am coming from Babylon where there is documentation and code telling all the steps you need to do something… all the properties that need a value and why… nothing restricted.

I can’t really tell what you do and don’t get without the editor… like the real-time lightmaps. Got no clue how I use that one…

I have a complete Charater Animation System based of Unity Mechanim that I created for Babylon Js … it does the whole thing Animate state machine complete with properties, transitions, conditions. Blend trees using true weighted blending… not just blending the transition from one animation to another but real blend trees and avatar mask so you can play blends from multiple layers on different parts of skeleton…

I wanted to bring that library across PlayCanvas so we can full unity style character animation and blend tree support, but I’m worried I won’t be able to find docs on doing the thing I need to get to that low level skeleton api so I can sample all my animation clips on all the layers, decomposed the lerp/ slerp, blend them together by input weight then layer weight… and finally update that bone matrix…

I don’t think I will ever be able to put the kind of toolkit features I made for Babylon https://www.babylontoolkit.com

That’s my toolkit, check it out…

I wanted to port some that stuff to PlayCanvas…
like mechanim style animations, design time and runtime prefabs and full terrain support with spatmaps… plus a bunch of stuff in there

Again , sorry for negative tone.

Maybe I just can’t do it without a bit docs on how to use all those nice features you have in engine

If that’s what you want to really do (bring some of the features of your toolkit to PlayCanvas), have you considered emailing/contacting the team directly?

Yo @yaustar … I finally cracked the mysterious SKYBOX encoding. Now i can generate my skyboxes (including prefiltered dds) directly from Unity and use Directly in in Engine Only Without having to Upload Every thing…

It boiled doen to one simple function i created for the Unity Texture2D Extension:

        const float kRGBMMaxRange = 8.0f;
        const float kOneOverRGBMMaxRange = 1.0f / kRGBMMaxRange;

        public static Texture2D ToRGBM(this Texture2D source, bool getSafePixels = false)
        {
            if (source == null) return null;
            Color[] pixels = (getSafePixels == true) ? source.GetSafePixels() : source.GetPixels();
            var result = new Texture2D(source.width, source.height, TextureFormat.RGBAFloat, false);
            result.name = source.name;

            int index = 0;
            for (int y=0; y < source.height; y++) 
            {
                for (int x=0; x < source.width; x++) 
                {
                    float r = pixels[index].r * kOneOverRGBMMaxRange;
                    float g = pixels[index].g * kOneOverRGBMMaxRange;
                    float b = pixels[index].b * kOneOverRGBMMaxRange;
                    
                    float a = Mathf.Max(Mathf.Max(r, g), Mathf.Max(b, 1e-6f));
                    a = Mathf.Ceil(a * 255.0f) / 255.0f;

                    pixels[index].r = Mathf.Min(r / a, 1.0f);
                    pixels[index].g = Mathf.Min(g / a, 1.0f);
                    pixels[index].b = Mathf.Min(b / a, 1.0f);
                    pixels[index].a = Mathf.Min(a, 1.0f);

                    index++;
                }
            }
            if (pixels != null) {
                result.SetPixels(pixels);
                result.Apply();
            }
            return result;
        }

Thanks for the help along the way :slight_smile:

Cool, what’s the code on the other end to load it? @Mike_Kennedy might be interested in this as well as they were having problems generating DDS at one point?

That ToRGBM will encode 32bit Packed HDR … can save those bytes to disk… The png will be in the native PlayCanvas RGBM Tecture format… so just set pc.Texture.rgbm = true just like normal.

That will use as HDR texture in PlayCanvas…

I use a plugin I created for cmft command line to bake the environment in BGRA8 dds … the 16f and 32f dds not working in PlayCanvas as of version 1.5.0

1 Like

Basically the whole reason they say upload 6 textures and the server will encode a HDR png and optionally prefilter… which bakes an environment reflection texture…

That ToRGBM code does the same thing the server does when you upload HDR and EXR textures…

When using my new Canvas Tools for local engine only game development… I take care of this natively by encoding unity skyboxes and reflection probes to the PlayCanvas 32 bit HDR format using RenderToTexture and a shader to convert to RGBM … Super fast… now I can even dynamically generate all this at export time … even using high resolution 8K Panorama HDR are split into 6 cube faces and encoded as RGBM… Really smooth and fast

See that’s all I needed to know … those details that are NOT published anywhere… once I know what the deal is with a particular API … I can go to town :grinning: