Hello,
I am learning about more realistic light, and ppl are using cubemaps in shaders, but they always have ready cubemap and only explain how to read it, not how to create it.
I saw something called Light Probes in Unity, but I am not sure is it the same or can I use them in my shader instead of cubemap.
Will be extremaly grateful for any explanations.
If you already have a scene built you can use a reflection probe to generate a cube map of your scene from one or several points (one for each reflection probe). Alternatively a popular source of cube maps is using 360 panorama photos found online. There are several available for free. You can import them into Unity and it can automatically convert them into cube maps for you.
https://docs.unity3d.com/Manual/class-Cubemap.html
Or you can render them out yourself as 6 views in your tool of choice. Lots of resources out there for how to make them.
Light probes are not cube maps, at least not in Unity. Some engines do use cubemaps for light probes, but in Unity they’re stored using spherical harmonics.
https://blogs.unity3d.com/2011/03/09/light-probes/
Thank you
So I just bake Reflection Probe with enabled Projection Box, copy this baked cubemap and I can calculate reflection, refraction, fresnel and all this stuff on this one baked cubemap?
Why copy it? If you’re using forward rendering the closest reflection probe is passed to the shader already.
I think I still dont understand it For example when I write refraction shader, I have refracted vector and read “refracted value” from cubemap to mimic refraction inside crystal or water. So using texCUBE(_CubeMap, refractedVector) I must have _CubeMap to pass into the function. Thats why I thought I have to copy baked map, to drag and drop it into the slot in my shader property.
See the section titled:
Environment reflection using world-space normals
I think I see now Just need to add
UNITY_SAMPLE_TEXCUBE(unity_SpecCube0, worldRefl);
DecodeHDR (skyData, unity_SpecCube0_HDR);
and my shader read data from all probes