Using Cubemaps in custom shaders

i need to use Cubemap texture in my shaders.

Is there any way to use Skybox as Cubemap in shaders or is there any way create cubemap dynamicly from loaded textures in script.

You can create cubemaps from textures in the Designer. Check out the user manual here.

Once you have a cubemap asset. You should assign it to a script attribute Then you can access it from your scripts. Something like this:

At the top of your script file:

pc.script.attribute("cubeMap", "asset", []);

In your script:

var cubemapAsset = context.assets.getAssetById(this.cubeMap);
var cubemap = cubemapAsset.resource;

Thanks a lot!!!

Now my shader works well (diffuse + bump + specular + emission from cubemap).

Now metall walls of house looks almost real and awesome!

Looks great, do you have a link to the project. I’d love to see it running.

Now i work offline mostly on my local server. Later, when i deploy project on server, i’ll post link here.

reference: - this is only simple scene. There is still a lot of work for me :slight_smile:

1 Like

Nice. How does your shader differ from the default PlayCanvas one?

I didn’t compare them. I’d been working on Unity before - and just rewrote my Unity shaders for GLSL.

I found that PlayCanvas works much faster then Unity 5.0 WebGL solution, and now i 'm just experimenting whether i can move to PlayCanvas completly.