I have an outdoor skybox, but I want me reflections on metal objects to be from the inside of the model, so I rendered out a spheremap in order have the metal reflext back the right hue.
The only problem I’m running into now, is it seems like whenever I populate the Sphere Map slot in the Environment Section of the material editor, it seems like I lose all control of glossiness on the metal parts of my material. It will only respond to changes in “Reflectivity” for the environment map. Is the intended behavior? When using the regular skybox, the metal portions of my materials visually change when adjusting glossiness.
Update:
Looks like it was related to using a sphere map instead of a cube map. Rendering out a cubemap restored the finer controls of glossiness.
2 Likes
Hello.
I am reviving this topic, because I encountered the same problem as @eproasim .
Unfortunately it seems like I can not use cubemaps right now in my specific project and I would need to make the spheremaps work, to get an environment reflections going in my materials.
Steps to reproduce:
-
I drop a spheremap.hdr image in the Play Canvas Assets browser. The editor automatically creates spheremap.png for me.
-
If I put spheremap.png in the “Sphere Map” slot of the Environment Tab of the material, then I get a fully reflective material. Changing the “Glossiness” slider in the Specular Tab of the material seems to do something, but I always have this bold reflection on top of my material.

-
I then right click on spheremap.png in the Assets browser and select the “Create Cubemap” command.
-
I click on the newly created cubemap and in its properties, I need to click “DELTE PREFILTERED DATA” and then click “PREFILTER CUBEMAP”. If I do not perform this step, I will have the same problems with the cubemap, as I had with the spheremap above!

-
Afterwards, I assign the cubemap to the “Cube Map” "slot of the Environment Tab of the material. This gives the desired control when changing the “Glossiness” slider in the Specular Tab of the material.

################################################################################
Is this behaviour a bug? What does this “PREFILTER CUBEMAP” function do to the cubemap data and does the spheremap need to be “prefiltered” as well, to get it to work properly?
Prefilter cubemap creates a mip version of he cubemap texture, containing ‘blurred’ reflections, which are then used based on the glossiness level.
I do not believe this is supported on the sphere map, and that it provides sharp reflections only.
What’s the reason for not using cubemap?
What’s the reason for not using cubemap?
Sadly we encountered an issue with old iPads where the use of cubemaps would make old iPads (2018) run out of textureUnits and crashes playcanvas (even with blank projects). For that reason we’d like to switch to sphere map as it requires only 1 texture rather than 6.
Thrown error would be :
TypeError: undefined is not an object (evaluating ‘this.textureUnits[textureUnit][slot]’)
I think it’s a low level issue (could it be with WebGL ?).
Anyway we would like to do environment lighting using spheremaps, is there any workarounds ?
The error you get seems more like a bug in the engine. Is there any chance you could create a simple repro for this we can look at?
Those old iOS devices only expose 8 texture slots instead of 16, and so that is likely causing the problem here if a shader uses more than 8 textures.
Note that both cube map and sphere map use a single slot only, so that should cause no difference.
Anyway we would like to do environment lighting using spheremaps, is there any workarounds ?
Not that I’m aware of, blurry reflections using spheremap are simply not supported, and it’s not a simple thing to add.
You can turn off the clustered lighting support in the Settings → Editor, that would save you 1-2 textures on those platforms, or try to use smaller number of textures on the materials.